Doodad Namespace Ideas #45
Labels
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: SketchyMaze/doodle#45
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently Doodads are namespaced by their file name, like "door-red.doodad" or "boy.doodad"
Levels refer to actors by their filename, and custom user doodads take priority over built-in doodads of the same name.
When the emphasis on custom user content in this game, namespacing should be handled in a more robust way to minimize conflict not only between built-in and user doodads but also between user doodads made by different authors.
Mechanism
An
ID
property can be added to the Doodad JSON format. A default (random) ID can be generated when a new doodad is created in-game, with a UI for the player to enter a custom ID value.The doodad CLI tool can set an ID value when creating/converting doodads, for the built-ins.
Level data would name an actor by its ID instead of its filename.
Concern: for the game to know where each doodad is it may need to load every doodad JSON to parse their ID strings out.
Naming Convention Ideas
The ID strings will ultimately be arbitrary values but some ideas for recommended guidelines could be:
com.sketchymaze.Door.Red
namespace.doodad
likebuiltin.Door.Red
orbuiltin.Trapdoor.Down
Built-in doodads would be named with a prefix like
builtin.
orcore.
orcom.sketchymaze.
and third-party user doodads would be encouraged to choose a good and distinct namespace (Java-style is best).Prioritization/Overrides
The built-in doodads should have a higher priority against being overridden by user doodads as they currently are.
The search order for doodads should be:
Backfill/Migration
The set of built-in doodads is known. When a new namespace scheme is rolled out, the game engine will translate between the old (legacy) names and the new names, e.g. "door-red.doodad" is translated to "com.sketchymaze.Door.Red" or whatever the naming convention is.
Existing maps created by older versions of the game will be readable with this translation layer. New maps saved by new versions of the game will use the new names for all doodads. Old maps can be "upgraded" by just opening and re-saving them with the newer game version.