Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / ocmapgen
- - By Luchs Date 2017-04-10 21:48 Edited 2017-04-13 17:00
ocmapgen is a command-line tool for rendering dynamic maps (Landscape.txt/Map.c) - basically mape without a GUI. It started out as an experiment with Rust FFI, but now has a few features mape doesn't implement:

- It generates default SCENPAR constants from ParameterDefs.txt
- It loads the top-level System.ocg (but not scenario-level ones, those usually depend on definitions)
- It implements GetStartupPlayerCount() and GetStartupTeamCount()
- It can also export the map background
- It can export as indexed .bmp which can be used as static landscape

With these features, it can now render almost all dynamic maps in the repository (see attached images). Those failing use variables or functions defined in the scenario script.

It's possible to use ocmapgen as a mape replacement:

0. Get binaries from https://github.com/lluchs/ocmapgen/releases (or compile yourself if you're into that)
1. Open Map.c/Landscape.txt in your favorite editor (there's syntax highlighting for Vim!)
2. Run ocmapgen --watch path/to/Map.c Map.png (optionally set a fixed seed with --seed and startup player count with --players)
3. Open Map.png in your favorite image viewer (ideally one that reloads images automatically).
4. Edit, save, view changes, repeat

Some (most?) developers will want a more integrated experience like mape, I guess. The most promising project for this is currently nanoMill. I implemented a small node.js client library to make integration there easy. As a small demo, I also built a web interface. Unfortunately, the cheap VM it's running on is probably too slow to actually use this.

So yeah, try it out (ideally locally) and report issues you find or features you always missed from mape.

My wishlist:
- The engine's script interface doesn't have proper error reporting. mape and ocmapgen have to capture all log messages and fail if anything gets printed. ocmapgen at least filters and ignores warnings, but this isn't ideal.
- Setting scenario parameters on the command line would be nice. (this isn't hard, I just didn't implement it yet)
Parent - - By Apfelclonk Date 2017-04-11 11:19
=3

I'm already excited to see it in nanoMill. I'm planning to have a period to put in more features into nanoMill and options, after I've reached a point where the basements feel ok, very soon. Atleast something like the WebClient you built could make it in nanoMill while that period. Since I don't know Mape very much, does it offer any superior functionality that one would miss very soon, when only operating on a texteditor + preview setup? I'd love to a have a flow-graph interface (that could probably be used in usual script too) but that's very much in the future and doesn't come up with any crucuial benefits for now.
A cool option might be to print only specific parts of the script to see how different slices evolve and then fit together. That would be in a flow graph pretty cool...
Reply
Parent - By Luchs Date 2017-04-11 13:41

>Since I don't know Mape very much, does it offer any superior functionality that one would miss very soon, when only operating on a texteditor + preview setup?


Mape features a panel showing all materials and textures. Making this information available to the node.js API is possible if there's demand for this. Other than that, there should probably be a settings dialog for setting a fixed seed and other options.

>A cool option might be to print only specific parts of the script to see how different slices evolve and then fit together. That would be in a flow graph pretty cool...


Interesting idea. I think this is possible by setting a fixed seed and then rendering the map multiple times while changing the script so that some operations don't write to the map. On the other hand, exporting the map after each change is probably way faster. I'm going to look into this.
Parent - By Clonkonaut [de] Date 2017-04-11 12:23
Cool!
Reply
Parent - - By Isilkor Date 2017-04-12 08:39

> - The engine's script interface doesn't have proper error reporting. mape and ocmapgen have to capture all log messages and fail if anything gets printed. ocmapgen at least filters and ignores warnings, but this isn't ideal.


You can use C4AulScriptEngine::RegisterErrorHandler instead of replacing Log().
Reply
Parent - By Maikel Date 2017-04-13 18:14 Edited 2017-04-13 18:29
Works very well, feature request: --bg for background maps.
Up Topic Development / Developer's Corner / ocmapgen

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill