A Minetest online web live map generator not requiring mods, with emphasis on compatibility without regard to speed, efficiency, or ease of use.
Compatible with GNU/Linux systems, Windows, or possibly other systems (but on Windows, chunkymap-regen.py must be scheduled by hand with Scheduled Tasks)
Compatible with GNU/Linux systems, Windows, or possibly other systems (but on Windows, generator.py must be scheduled by hand with Scheduled Tasks)
License: (see LICENSE in notepad or your favorite text editor)
This program comes without any warranty, to the extent permitted by applicable law.
## Features:
* Runs as python script (loop by default to reduce disc reads since stores certain info) run like:
python chunkymap-regen.py
or to get back to it later with screen -r, instead install screen command (or tmux may work) then run:
* Fast HTML Canvas map with only players who moved recently
* No mods are required--Uses Python and PHP (generator.py detects border chunks by setting a flag color as the bgcolor; distinguishes empty chunks from locked database [retries if locked])
* generator.py can loop forever (to keeps certain runtime data to reduce drive reads & writes):
```
sudo python generator.py
#or run as user that has read & write priveleges to $HOME/chunkymap and your website's minetest folder (or website root if installing chunkymap.php there)
#or to get back to it later with screen -r, instead install screen command (or tmux may work) then run:
#where -t chunkymapregen just names the screen chunkymapregen
#Then if you are using screen and want to leave the output without terminating the process press Ctrl a d
#NOTE: now that loop is default, cron job scripts, which now disable loop for compatibility with new version, are ALL optional and NOT recommended
# ( to run only once, run: python chunkymap-regen.py --no-loop true )
* Change program options (or stop it) while looping or rendering by placing signals.txt in the same directory as chunkymap-regen.py (see signals example files)
# ( to run only once, run: python generator.py --no-loop true )
```
* Save jpg or png named as player's index to the players folder of the world to change player's icon on map (index is a number assigned for use with ajax when $show_player_names_enable is false). The index can be found in the player's yml file generated by generator.py.
* Other programs (or echo command) can send signals to generator.py via signals.txt in same folder (which will be deleted after read, so must be created by same user/group)
* to maintain stability of your text editor, save the file, close it, then move/copy it to the directory (or save it as something else then rename it to signals.txt).
* alternatively, in GNU/Linux systems do something like:
REM cd to the minetest-chunkymap or minetest-chunkymap-master folder you unzipped
echo refresh_map_enable:False > signals.txt
echo loop_enable:False > signals.txt
```
* list of signals:
```
@ -42,20 +53,17 @@ refresh_map_seconds:1
#where 1 is number of seconds:
refresh_players_seconds:1
```
* Save jpg or png named as player's index to the players folder of the world to change player's icon on map (index is a number assigned for use with ajax when $show_player_names_enable is false). The index can be found in the player's yml file generated by chunkymap-regen.py.
* Can show a static html version of map (echo_chunkymap_table() php function) -- see viewchunkymap.php
* Zoom in and out
* optionally echo name of world that was detected by the scheduled py file
* shows player location (can optionally show only first characters of name, for privacy; there is no saved setting yet, so to adjust, you must change the value of $nonprivate_name_beginning_char_count in chunkymap.php)
* Ghost players if they stay in one spot long enough (see $player_file_age_idle_max_seconds in chunkymap.php)
* Hide players if they stay in one spot long enough (see $player_file_age_expired_max_seconds in chunkymap.php) avoiding logout detection, and not requiring mods
* Has optional script to add crontab entry (to schedule update script every minute that runs the py file unless the py file is not complete [took longer than 1 minute])
## Changes
* (2016-03-22) Detect exceptions in mintestmapper (such as database locked) and do NOT mark the chunk as is_empty
* optionally hide player location
* (2016-03-22) Make a method (in chunkymap.php) to echo the map as an html5 canvas
## Developer Notes:
* Player username privacy: check_players in chunkymap-regen.py intentionally makes up an index and uses that as the filename on the destination, so that ajax can update players without knowing either their id (filename of minetest player file) or display name (listed in the player file)
* Player username privacy: check_players in generator.py intentionally makes up an index and uses that as the filename on the destination, so that ajax can update players without knowing either their id (filename of minetest player file) or display name (listed in the player file)
(this way, only usernames can be known if chunkymap.php allows that, or the person is logged in to the server)
Because of the feature, chunkymap-regen.py must prevent duplicates based on value of id in the resulting yml files (minetest player filename as id).
Because of the feature, generator.py must prevent duplicates based on value of id in the resulting yml files (minetest player filename as id).
This should be hard to corrupt since id is used as the indexer for the players dict (however, extra files with no matching entry in the dict will still need to be deleted if they exist)
* games_path, mods_path, players_path, and other subdirectories of the major ones should not be stored in minetestmeta.yml, since otherwise the values may deviate from the parent directories when the parent directories change.
To avoid this problem, instead derive the paths from the parent paths using your favorite language such as in the following examples:
@ -81,11 +89,21 @@ user_minetest_path
world_name
world_path
```
* Installing as cron job is OPTIONAL (and NOT recommended):
(schedules update script every minute that runs the py file unless the py file is not complete [may take longer than 1 minute so
requires GNU flock])
* IF you are using a distro such as Ubuntu 14.04 where first line of /etc/crontab is "m h dom mon dow user command" then if you want regular refresh of map then run:
(otherwise first edit the script to fit your crontab then)
(if you are not using /var/www/html/minetest/chunkymapdata, edit chunkymap-cronjob script to use the correct directory, then)
* A minetest version compatible with minetestmapper-numpy.py Made by Jogge, modified by celeron55
* A minetest version compatible with minetestmapper-numpy.py Made by Jogge, modified by celeron55, new LevelDB features fixed by expertmm
* Python 2.7 (any 2.7.x)
* Other requirements for Windows are below; other requirements for GNU/Linux are flock command (only if you schedule the chunkymap-cronjob script), and anything installed by install-chunkymap-on-ubuntu.sh (for other distros, modify it and send me a copy as a GitHub issue as described below in the Installation section)
* Other requirements for Windows are below; Requirements for GNU/Linux are anything installed by install-chunkymap-on-ubuntu.sh (for other distros, modify it and send me a copy as a GitHub issue as described below in the Installation section)
## Installation
(NOTE: map refresh skips existing tiles unless you delete the related png and text files in your chunkymapdata directory)
@ -129,13 +147,6 @@ minetestserver
then when it is finished loading, press Ctrl C then run:
Installing as cron job is OPTIONAL (and NOT recommended):
* IF you are using a distro such as Ubuntu 14.04 where first line of /etc/crontab is "m h dom mon dow user command" then if you want regular refresh of map then run:
(otherwise first edit the script to fit your crontab then)
(if you are not using /var/www/html/minetest/chunkymapdata, edit chunkymap-cronjob script to use the correct directory, then)
* Rename viewchunkymap.php so it won't be overwritten on update if you want to modify it (or anything you want) then make a link to it on your website or share the link some other way.
(all the batch does is run C:\Python27\python chunkymap-regen.py)
(chunkymap-regen.py will ask for configuration options on first run and ask for your www root)
(all the batch does is run C:\Python27\python generator.py)
(generator.py will ask for configuration options on first run and ask for your www root)
## Known Issues
* webapp: save selected world to a config file (click world on first visit to write initial config) instead of being silently autoselected
* Fix chunk generation and draw decachunks to canvas (so singleimage.py is not required to be run before chunkymap-regen.py)
* Detect exceptions in mintestmapper (such as database locked) and do NOT mark the chunk as is_empty
* Move the following to config dict:
* Fix chunk generation and draw decachunks to canvas (so singleimage.py is not required to be run before generator.py)
* Make pythoninfo have a pythonmeta.yml (currently the following is detected by running executable):
```
python_exe_path
```
* chunkymap.php should read the size of the chunks -- see near is_file($chunk_genresult_path) in chunkymap.php
* optionally hide player location
* Make a method (in chunkymap.php) to echo the map as an html5 canvas (refresh players every 10 seconds, check for new map chunks every minute)
* Add AJAX to update players on canvas (refresh players every 10 seconds)
* Add AJAX to update chunks on canvas (check for new map chunks every minute)
* Fix static html version of map (echo_chunkymap_table() php function) -- see viewchunkymap.php
* Zoom in and out
* optionally echo name of world that was detected by the scheduled py file
* shows player location (can optionally show only first characters of name, for privacy; there is no saved setting yet, so to adjust, you must change the value of $nonprivate_name_beginning_char_count in chunkymap.php)
* Ghost players if they stay in one spot long enough (see $player_file_age_idle_max_seconds in chunkymap.php)
* Hide players if they stay in one spot long enough (see $player_file_age_expired_max_seconds in chunkymap.php) avoiding logout detection, and not requiring mods
## Optional:
* chunkymap.php should read the size of the tiles automatically (currently is hard-coded)-- see near is_file($chunk_genresult_path) in chunkymap.php