The Spatials V3 devblog 2016-05-02

Internal development notes, very slightly cleaned up and commented a week later.

TL;DR: performance optimizations, cross platform Steam Cloud saves, Steam Workshop support for mods and translations.

For the past two weeks we’ve been very busy with some TOP SECRET internal deadline, having a mini stabilization phase for the game and preparing promotional materials. For this reason I didn’t update the blog last week. Rest assured that much was done, more than 100 individual commits, but it’s all part of the secret deadline. Max was still this past week and this current week very involved with that, but I had less work and so went back to the feature backlog for V3.

- optimize civ matcher with some sort of cache
    use copy for return
    game tick based for discarding
    store in civ object
- optimize world tick
    the baseline cost for bridged systems is too high, because of too many available hooks with an inefficient calling implementation
        lookup based on string, fancy vararg calling system, etc
        -> implement a much faster shortcut with direct s7_call
    proto in BridgedSystem::process
        lookup of scheme symbol and keep in var
        call is direct s7_call, arg list is built without reflection helper
    callPre/Post takes mandatory entry hint
    add cache entry lookup to BridgedVirtuals helper: void* cachePre/Post(int entry)
    now callers can check for hook existence and skip all processing
    if hook exists, they can take slow route or use cached entry for fast direct call, as desired
    effort is being defeated by the AutoReflection not detecting reflection:skip for the cache vectors...
        idea: add "NR" at end of name to skip it...
    add a BridgedSystemFull which can override everything, and keep the existing BridgedSystem only supporting a post-process override
- also do BridgedTool and BridgedDisplaySystem

Some long overdue optimization pass was done this past week. One of the worst culprits was whacked, with the aggressor system doing a linear search over every civ for each range check. This has now been cached per-frame.

The need for the world tick optimization surfaced after testing the game with two dozen ships. It was very clear the baseline cost for running a World instance was too high, even if the World is small and mostly empty. Since most systems are now implemented in Scheme the tick has to call into Scheme code. The bridged implementation of EntitySystem exposes all its virtual methods as overridable by Scheme code. So, for every tick, it was looking up, by string, six Scheme procs. This is useless 99% of the time, since only one method is required to be overrided for virtually all systems. Those checks have been removed, with all systems now using a single virtual call over ::process. And the results have been cached. The speed up has been 5x, and in case it’s needed, there’s still ways to make it faster in the future.

- update steam sdk
- update steam build
- re-enable auto steam cloud with proper root overrides for each platform
    tentative fix for linux to use $XDG_DATA_PATH
- redo steam pipe upload scripts
- check if abs paths are getting into save files
    yes, they are
    try to move all of them to file aliasing
    various tmx references
    references to floor-like objects in a planet landing
        how is this happening?
            the planet-editor is overriding the model for those objects with its autoprobed files

An historic bug from the V2 days has been fixed. V3 now has proper cross-platform Steam Cloud save support. V3 has also been updated to the latest Steamworks SDK.

- steam workshop mods
    prepare scripting bridge to support per-mod paths, instead of the current 2-level auto scanning system
    enable UGC in steamworks
    mod creation tool: new developer section in options
        has dialog to create new mod
            fields for all metadata
            implement submit flow as described in docs
        has listing of all UGC for the game for the current Steam user
        allows to update existing UGC metadata, including re-upload and changing content folder
            no deletion, just change visibility to private, as per docs
    mod selection when creating a new game
        button for opening the workshop in the steam overlay
        list all subscribed, downloaded mods for the current Steam user
        allow to select which ones are enabled for the new game
        be ready for async sub/unsub
- add support for workshop translation mods
    add toggle for the tag in the developer tool
    must appear in lang options listing
    must be available during game load
    add workshop button to lang options
        investigate to open the overlay for a single tag
- refresh language mod panel while displayed

And finally the big item for the week. V3 now has Steam Workshop support for mods. The first part is the mod uploader. This is a new tab in the options screen which allows users to upload new mods and update them:

Mod uploader

After the mod is uploaded, it shows up in the Steamworks page:

Steamworks

Users can then visit Steamworks and subscribe to the mod, which will make it available for enabling when creating a new game:

New game mods

There’s still work to do toward making mod making more approachable, by having examples and documentation done, but most of the pieces are now in place.