[Mod] MapIt [1.2] [mapit] – another mapping mod

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

[Mod] MapIt [1.2] [mapit] – another mapping mod

by dgm5555 » Post

Download: https://github.com/dgm3333/mapit
https://github.com/dgm3333/mapit/archive/master.zip

This mod displays a map of the entire minetest world with a location arrow and direction.
It also enables you to teleport with the world, either by dividing the world into a 10x10 grid, or if you install the travelpoints mod, it will place these on the map.
It can integrate with unified_Inventory, so you can access the map direct from the UI form.
Finally it also provides a map node with the world map on it, which can be placed like any other node.

Dependancies (for the python script):
python: 2.x or 3.x: http://python.org/
numpy: https://sourceforge.net/projects/numpy/ ... mPy/1.9.2/
PIL or Pillow: https://pypi.python.org/pypi/Pillow/2.8.2

Optional Minetest Dependancies:
Travelpoints - teleport links around the minetest world viewtopic.php?f=11&t=8021
Unified Inventory:viewtopic.php?f=11&t=3933&start=125

I've borrowed from other peoples code, so thanks to:
MAPP: viewtopic.php?f=9&t=4922.
VanessaE for her massive minetest colour file (I had to remove the comments as they broke the script), so maps show dramatically more features (and colours are more accurate).
Maps are generated offline by minetestmapper-numpy.py viewtopic.php?f=14&t=8730. The legacy minetestmapper viewtopic.php?f=3&t=49 is not supported as I recoded the -numpy script to add text comments to the PNG.
Not essential, but I also think MT-GitSync is great for keeping your mods uptodate viewtopic.php?f=14&t=8749&hilit=gitsync

USAGE:
Install Dependancies:-
As well as enabling the mod in minetest you will need python, numpy, and the python imaging library. Very easy in Ubuntu: in the software centre, just install python, python-numpy and python-pil or python3, python3-numpy and python3-pil.

Generating map:
Normally, the map will be automatically generated when you enter a new world. Alternatively there is a button on the maptool to manually reMap (but you will have to exit the world and re-enter to update the texture).
It is possible to only regenerate at timed intervals (currently set up update each day, but you can set updateInterval in init.lua). However to enable this mode you'll need to install luaFileSystem. I'm not sure on Windows, but on linux it's:
sudo luarocks install luafilesystem
sudo apt-get install luarocks

Display the map:
Select the mapit:maptool in your inventory.
L-button (punch) to bring up the map.
So far it doesn't have a recipe, so you'll have to use creative mode, or the chat command: /give mapit:maptool

