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

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

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

by 4aiman » Wed Feb 27, 2013 23:26

Here how it looks like:
Image

How to use this: craft a map block out of 4 dirts:
Code: Select all
none dirt none
dirt dirt dirt

Take a map into your hands and just left-click! As easy as that! ;)

Licence: WTFPL
Download: https://github.com/4aiman/mapp/archive/master.zip
Includes 16*16 and 32*32 textures!

Credit goes to:
pandaro, who made player_radar mod.
I looked into the "player_radar" mod and came up with idea to use smth similar for maps.
So I wrote a simple test-mod and start to actually test it.
RealBadAngel, who made map a tool, not a block that must be punched :)
Calinou for ideas about the playermark.
kaeza and Splizard for optimizing the code.
Last edited by 4aiman on Fri Mar 08, 2013 16:03, edited 1 time in total.
 

lkjoel
Member
 
Posts: 779
Joined: Wed Feb 29, 2012 19:27
Location: Gallifrey

by lkjoel » Wed Feb 27, 2013 23:56

COOL!!! +1000
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.
 

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

by 0gb.us » Thu Feb 28, 2013 01:47

Oh? That's awesome!

If this could be incorporated into some sort of in-menu (inventory_plus) map, that would be even better. Once you lay the foundation, the rest would be easy. I'll swap on_punch() for on_receive_fields(), and add it to my world.

I'll have to keep an eye on this and see how it progresses.
 

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

by Josh » Thu Feb 28, 2013 02:06

Looking good! however i would prefer the map to appear in the players hand and not show up when
you punch a block. But great work 4aiman :)


P.S: What do you mean by: Dont use this in your playing world? Can't we use it in singleplayer?
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48
Location: McKinney, Texas U.S.A.

by Traxie21 » Thu Feb 28, 2013 02:10

You can't really make the map appear in the player's hand.


And I think he means that it might corrupt your world.
 

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

by 4aiman » Thu Feb 28, 2013 05:52

I mean that cycles like the one in this prototype is very slow.
But what's more important, they STOP client-server communication ('cause server is too busy to answer it's clients).
I tested that on 5 or 6 worlds and have to delete some of them, 'cause (after 4th-8th punch of a map node) server went "silent" (which is normal by itself - the server was computing a map formspec). Sometimes I just wait a little and server begins to response once again. But sometimes even after restarting minetest maps with map_node refuse to load. I mean, I can load the game, but it looks like the game can't load any blocks than it already loaded. That leaves me in a 30*30*30 world (approx.) w/o any way to dig smth and get node_drops (well, that's natural thing when server's too busy).

The main problem is how to allow server make it's work while still be responsible.
Smth like Application.ProcessMessages would be great. Or creating a different thread would be great.
I'll see what I can do wit what we have atm.

PS: if anyone will use this/have some ideas on this, I encourage all of those people to post here their suggestions/code samples/links to your modifications/links to things inspired by this prototype. One can never know what this thing may lead to ;)
 

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

by jojoa1997 » Thu Feb 28, 2013 12:20

could you have paper do this like looking at a map.
P=paper, C=coal
PPP
PCP
PPP
coal is to implement writing.
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

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

by 4aiman » Fri Mar 01, 2013 20:55

UPDATE!
+ Different heights distinction
+ Shows map depending on map_block's position
+ Underground map_block will show you map of the cave you're in
 

User avatar
VanessaE
Moderator
 
Posts: 4389
Joined: Sun Apr 01, 2012 12:38
Location: Waynesville, NC
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE

by VanessaE » Fri Mar 01, 2013 22:05

Have you considered making this an item that you punch with (like using a tool or eating an apple) to display the map? I think that would be more natural than placing the block on the ground and punching it.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
 

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

User avatar
cHyper
Member
 
Posts: 803
Joined: Fri May 06, 2011 08:49
Location: Austria
GitHub: cHyper-0815OL
IRC: cHyper
In-game: cHyper
 

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

by 4aiman » Sat Mar 02, 2013 07:22

VanessaE wrote:Have you considered making this an item that you punch with (like using a tool or eating an apple) to display the map? I think that would be more natural than placing the block on the ground and punching it.

This mod is merely a prototype - I just testing things, so that's why I didn't make it "more natutal" :)

RealBadAngel, thanks for tweaking this towards peoples wishes! ;)
Also, two words: naming convention. It's "mapp:map", not "map:map". ;)

I've updated this mod at GitHub, so link from the first post now leads to a tool. Those, who for any reason still want a block, look into init_.lua.

