MegaGlest Forum

MegaGlest => MegaGlest => Topic started by: jammyjamjamman on 11 December 2017, 01:29:51

Title: Python script map loader! (can be used to convert maps to e.g. JSON files)
Post by: jammyjamjamman on 11 December 2017, 01:29:51
==PLEASE SEE TOPIC 10001 (https://forum.megaglest.org/index.php?topic=10001.0) FOR FURTHER UPDATES.==

I wanted to read megaglest maps so I could use them in other things. So, I wrote this *dirty* python script to read a map into a python dictionary. The dictionary is formatted such that it can be easily written to disk as e.g. a JSON file.
Here's a link if anyone else is interested in reading maps in python: https://drive.google.com/file/d/1HogRDgOe3bgFhGIlet48tP0q1CtS0Kkb/view?usp=sharing (https://drive.google.com/file/d/1HogRDgOe3bgFhGIlet48tP0q1CtS0Kkb/view?usp=sharing)

There is example code, commented out, under if __name__ == "__main__":, which demonstrates previewing atze's 6player.mgm map data in matplotlib and saving the map as a JSON object file.

The code is very badly written and has the following problems (in descending order of importance):

I may fix these problems sometime, or feel free to fix them yourself if you want :).