Exporting the executable
A few things this week, as development velocity finally dropped.
Exporting the executable
Yeah, that's a category by itself. So far I've been working purely through the editor. File paths work a bit differently in the exported executable, since all assets are stored in a virtual filesystem in a .pck file. This required a bit of refactoring, as besides just reading files I also write a lot of them. I also finally got around to use the Godot's "user://" folder which is basically the application user data, ideal for caches and savegame data. But now here's where it gets tricky: the C++ plugin also needs to read some .json files, because it partially mirrors the json database configuration, but it does not have access to the pck filesystem. Oops! So, the solution currently is to create an export plugin addon that manually copies the required json files somewhere in the exported executable folder tree.
All ended well, as the exported executable runs and can be debugged. Apparently there's an option to disable ImGui in the exported executable as well, so that's quite convenient, for not providing access to debug menus and things like that.
Another bit of work related to all this was cross-compiling for Windows. As I don't have a personal windows PC anymore, and I need to build an executable for the vast majority of people, well, I need a solution. My C++ codebase that contains the plugin is a CMake project, and CMake does support cross-compiling, so I did use that. After a bit of unjoyful CMake fiddling, eventually I got a .dll out of it, and also managed to integrate the different "CMake profiles" (windows debug and windows release) in the CLion IDE.
The final bit of work for a full Windows export is to export the Godot project to Windows platform. Besides some small confusion where a missing icon caused a greyed-out export button, that was straightforward to do in the editor.
And the final test: run it on Windows.
Other stuff
- Worldforge functionality split into tabs. The UI was getting busier and busier, so I've split it into 4 tabs: Biome, where you can make changes to the biome, Routes, where you can add, remove, clear and auto-calculate routes, City, where you can add/remove cities and properties, and Export, where you can set some export options and ... well, export the map into one of several forms.
- Playable worldforge worlds. A bit of work to make the worlds generated by world forge playable in the game. This is not something anyone will see anytime soon, but it makes sense to fix this at this stage. For example you can manually place 10 cities and ask for the game to generate 200 more.
That's all for now, have a nice weekend!
