After noticing that almost all of the utilities for Gnomoria required the user to exit the game before being able to utilize them, I decided that we needed a better way to do real-time communication between Gnomoria and external processes.
Because I recently worked on a mod for Cities: Skylines to do precisely that, I decided to simply repurpose a lot of the existing code to do a similar thing for Gnomoria.
After spending the better half of this weekend to produce a workable version, I wanted to join this community here and show it off.
This is a modification for Gnomoria (I've only verified its compatibility with the latest in-dev branch) that allows it to expose real-time data to external processes over a standard HTTP connection, and even consume information in the opposite direction
. The underlying framework is pluggable and the entire thing is open-source and on Github. The write-up on the Github repository is substantially more involved, so I would encourage any interested parties to take a peek and let me know what they think.https://github.com/Rychard/GnomeServer
Any and all feedback is appreciated.
Here's some examples of things that I've created using this mod:http://localhost:8081/Gnome
Retrieves a JSON representation of all your Gnomes. Includes loads
Spawns a single Gnomad just as the game does. Additionally, they are automatically assigned the most appropriate profession according to their skills. This process is entirely dynamic and assigns professions based on how you've
configured them in-game. Also returns the JSON representation of the Gnome that was created for further consumption.http://localhost:8081/Gnome/Assign
Automatically re-assigns your Gnomes to the most appropriate profession according to their current skill levels.http://localhost:8081/Military/Assign
Automatically assigns your gnomes to existing Squads. If all existing Squads are full, new Squads are created and filled until all Gnomes have been assigned a Squad.http://localhost:8081/Game?speed=20
Changes the current speed of the game. The parameter given for speed
becomes the multiplier. Currently, the in-game UI only supports Pause, 1x and 2x speeds, but while developing this mod, I routinely play at 20x to produce various scenarios for testing purposes.
To help put this into perspective, here's some images that showcase what I and rest of the modding community for Cities: Skylines were able to achieve with this approach:
Screenshot of the original version: http://i.imgur.com/fFkWVjw.png
A fork of the original project: https://github.com/Feanathiel/CityWebServer
This is exactly the type of thing that would allow the Gnomoria community to create the same type of extensions that are available for Dwarf Fortress: external utilities that run alongside the game that allow you to exercise substantially more control over the world. I hope you guys are as excited about this as I am.