On the right of the form are buttons for zoom in/out (not working), reMap (as above), and teleport and travelpoints (if you have installed that mod).
With the teleport grid ground level is generally accurately identified. There used to be a bug meaning you might end up inside a node in which case if you teleport repeatedly to the same spot and as minetest loads blocks near your location, ultimately the surface will be reached (This doesn't seem to have occurred since a rewrite using voxelmanip).
With travelpoints, you can either click on the number location on the map (maximum of 50), or on the buttons on the right (max of approx 20 depending on form size).

TODO:
It probably won't be improved much from now, but the improvements I might (or wish I could) make are:-
*Zoom In and Out on the map - Would be great if it was possible to zoom in with the mousewheel, but looks like the formspec doesn't support that.
*Make a big mesh billboard...


Having said that, I think it is already quite a useful excellent quality map.


The little green arrow shows location and direction of gaze:-
Image
This shows integration with unified_inventory. You click the little button along the bottom then the main map to bring up the full working version (actually this doesn't work well, so I disabled it)
Image
Teleport mode provides a 10x10 grid for approximate teleport destination (you will jump to the centre of the square)
Image
Travelpoints are clickable on both map and the buttons on the side:-
Image
Useful for checking world generation: This ice-glitch occurred when I enabled paragenv7 on a pre-existing world...
Image
The map is not updated automatically until you reload the world after an approproate interval (by default 24hours), but is still v. helpful if you get lost on a large world (this one's over 2000x2000)
Image

Licence: WTFPL v2
Download: https://github.com/dgm3333/mapit
https://github.com/dgm3333/mapit/archive/master.zip
Last edited by dgm5555 on Thu Jun 18, 2015 07:27, edited 31 times in total.

User avatar
JPRuehmann
Member
Posts: 334
Joined: Fri Mar 21, 2014 21:40
Location: Germany
Contact:

Re: MapIt - another mapping mod

by JPRuehmann » Post

Good Idea to Mix Map and Mapp into one new.
github?
Thanks,
JPR

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: MapIt - another mapping mod

by dgm5555 » Post

The mod basic mapping function is now completed.
I'm wondering about adding the teleport feature to the map...
Does anyone know a quick way return the ground level at a particular x,z location. I vaguely remember something about checking lighting level, but can't find it any more.
I also need to be able to return mouse actions from a form.
David

Amaz
Member
Posts: 354
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: MapIt - another mapping mod

by Amaz » Post

Where is the MapWorlds.sh script? I can't see it anywhere...

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: MapIt - another mapping mod

by dgm5555 » Post

Sorry, now uploaded...

Thedarksoldier
New member
Posts: 8
Joined: Mon May 26, 2014 11:12
In-game: subham

Re: [MOD] MapIt - another mapping mod [1.0] [mapit]

by Thedarksoldier » Post

where do i get phython and numpy on windows

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:

Re: [MOD] MapIt - another mapping mod [1.0] [mapit]

by Evergreen » Post


dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [MOD] MapIt - another mapping mod [1.0] [mapit]

by dgm5555 » Post

A warning: I've identified a couple of minor related bugs which occur ONLY if the mod is run before the map(=texture) has been generated (by the python script).
1. When the world is entered, an error is produced about missing textures.
2. (more serious). when the mapit tool is activated (by holding it and punching). It will cause a fatal error and crash minetest back to the main menu.

You'll have no problems if you run the python script before activating the tool, and hopefully I get a fix for both soon

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

Re: [MOD] MapIt - another mapping mod [1.0] [mapit]

by 4aiman » Post

What about updating the map every day? (IDK the real one or the in-game one)

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [MOD] MapIt - another mapping mod [1.0] [mapit]

by dgm5555 » Post

4aiman wrote:What about updating the map every day? (IDK the real one or the in-game one)
Good idea, I'd put it in the too hard basket, but your question got me thinking. I can't get the modification date in lua under minetest (I could do it with lfs, but that's not included in minetest lua)
However possible workarounds would be to create a file with the worldname and current date, then check for it's existence, or save a data file with a list of creation dates (and now I've thought of it, I might do just that). Less robust use io.popen to check from the os.

Otherwise, as part of my bugfix, I've coded all other steps, and can trigger the python script to generate a map file on world load (but this is tiresome on a reasonable size world if it happens every load). I started by copying a dummy file to fill the space until the user triggered file generation, but this is now probably unnecessary.
Might also add a button to the map to allow manual triggering (but would still require exiting the world, as I don't know how to trigger a reload of a texture image any other way)
Watch this space...

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

Re: [MOD] MapIt - another mapping mod [1.0] [mapit]

by 4aiman » Post

just a silly question:
you use texture for a formspec.
formspecs can be generated to use different image names.
why not use minetest.show_formspec and use the new image (you can rewrite the original texture file or create a new one).

A file with the date of creation is good :)

Also, does minetest.override_item() work after some time ingame? (simple redefinition with minetest.register(':modmane:itemname') doesn't)

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [MOD] MapIt - another mapping mod [1.0] [mapit]

by dgm5555 » Post

I've updated the mod to allow automatic (timed) and manual (background) regeneration of the map.
4aiman wrote:why not use minetest.show_formspec
I originally expected this would work, but it doesn't seem to. I think the engine loads the texture on entering the world, and must save in memory. Updating the png doesn't change the formspec until you exit and re-enter the world (same as changing a .lua doesn't have any effect).
4aiman wrote:A file with the date of creation is good :)
For no particular reason, I went for the option of saving a history file, but that would have worked too.
4aiman wrote:Also, does minetest.override_item() work after some time ingame? (simple redefinition with minetest.register(':modmane:itemname') doesn't)
I don't know, I would have guessed it would only be applied at initialization (ie on entering the world), but some of the effect of the methods isn't well documented (forceload is another example), and trying to track it back through the source code isn't always that easy.

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

Re: [MOD] MapIt - another mapping mod [1.1] [mapit]

by 4aiman » Post

Then something like dynamic images load should be proposed to be added to the engine. Useful for many cases - just like celeron55 likes :)

As for "tracing back through the src"... I didn't mean that. I just asked if you could possibly try to use it. It's just I can't until 26th of June.

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [MOD] MapIt - another mapping mod [1.1] [mapit]

by dgm5555 » Post

4aiman wrote:Then something like dynamic images load should be proposed to be added to the engine
In the "Modders: Give feedback to the core developers" post (viewtopic.php?f=3&t=9179), I proposed being able to refresh textures or scripts for exactly this reason.
4aiman wrote:I just asked if you could possibly try to use it.
duh [strikes forehead]. Actually I did try it with different textures from a form button, but it did nothing I could see (no change in texture, no error to debug.txt or chat msg, it also didn't cause a 'Creating a dummy image' error at startup, so I didn't try any more.

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

Re: [MOD] MapIt - another mapping mod [1.1] [mapit]

by 4aiman » Post

there's no need to "duh" - I don't have much time to follow your experience ATM. But thanks for the answer.
Also: I somehow missed the question about the ground level. Do you still need a way to do it?

User avatar
linushsao
Member
Posts: 418
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus
Location: Taipei,Taiwan(R.O.C)
Contact:

Re: [MOD] MapIt - another mapping mod [1.1] [mapit]

by linushsao » Post

some problem happen to me,i'm sure that no map generated...(unknown node name?)

-----------------------------------------------
/home/linus/.minetest/worlds/stable
stable
Result image (w=912 h=672) will be written to /home/linus/.minetest/mods/mapit/textures/stable.png
Processing sector 200 of 1769 (11.3%) (ETA: 0m 3s)
Processing sector 400 of 1769 (22.6%) (ETA: 0m 3s)
Processing sector 600 of 1769 (33.9%) (ETA: 0m 2s)
Processing sector 800 of 1769 (45.2%) (ETA: 0m 2s)
Processing sector 1000 of 1769 (56.5%) (ETA: 0m 1s)
Processing sector 1200 of 1769 (67.8%) (ETA: 0m 1s)
Processing sector 1400 of 1769 (79.1%) (ETA: 0m 0s)
Processing sector 1600 of 1769 (90.4%) (ETA: 0m 0s)
Unknown node names: air pyramids:deco_stone3 darkage:mud ignore pyramids:trap bitchange:moneychanger fishing:trophy_fish_raw pyramids:spawner_mummy currency:shop doors:door_wood_b_1 bones:bones darkage:desert_stone_with_iron enchanting:enchanting_set seacoral:seacoraldirtlime currency:barter darkage:chalk darkage:silt pyramids:deco_stone2 torches:floor bitchange:bank trash_can:trash_can_wooden torches:wand lantern:candle bitchange:mineninth_in_ground homedecor:torch_wall fishing:trophy_clownfish mines:dummy
Unknown node ids: 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x15 0x1d
Drawing image
Saving to: /home/linus/.minetest/mods/mapit/textures/stable.png
PNG Region: [-208, 688, -448, 208]

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [MOD] MapIt - another mapping mod [1.1] [mapit]

by dgm5555 » Post

4aiman wrote:Also: I somehow missed the question about the ground level. Do you still need a way to do it?
No I figured out that get_voxel_manip() works to force loading of the block correctly

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [MOD] MapIt - another mapping mod [1.1] [mapit]

by dgm5555 » Post

linushsao wrote:some problem happen to me,i'm sure that no map generated...(unknown node name?)...
Saving to: /home/linus/.minetest/mods/mapit/textures/stable.png
Your map should have been saved. the Unknown node message means that there is no colour stored in the VanessaE's color.txt file for the nodes listed. It's because the script looks there for the average top colour of every node found, and uses that to generate the pixel colour in the map. If it is unknown you could add it yourself if it's really needed, otherwise it will just be ignored. Check the mapit/textures/stable.png - the map should be correct except for the listed unknown nodes.

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

Re: [MOD] MapIt - another mapping mod [1.1] [mapit]

by Inocudom » Post

viewtopic.php?f=7&t=8489
The community seems to need a reason to care about gsmapper, so I am wondering if it would help out the mapit mod any if it was added to Minetest.

sss123next
New member
Posts: 5
Joined: Sat Jul 12, 2014 05:35
In-game: sss123next

Re: [MOD] MapIt - another mapping mod [1.1] [mapit]

by sss123next » Post

hi, thank you for nice mod, i have feature request, currently it works for sqlite and leveldb, but don't for redis, exit with following error:

Code: Select all

/home/sss/.minetest/worlds/world1
world1
Traceback (most recent call last):
  File "minetestmapper-numpy.py", line 1086, in <module>
    main()
  File "minetestmapper-numpy.py", line 1072, in main
    world.generate_sector_list()
  File "minetestmapper-numpy.py", line 503, in generate_sector_list
    legacy_sector_scan(args, sectors_xmin, sector_xmax, sector_zmin, sector_zmax)
NameError: global name 'sectors_xmin' is not defined
python have hiredis bindings, called "dev-python/hiredis" on gentoo

User avatar
TheLionGirl
Member
Posts: 10
Joined: Sun Jun 22, 2014 10:20
In-game: TheLionGirl
Location: Portugal

Re: [Mod] MapIt [1.1] [mapit] – another mapping mod

by TheLionGirl » Post

Oh, its like the M-Map mod of the minecraft, rigth? But with a map in our hand
I know, I am a girl... What I am gonna to do about that??

!!!- Sorry my bad english, is because I'm portuguese -!!!

Tsumi
New member
Posts: 2
Joined: Mon Sep 15, 2014 11:57

Re: [Mod] MapIt [1.1] [mapit] – another mapping mod

by Tsumi » Post

Hi,
on python 2.7.3, running MapWorlds.sh i get this error:

Code: Select all

minetest@srv-nya:~/.minetest/mods/mapit$ ./MapWorlds.sh 
/home/minetest/.minetest/worlds/world
world
Result image (w=592 h=672) will be written to /home/minetest/.minetest/mods/mapit/textures/world.png
Error at (-23,3,-28): 'buffer' does not have the buffer interface
Traceback (most recent call last):
  File "minetestmapper-numpy.py", line 626, in generate_map_info
    f = db.get(ps)
  File "minetestmapper-numpy.py", line 436, in get
    return BytesIO(r[0])
TypeError: 'buffer' does not have the buffer interface
Block data: Traceback (most recent call last):
  File "minetestmapper-numpy.py", line 1086, in <module>
    main()
  File "minetestmapper-numpy.py", line 1081, in main
    world.generate_map_info(str_to_uid)
  File "minetestmapper-numpy.py", line 788, in generate_map_info
    for c in r[0]:
NameError: global name 'r' is not defined

Carnildo
New member
Posts: 4
Joined: Tue Sep 23, 2014 07:59

Re: [Mod] MapIt [1.1] [mapit] – another mapping mod

by Carnildo » Post

If you attempt to create a new world with MapIt active, Minetest will crash. This is because MapIt creates an empty "map.sqlite" file, which Minetest can't handle. I've modified my copy of MapIt to exit if the "map.sqlite" file isn't present, but there's got to be a better solution.

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] MapIt [1.1] [mapit] – another mapping mod

by dgm5555 » Post

Carnildo wrote:If you attempt to create a new world with MapIt active, Minetest will crash. This is because MapIt creates an empty "map.sqlite" file, which Minetest can't handle. I've modified my copy of MapIt to exit if the "map.sqlite" file isn't present, but there's got to be a better solution.
Hmm. MapIt doesn't create the sqlite file, but it does query minetest for points, so presumably minetest is crashing asked to provide them before any exist. Unfortunately I can't replicate your error, as my behaves fine. It would be quite easy to check for existance of an sqlite file though.
EDIT: I've fixed this with a one-liner, but have a few things to improve before updating the .git in the next day or two.

User avatar
Faalagorn
New member
Posts: 5
Joined: Mon Mar 09, 2015 20:22
GitHub: faalagorn

Re: MapIt - another mapping mod

by Faalagorn » Post

dgm5555 wrote:Sorry, now uploaded...
I may be doing something wrong here, but I still can't find the file anywhere... Nowhere in the archive, github, my system, or Google at all (other than the reference in the readme) o.o

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 19 guests