[Mod] MAPP - map for Minetest - optimized! [0.2.4]

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

4aiman wrote:Merged both.
Thanks for help, guys!

PS: I believe the only thing that needs to be in a separate thread is logging. (Don't confuse logging with debug info and writing to StdErr output.)
Very often when I think smth is slow, simple deletion of any output to the terminal make things usable.
I don't say we don't need threading, but single core PCs won't benefit from it much.
It's not threading per-se. It's collaborative multithreading.
What this means is that a routine suspends execution ("yields") to the caller routine.
What the patch does is incrementally generate the formspec at each game step. This means the server does not get frozen in the for loop, yielding at every line of the map.
When this happens, the server regains control, and allows other mods (and the game itself) to do their stuff. Then, at the next game step, it resumes the "threads" to generate another map line, and so on until it is complete and the map is shown to the player. It's not perfect, but at least leaves some time for other tasks.

EDIT: This also means no real threads are created. For more info, see this: http://www.lua.org/manual/5.1/manual.html#2.11
Last edited by kaeza on Fri Mar 08, 2013 16:10, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

I know how threads work ;)
The problem is that some other mod (like floatlands) will do it's stuff w/o letting anyting to interfere, and a player may wait for a very long time before entire map will be drawn... It's not the problem of this mod, though.

Also, shrinking yaw calculation wasn't flawless: Server keeps printing messages like this

Code: Select all

Creating a dummy image for "d-30.png"
That's because in my version there wasn't negative angles: you've deleted this:

Code: Select all

           if yaw<0 then yaw = 360 + yaw end
           if yaw>360 then yaw = yaw - 360 end
Edit:
Works too slow with any world-generating mod...
Kaeza, maybe you can add "threading" support to, for example, floatlands mod, so anyone can test that with current mod?
Last edited by 4aiman on Fri Mar 08, 2013 19:40, edited 1 time in total.

User avatar
0gb.us
Member
Posts: 841
Joined: Sun Sep 16, 2012 01:55
Location: 0gb.us:30000
Contact:

by 0gb.us » Post

If you can't rotate less than 90 degrees, can you rotate more that 360 to simulate angles less than 90?

I don't know if that will work, it's just something you could try.

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

0gb.us wrote:If you can't rotate less than 90 degrees, can you rotate more that 360 to simulate angles less than 90?
I don't know if that will work, it's just something you could try.
Can't say I got your point.
Lua API provides a way to rotate images by 90, 180 and 360 degrees only.
Besides, why do I need to rotate smth more than 360?
I wanted to have more precise angles and that resulted (after following a piece of advice provided me by Calinou) into having 9 textures (0 to 80 degrees) which are rotated by that implemented values. So now we can show player's direction with a step of 10 degrees - that's pretty "smooth", I think.
The only problem with negative angles was rooted to deletion of the quoted piece of code.

User avatar
Splizard
Member
Posts: 227
Joined: Wed Jan 25, 2012 07:20
GitHub: Splizard
IRC: Splizard
In-game: Splizard
Location: New Zealand
Contact:

by Splizard » Post

4aiman wrote:I'm still far from my place, so anyone will have to wait а little longer before I can do anything...

Although I can't say my version was slow, I'll test your improvements and merge them. But I'm going to delete the part with generation time, 'cause if we talk about performance, then we must clean up all unnecessary code. I believe that was added for me to notice speed up.

Where can I read about lua tricks like using tables instead of strings to get higher performance?
Yes it wasn't too slow but extra speed is nice :)
Thanks for merging it, you could just comment out the generation time stuff so you can use it if you need it again.

You can find some Lua optimizing tricks here:
http://www.lua.org/gems/sample.pdf
http://lua-users.org/wiki/OptimisationTips
http://stackoverflow.com/questions/1546 ... ua-program
Games: Builda City, The Hungry Games Mods: Lifters, Snow Biomes and Gates. Also checkout my texture pack Gridtoon!

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

Wow! Thanks for links! ;)
As for merging - any good change will be merged. Higher performance certainly is good :) In fact, there hardly 25% of my code in this mod atm, because of splendid support. So, I can't fail merging any improvement of this.
I didn't merge coroutines (threads version by kaeza) only because w/o coroutine support in world generation mods this mod (mapp) becomes much slower. However, in multiplayer that version still may prove itself more useful.

User avatar
KingSmarty
Member
Posts: 85
Joined: Wed Jan 02, 2013 12:06
GitHub: FsxShader2012
In-game: FsxShader2012
Location: Germany

by KingSmarty » Post

Why isn't it working for me have i got to move it to the game/mod folder?

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

4aiman wrote:Kaeza, maybe you can add "threading" support to, for example, floatlands mod, so anyone can test that with current mod?
That would be very hard becauseworld generation should run as fast as possible in on_generate(); also, with this system, I would have to create a new coroutine for every map block that is generating (can cause MASSIVE lag with high render distances).

P.S. 4aiman: Posts: 404 Post Not Found :P
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

The last time i tried this mod it came up as "Unknown Item" Has anyone encountered this problem? has it been fixed?
Last edited by Josh on Fri Mar 15, 2013 03:21, edited 1 time in total.

