Object Editor 4.0.0
What's Changed
As per semantic versioning rules, a breaking change requires a new major release, and so here we are with the big 4.0.0! There are a couple of big features in this version:
Updated object service
I've been putting off some updates to the object service for a while, and here they are. The end user won't really notice anything, but there are few new things:
- New routes
/v1/objects/getobjectimages
will return a zip file of decoded images for the object you asked for. Handy for websites so they don't have to write a client-side image decoding library!/v1/scenarios/list
- the start of the scenario service. For now it just lists the vanilla scenarios I placed in the folder, but in the future this will be fleshed out into a usable way to download scenarios and scenario packs.
- API versioning - an experiment to see if adding versions helps to reduce downtime to service consumers, which are going to be websites built off the service. If I change the service, I don't want to immediately break all the websites, so adding in versions is a way for downstream consumers to update at their leisure. Maybe this is overkill for a hobby project, but it feels like the right thing to work towards.
- Preliminary support for all locomotion files and for object packs and scenario packs. Whilst not exposed to the client, the backend side (database schema, server code, etc) are all in place to allow grouping of objects and scenarios into packs that the user can create and distribute. The only limiting thing here is actually the editor - I haven't added code to let users create these packs! I also haven't let users edit any of the existing metadata (eg author, tags, license, etc) but this is nearing completion and will be available soon!
DAT encoding
Prior to this, the editor would only save dat/g1 files in uncompressed format. This wasn't really an issue, but it does bloat the file size if the object contains a lot of easily-compressible graphics data. With this release, I've implemented the methods to encode the G1/graphics table, as well as all the DAT encoding methods (RunLengthSingle, RunLengthMulti and Rotate). This means you can now save objects in the exact same format as they originally came in!
This feature itself isn't that big, but as part of this work I added a lot of unit tests and fixed all the existing unit tests for loading and saving objects, and there were a lot of bugs, so many such that I'm surprised openloco even loaded some of the objects the editor made. One example is the 2nd last image in G1.dat just failing to save at all. But having fixed all these, I'm now much more confident in the correctness of the editor, and all that remains in this department is to add proper testing to the UI-to-DAT conversion code.
- Support for all encoding methods, by @LeftofZen in #152
Tabbed document view
Previously the editor only let you view one object at a time. Viewing a new object closed the old view. No more! Now you can view as many objects at once as you like view the tabbed browser.
- Add tabbed viewmodel to browse multiple files by @LeftofZen in #154
Indexing optimisation
One big feature I want to add is the ability to properly search all fields of all objects. However this requires all those fields being loaded in memory, in a database, or similar; just anything other than encoded in DAT format, which is unsearchable. However to decode all of those objects takes a long time currently, and whilst there is plenty of optimisation to go still, I've done another round and you should now see indexing of all 31k custom objects take around 10 seconds (at least on my 5 year old computer!), which is considerably faster than the previous version. These speed increases work towards making it feasible to decode the entire object, for all objects, in a reasonable time.
There were also some bugfixes here to prevent obnoxious re-indexing when starting up the editor if you had faulty/bad objects in your objData folder. Previously a single bad object would trigger a re-index of everything, which just wasn't necessary.
- Index optimisation, by @LeftofZen in 1caa38d
Misc
- Added a very basic Tutorial viewmodel that simply loads the file and groups the data by my best guess at the 'command' the tutorial wants to perform, by @LeftofZen in #153
- Fixed a bug that meant savegames loaded but scenarios did not load. Now, you can load both!
- Update the codebase to .NET 9, by @LeftofZen in #158
- Backend work to allow proper searching for objects by arbitrary properties (eg DesignedYear, Author, etc)
- Updated some of the dat object type icons, by @LeftofZen in 5b5ca6e
- Multiple bug fixes to loading/displaying scenarios, by @LeftofZen in 99fb2b5, d6bbdf3, 0636126. You should now be able to view all scenarios, even if just partially, and they shouldn't crash the editor either.
Full Changelog: 3.10.1...4.0.0