Extending a game
How far you can go depends on what the root opened. Starter World opens nearly everything, so a child of it can be a small tweak or a different game.
Change a rule. One line changes how the parent's game plays.
Variations.set_rule("player.speed", 12.0)
Add a rule of your own. Where the root opened rules.*, a new name is
yours to set. Games built on yours can read it, and change it unless you seal
it.
Add to the world. Register a zone and the root builds it beside its own. Register an item and any layer can place it.
Replace part of the world. Register a zone, an item or a slot under a name
that already exists and yours is used instead. Ringroad Rally replaces Starter
World's meadow zone with a track and its player slot with a kart:
Variations.register_zone("meadow", _track)
Variations.fill_slot("player", func() -> Node3D: return Kart.new())
Place any item. Variations.make_item("coin") gives you one of whatever
the game currently calls a coin, even if another layer replaced it.
Hook into what happens. Listen for events and act on them. Starter World
sends player.physics every step before the player moves, and Sky Islands
uses it to add gliding without replacing the player:
func _on_event(event_name: String, payload: Dictionary) -> void:
if event_name == "player.physics" and payload.jump_held:
payload.player.velocity.y = maxf(payload.player.velocity.y, -1.8)
Send events. Send one the parent understands, such as hud.message to show
a line of text, or invent your own for games built on yours.
Reuse the parent's code. Every layer below you is loaded before yours, so
you can preload its scripts. Sky Islands builds its islands with Starter
World's shape kit:
const Kit := preload("res://layers/starter-world/kit.gd")
Bring your own nodes. Inside what you build, all of Godot's nodes are yours: 2D and 3D, physics, lights, shaders, cameras, controls, input, timers and tweens.
Set terms for your own children. Add points to seal and no game built on
yours can change them.
Starter World's hooks
| Kind | Name | Notes |
|---|---|---|
| Rule | player.speed, player.jump_height, player.double_jump | Movement |
| Rule | world.gravity | Sealed |
| Rule | world.fall_limit, sky.time | The floor you respawn below, and the hour from 0 to 24 |
| Zone | meadow | The island, trees, lamps and ten coins |
| Item | coin | Joins the group coin. Sends collected with {"item": "coin"} when touched |
| Slot | player | Must return a Node3D. Starter World gives it a lamp and a HUD |
| Event | start | Sent by the runtime. Starter World builds the world |
| Event | world.ready | {world, player}, after the world is built |
| Event | player.physics | {player, delta, jump_held}, every physics step before the player moves |
| Event | player.jumped, player.fell | {player, count} and {player} |
| Event | collected | {item}. Starter World counts coins |
| Event | hud.message | {text}. Starter World shows it for four seconds |
How far it goes
The demo games show the range. Keeper's Vault replaces nothing and adds a story, an inventory and a vault. Neon Drift replaces the world, the player and the coins and is a top-down racer.