The Spatials: Galactology update for 2016-06-06

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

TL;DR: new tutorial system and preliminary tutorials for the station, the galaxy and planet exploration; unveiling The Spatials: Galactology, flood fill system, storage areas.

After nine months of development we've finally announced how we are going to release V3: it's now a new game called The Spatials: Galactology. You can check our announcement for more details and the trailer in youtube.

- Shell tag2 utilities for registering, checking and clearing clicks to nodes with certain tag2
- tutorial mod
    new core mod
    bring up with a non-modal tool
        simple listing of steps with the body gui content
        pre, done?, post procs for each step
        optional next button
        organize pages into chapters, with a title and id
        a tutorial is a list of chapters
        menu button goes back to chapter menu
- proper way for done? checks
    introduce gui-timer: content-less 0x0 node that calls its non-gui callback every :duration
    since it's a node it will be deleted automatically on next page
- fix button and toolbar drag click prio for windows
    set windows to swallow events at -9
    :mouse-priority (ShellWindowMousePrio) for controls (which is -10)
        new args for button group widgets
        make sure it is also set for GUIListing
- proto station tutorial
        how to move and zoom
        sidebar tools
        info tool
            click on anything on map to continue
    floor tool
        select corridor if not selected
        put marks on map
        draw a line between them
        wait for it to be built
        repeat for any room
    object tool
        select food dispenser
        build one
        wait for it to be built
        repeat for a table
        (make sure cooking is on for all)
        select kitchen
        select veggie ration recipe
        talk about resources
        wait for first produced ration
        build dispenser
        set resource to ration
- planet tutorial
    add support for mandatory resources
    add fixed tutorial planet
    extraction chapter
        initial game flag
        if planet is not tutorial planet, button displays alert
- galaxy tutorial
    add tag2 to systems (only for home), planets
    add tag2 to ship avatar
        which one?
    may need two highlights (ship plus planet) for the drag and drop
    structure and movement

There's a new tutorial system, implemented from scratch as an independent core game mod:


Unlike the V2 tutorial, this new system is based monitoring all interaction of the user both with the GUI and the game world. This allows for detection of construction, production, or any other gameplay effect. This will enable much better tutorials.

Initial tutorials were also implemented for the station, the galaxy and planets. Only the station tutorial is in a relatively advanced state, with the other two only covering the basics to form a working resource chain.

- introduce flood fill comp/system
    keep cached in a component the extents of a room, as defined by any reachable same-floor
    same-floor: as the same floor under the object
    reachable: using a flood fill
        use fast C++ proc
        add a max size
    building cursor paints and forces 1:1 update on move
    info selection paints
- flood fill visuals
    line segments around limit
    add vis toggle to component and/or smart toggle for edit and selection
    some color+alpha over the tiles

Galactology now supports flood fill areas:

Flood fill in action

It's a staple of many sim games to define areas with some kind of brush, for many gameplay reasons. I was avoiding this sort of functionality since it seemed very complicated for our game, given that the floor tool was already doing the same thing. So it dawned on me, why not allow common floors and rooms to serve such a function? Thus the flood fill system was born. Any object with FloodFillComponent (it's done in C++) will keep an updated set of tile coordinates that are adjacent to it and that share the same floor kind, up to the limits of the room.

It's now possible to build new systems on top of this foundation. And the first one is storage areas:

- storage area
    central object looks for valid haulable resources
    when found publishes a hauling job
    when has a worker and has either valid stack or empty tile (incl free of a job), creates a proxy job on the tile
        and swaps the worker job to the proxy
    proxy finishes the hauling and destroys itself
    allow resource filtering but no stock control
- in-storage-area system: also check for filter, remove when not desired
- info panel for storage area
    preserve scroll --> finally implement callback for preserving scroll position, long overdue
    fix some instances of scroll position being lost due to layout/render hook/etc calling setContentSize

Storage area

Galactology will now support two kinds of storage: stock controlled storage has been implemented for months and it allows for very precise orders. You can pick one single resource and then give a max and min amount to keep on stock, and select options for what are its valid sources (and this may be made more complicated in the future, allowing to pinpoint a single object as the source). Many objects keep its internal stock controlled using this system.

But, what happens when a ship unloads a large amount of varied cargo in your station? It can be very cumbersome to micromanage a pallet object for each kind of resource. Enter storage areas. A storage controller uses the flood fill system to declare a room as valid for storage. It also allows to select the subset of resources allowed in the room, so you can have diferent areas for different resources. It has not stock control, which will still a feature that requires pallets. This system is much more similar to how storage works in other sims, compared to stock control pallets.