* The level.FileSystem type has updated to support ZIP files too.
* Legacy levels loaded from gz/json have their old FileSystem as a
simple map[filename]data and this parses from JSON OK.
* On save to zip, the legacy loaded file data gets exported to ZIP.
* Going forward: newly added or deleted files during runtime are kept in
the legacy file map until the next save when the filemap is again
flushed out to ZIP.
* For regular read-access, the FileSystem reads from the ZIP file if the
data is not in the hot map (legacy file or recently modified
attachment).
* Bugfix: be sure to Inflate() the Level/Doodad after loading from
zipfile - it used to be that directly after a save, trying to play the
level failed because the Level.Actors struct was missing their IDs,
and similarly recently written chunks would error out (become black
voids) on levels/doodads so we Inflate() both after save/replacing
their zip handle.
Especially to further optimize memory for large levels, Levels and
Doodads can now read and write to a ZIP file format on disk with
chunks in external files within the zip.
Existing doodads and levels can still load as normal, and will be
converted into ZIP files on the next save:
* The Chunker.ChunkMap which used to hold ALL chunks in the main json/gz
file, now becomes the cache of "hot chunks" loaded from ZIP. If there is
a ZIP file, chunks not accessed recently are flushed from the ChunkMap
to save on memory.
* During save, the ChunkMap is flushed to ZIP along with any non-loaded
chunks from a previous zipfile. So legacy levels "just work" when
saving, and levels loaded FROM Zip will manage their ChunkMap hot
memory more carefully.
Memory savings observed on "Azulian Tag - Forest.level":
* Before: 1716 MB was loaded from the old level format into RAM along
with a slow load screen.
* After: only 243 MB memory was used by the game and it loaded with
a VERY FAST load screen.
Updates to the F3 Debug Overlay:
* "Chunks: 20 in 45 out 20 cached" shows the count of chunks inside the
viewport (having bitmaps and textures loaded) vs. chunks outside which
have their textures freed (but data kept), and the number of chunks
currently hot cached in the ChunkMap.
The `doodad` tool has new commands to "touch" your existing levels
and doodads, to upgrade them to the new format (or you can simply
open and re-save them in-game):
doodad edit-level --touch ./example.level
doodad edit-doodad --touch ./example.doodad
The output from that and `doodad show` should say "File format: zipfile"
in the headers section.
To do:
* File attachments should also go in as ZIP files, e.g. wallpapers
* Added to the F3 Debug Overlay is a "Texture:" label that counts the number
of textures currently loaded by the (SDL2) render engine.
* Added Teardown() functions to Level, Doodad and the Chunker they both use
to free up SDL2 textures for all their cached graphics.
* The Canvas.Destroy() function now cleans up all textures that the Canvas
is responsible for: calling the Teardown() of the Level or Doodad, calling
Destroy() on all level actors, and cleaning up Wallpaper textures.
* The Destroy() method of the game's various Scenes will properly Destroy()
their canvases to clean up when transitioning to another scene. The
MainScene, MenuScene, EditorScene and PlayScene.
* Fix the sprites package to actually cache the ui.Image widgets. The game
has very few sprites so no need to free them just yet.
Some tricky places that were leaking textures have been cleaned up:
* Canvas.InstallActors() destroys the canvases of existing actors before it
reinitializes the list and installs the replacements.
* The DraggableActor when the user is dragging an actor around their level
cleans up the blueprint masked drag/drop actor before nulling it out.
Misc changes:
* The player character cheats during Play Mode will immediately swap out the
player character on the current level.
* Properly call the Close() function instead of Hide() to dismiss popup
windows. The Close() function itself calls Hide() but also triggers
WindowClose event handlers. The Doodad Dropper subscribes to its close
event to free textures for all its doodad canvases.
New features:
* Flood Tool for the editor. It replaces pixels of one color with another,
contiguously. Has limits on how far from the original pixel it will color,
to avoid infinite loops in case the user clicked on wide open void. The
limit when clicking an existing color is 1200px or only a 600px limit if
clicking into the void.
* Cheat code: 'master key' to play locked Story Mode levels.
Level GameRules feature added:
* A new tab in the Level Properties dialog
* Difficulty has been moved to this tab
* Survival Mode: for silver high score, longest time alive is better than
fastest time, for Azulian Tag maps. Gold high score is still based on
fastest time - find the hidden level exit without dying!
Tweaks to the Azulians' jump heights:
* Blue Azulian: 12 -> 14
* Red Azulian: 14 -> 18
* White Azulian: 16 -> 20
Bugs fixed:
* When editing your Palette to rename a color or add a new color, it wasn't
possible to draw with that color until the editor was completely unloaded
and reloaded; this is now fixed.
* Minor bugfix in Difficulty.String() for Peaceful (-1) difficulty to avoid
a negative array index.
* Try and prevent user giving the same name to multiple swatches on their
palette. Replacing the whole palette can let duplication through still.
Added a new level property: Difficulty
* An enum ranging from -1, 0, 1 (Peaceful, Normal, Hard)
* Default difficulty is Normal; pre-existing levels are Normal by
default per the zero value.
Doodad scripts can read the difficulty via the new global variable
`Level.Difficulty` and some doodads have been updated:
* Azulians: on Peaceful they ignore all player characters, and on Hard
they are in "hunt mode": infinite aggro radius and they're aggressive
to all characters.
* Bird: on Peaceful they will not dive and attack any player character.
Other spit and polish:
* New Level/Level Properties UI reworked into a magicform.
* New "PromptPre(question, answer, func)" function for prompting the
user with the developer shell, but pre-filling in an answer for them
to either post or edit.
* magicform has a PromptUser field option for simple Text/Int fields
which present as buttons, so magicform can prompt and update the
variable itself.
* Don't show the _autosave.doodad in the Doodad Dropper window.
* magicform is a helper package that may eventually be part of the go/ui
library, for easily creating structured form layouts.
* The Level Publisher UI is the first to utilize magicform.
Refactor how level publishing works:
* Level data now stores SaveDoodads and SaveBuiltins (bools) and when
the level editor saves the file, it will attach custom and/or builtin
doodads just before save.
* Move the menu item from the File menu to Level->Publish
* The Publisher UI just shows the checkboxes to toggle the level
settings and a convenient Save button along with descriptive text.
* Free versions get the "Register" window popping up if they click the
Save Now button from within the publisher window.
Note: free versions can still toggle the booleans on/off but their game
will not attach any new doodads on save.
* Free games which open a level w/ embedded doodads will get a pop-up
warning that the doodads aren't available.
* If they DON'T turn off the SaveDoodads option, they can still edit and
save the level and keep the existing doodads attached.
* If they UNCHECK the option and save, all attached doodads are removed
from the level.
* Clean up unused msgpack code for levels and doodads
* Fix the cosmetic bug where actors in your level would display wrongly
when scrolling off the top/left edges of the screen: they used to
anchor at their own 0,0 coordinate and crop their width/height leading
to a 'scrolling' effect that didn't happen on the right/bottom edges.
* The `doodad` CLI tool got a lot of new commands:
* `doodad show` to verbosely print details about Levels and Doodads.
* `edit-level` and `edit-doodad` to update details about Levels and
Doodads, such as their Title, Author, page type and size, etc.
* Doodads gain a `Hidden bool` that hides them from the palette in
Editor Mode. The player character (Blue Azulian) is Hidden.
* Add some boolProps to the balance/ package and made a dynamic system
to easily configure these with the in-game dev console.
* Command: `boolProp list` returns available balance.boolProps
* `boolProp <name>` returns the current value.
* `boolProp <name> <true or false>` sets the value.
* The new boolProps are:
* showAllDoodads: enable Hidden doodads on the palette UI (NOTE:
reload the editor to take effect)
* writeLockOverride: edit files that are write locked anyway
* prettyJSON: pretty-format the JSON files saved by the game.
* Add new pkg/drawtool with utilities to abstract away drawing actions
into Strokes and track undo/redo History for them.
* The freehand Pencil tool in EditorMode has been refactored to create a
Stroke of Shape=Freehand and queue up its world pixels there instead
of directly modifying the level chunker in real time. When the mouse
button is released, the freehand Stroke is committed to the level
chunker and added to the UndoHistory.
* UndoHistory is (temporarily) stored with the level.Level so it can
survive trips to PlayScene and back, but is not stored as JSON on
disk.
* Ctrl-Z and Ctrl-Y in EditorMode for undo and redo, respectively.
* Add some encoding/decoding functions for binary msgpack format for
levels and doodads. Currently it writes msgpack files that can be
decoded and printed by Python (mp2json.py) but it can't re-read from
the binary format. For now, levels will continue to write in JSON
format.
* Add filesystem abstraction functions to the balance/ package to search
multiple paths to find Levels and Doodads, to make way for
system-level doodads.