Open adolfintel opened 3 years ago
At the moment the only documentation is the example maps and the comments in https://github.com/Warzone2100/warzone2100/blob/master/src/quickjs_backend.cpp#L2614-L2626
I completely agree that this should be improved (PRs gladly accepted!)
However, if you found ways to crash the game, please open Issues with example scripts attached so we can fix those (if you still have the scripts or remember what you did).
The crashing was caused by the wz file not being properly made, like a missing .gam file, nothing major. I'm more worried about #1646 because it's a game breaking bug if players get put in the wrong location, and I can replicate this consistently.
I'll write some documentation about this in the next few days. Is markdown okay for this?
If it's largely documentation for the handful of APIs available to map scripts, (like gameRand
, log
, setMapData
), then it can be added directly to quickjs_backend.cpp
(see the lines that start with //MAP--
). We can then auto-extract it to a markdown file, like the rest of the JS APIs, as part of the CI / build process.
You can add general info above those functions - again prepended with //MAP--
- and that'll appear first in the auto-generated doc file.
@past-due I was thinking of having something more like a guide. I made a basic template that I use to play around with procedural maps, with functions like setHeightAt, setTextureAt, tileToWorldCoordinates, etc. and I want to use that as a starting point to explain how to make these maps.
If you prefer just some documentation on the APIs, I can do that too, I just need to figure out that auto documentation system.
@adolfintel Ah, yes, for a detailed guide a markdown file would be the best bet. 👍
Let's do the API documentation first, since they're missing, then I'll try to make a guide+template thing.
I've been playing around with the code of 6c-Entropy and was finally able to create my own simple procedurally generated map that wouldn't crash the game. I was wondering if there is some documentation on creating these maps, I kinda feel like I'm reverse engineering the existing maps here to learn what I'm supposed to do.