Any ideas for adding player mark? Not only a point, but rather an arrow, which shows what wilder is looking at?
[Rotate modifier can't rotate less than 90 deg...
Last edited by 4aiman on Sat Mar 02, 2013 07:30, edited 1 time in total.
 

User avatar
pandaro
Member
 
Posts: 308
Joined: Sun Jan 08, 2012 21:34
Location: behind
GitHub: pandaro

by pandaro » Sat Mar 02, 2013 18:18

Any ideas for adding player mark? Not only a point, but rather an arrow, which shows what wilder is looking at?
player:getyaw()

and +1 good work
sorry for bad english
Linux debian 7 wheezy 64
kde
 

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

by 4aiman » Sat Mar 02, 2013 18:48

pandaro wrote:player:getyaw()

I mean, how to rotate texture to show that yaw, not how to get it ;)
 

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

by kaeza » Sat Mar 02, 2013 19:04

Hmm... this may sound complicated, but how about you draw a bunch of textures for, let's say, angles 0-90 in 10deg increments, and use them as a base, rotating to get the other angles as needed?
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
 

User avatar
Calinou
Moderator
 
Posts: 3153
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Sat Mar 02, 2013 20:52

Some very basic textures (4 is probably enough, will give 16 directions by rotating them in the mod):
Image
Image
Image
Image
License: WTFPL
Last edited by Calinou on Sat Mar 02, 2013 20:53, edited 1 time in total.
 

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

by 4aiman » Sun Mar 03, 2013 15:42

Hmm.. 4 textures + rotate... Thanks, kaeza, Calinou, I'll add this ;)
Added!
Last edited by 4aiman on Sun Mar 03, 2013 21:30, edited 1 time in total.
 

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

by Inocudom » Tue Mar 05, 2013 22:17

A feature that turns whether liquids show on the map on or off would be a good idea (or the liquids could be transparent with the nodes below showing in them.)
Pray every single day for the safety and well-being of my gaming PC, Xion. Pray the Lord's Prayer too.
 

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

by 4aiman » Wed Mar 06, 2013 11:50

Inocudom wrote:A feature that turns whether liquids show on the map on or off would be a good idea (or the liquids could be transparent with the nodes below showing in them.)


I had the same idea ;) Will implement once be at home.

Also, there are some questions:
1. Could anyone teach me how to "cut" a single frame from a sprite-sheet? Things like flowing water and lava can be shown using water/lava~source texture, but what about animated torches & grass and other things?
2. I wanted to hide landscape if player is underground. I made a func is_ug(pos) that checks that.
But the problem is where to stop. Currently I go up if the block at y=player.pos.y in not an "air" block and go down if it is.
But imagine a cave, that splits into to paths each going in the opposite direction to another: one up goes and one goes down. So, my question is about logic:

How can I know when I need to go DOWN instead of going UP, if the block at y=player.pos.y in not an "air"?

Currently I go 10-15 blocks down and if there's still non-air block then I go up. Is there any better way to draw only what player would see, e.g w/o drawing the surface?
 

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

by Splizard » Thu Mar 07, 2013 22:20

I have made a pull request on github with some misc performance improvements:

  • Making minetest.env and minetest.registered_nodes local.
  • Using table.concat instead of concatenating in a loop.
  • And other small things.

The map is now generated up to 2x as fast as before and the time it takes to generate is now printed in the terminal.
https://github.com/4aiman/mapp/pull/1
Games: The Hungry Games Mods: Lifters (Simple Lifts), Snow Biomes and Gates. Also checkout my texture pack Gridtoon!
 

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

by 4aiman » Fri Mar 08, 2013 07:14

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?
Last edited by 4aiman on Fri Mar 08, 2013 07:28, edited 1 time in total.
 

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

by kaeza » Fri Mar 08, 2013 11:11

https://github.com/4aiman/mapp/pull/2
A small contribution.
Just tested this mod (been too busy [read as lazy] lately :) ); it's very impressive.
Excellent work.
Edit:
Small suggestion: make the visible range customizable in the script. This can be useful for singleplayer where the mod runs fast (without network overhead).
Last edited by kaeza on Fri Mar 08, 2013 11:32, 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
 

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

by RealBadAngel » Fri Mar 08, 2013 13:53

well if this mod could make efficent and good rules to display the map, maybe i or some1 else could implement it as a engine hud feature...
 

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

by kaeza » Fri Mar 08, 2013 15:43

Added experimental threading support to avoid freezing the server.

https://github.com/kaeza/mapp/tree/threading

Need to do some testing first, then I'll open a pull request.
Can someone help testing this?
EDIT: Works a bit slow on singleplayer; threading support can be disabled by setting ENABLE_THREADS to false.
Last edited by kaeza on Fri Mar 08, 2013 15:44, 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 » Fri Mar 08, 2013 15:59

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.
 

Next

Return to WIP Mods



Who is online

Users browsing this forum: DS-minetest, Google [Bot] and 4 guests