User avatar
Adarqet
Member
Posts: 173
Joined: Thu Oct 04, 2012 14:05
Location: Traveling with BorisGrishenko

by Adarqet » Post

I have been waiting for a mod like this. THANK YOU +100000000000000000

User avatar
0gb.us
Member
Posts: 841
Joined: Sun Sep 16, 2012 01:55
Location: 0gb.us:30000
Contact:

by 0gb.us » Post

4aiman wrote:
0gb.us wrote:If you can't rotate less than 90 degrees, can you rotate more that 360 to simulate angles less than 90?
I don't know if that will work, it's just something you could try.
Can't say I got your point.
Lua API provides a way to rotate images by 90, 180 and 360 degrees only.
Besides, why do I need to rotate smth more than 360?
I wanted to have more precise angles and that resulted (after following a piece of advice provided me by Calinou) into having 9 textures (0 to 80 degrees) which are rotated by that implemented values. So now we can show player's direction with a step of 10 degrees - that's pretty "smooth", I think.
The only problem with negative angles was rooted to deletion of the quoted piece of code.
Sorry, I misunderstood. I thought you said images could not be rotated by less than 90, but COULD by more. So you could, for example, rotate by 91 degrees. In this way, you could simulate a 10 degree rotation by attempting a 370 degree rotation.

But if you can only rotate in 90 degree increments, my post is unhelpful. Sorry!

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

Is this mod still being worked on, or is it dead? A way to make liquids transparent so that what is underneath can be shown would be a good idea.

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

I'm not working on anything for Minetest atm. It takes too much time to fix or add every this and that...
I'm not ready to sacrifice my other projects for Minetest. So I'm waiting for community to realize a couple of rather simple things and to make it possible to achieve those.
If anyone want to enhance this mod - they're welcome.
Anyway, as the first post says, RealBadAngel, Calinou, kaeza and Splizard contributed to this mod, so maybe it's better to ask them.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

This mod has great potential. It is a shame that nobody cares about it. Doesn't anybody want in-game maps?

deivan
Member
Posts: 452
Joined: Fri Feb 15, 2013 10:16
Location: Brazil. :D

by deivan » Post

I think if don't is very more logical this type of thing will be implemented by the game core. Hum...

User avatar
RealBadAngel
Member
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Post

deivan wrote:I think if don't is very more logical this type of thing will be implemented by the game core. Hum...
sometimes its good to make somethin first in lua, then port it to engine...

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

RealBadAngel wrote:
deivan wrote:I think if don't is very more logical this type of thing will be implemented by the game core. Hum...
sometimes its good to make somethin first in lua, then port it to engine...
I agree with that statement. I believe that the best way to test a new feature is to first make it as a mod. By doing so, bugs can be more easily found and more easily fixed.

deivan
Member
Posts: 452
Joined: Fri Feb 15, 2013 10:16
Location: Brazil. :D

by deivan » Post

Is a good point.

Jordach
Member
Posts: 4534
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

by Jordach » Post

This is awesome!

EDIT: The map should be BIGGER and use twice the amount of space, maybe three times.
Last edited by Jordach on Mon May 06, 2013 17:30, edited 1 time in total.

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

Does this still work in the latest minetest? If so I will use this.
Back from the dead!

Jordach
Member
Posts: 4534
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

by Jordach » Post

Evergreen, works in 0.4.6 latest git.

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

Jordach wrote:Evergreen, works in 0.4.6 latest git.
Awesome! :D
Back from the dead!

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

Jordach wrote:This is awesome!

EDIT: The map should be BIGGER and use twice the amount of space, maybe three times.
Yes, it really should be bigger. One of the things it can really be good for is seeing (and recording) the layouts of creations. Concerning liquids, at least water should be shown as transparent on the map (though you could do the same with lava too) so that nodes that are underwater can be shown.

I don't think 4aiman will be working on this mod anymore. Is there anybody skilled enough in this area of modding to continue development? This mod may be the only chance Minetest will ever have of having in-game maps.
Last edited by Inocudom on Thu May 09, 2013 17:25, edited 1 time in total.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

It looks like Death Dealer is back. I wonder what he thinks of this mod?

User avatar
jojoa1997
Member
Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth

by jojoa1997 » Post

Inocudom wrote:
Jordach wrote:This is awesome!

EDIT: The map should be BIGGER and use twice the amount of space, maybe three times.
Yes, it really should be bigger. One of the things it can really be good for is seeing (and recording) the layouts of creations. Concerning liquids, at least water should be shown as transparent on the map (though you could do the same with lava too) so that nodes that are underwater can be shown.

I don't think 4aiman will be working on this mod anymore. Is there anybody skilled enough in this area of modding to continue development? This mod may be the only chance Minetest will ever have of having in-game maps.
I tried making t bigger. Any bigger and the map goes wacko with lines everywhere. What needs to happen is when you use a map it turns into an image of the 16*16 what ever it is called and then save the image on that map. Also why was 4aiman banned?
Last edited by jojoa1997 on Fri May 10, 2013 10:56, edited 1 time in total.
Coding;
1X coding
3X debugging
12X tweaking to be just right

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests