Platform courses
Build 3D platformer courses of floating islands with parcels, checkpoints, a delivery goal, hub doors, lives and medals: platform_courses documents, settings, events, hooks.
Floating platform courses in your game (world.platforms) #
What it is for #
world.platforms lays out a platformer course of floating islands: collectible parcels, optional stamps, checkpoints, a delivery goal judged with medals, and a hub whose doors open levels once a counter is reached. It also supports lives, deaths caused by other kits, and surfaces other kits add (falling platforms, pads). Colliders and progress never depend on the art bound to its slots. The character itself comes from other kits.
Turn it on #
gripforge_gamekit_install { project_id: "gkp_…", id: "world.platforms" }
gripforge_gamekit_configure { project_id: "gkp_…", id: "world.platforms",
config: { "courseId": "sky_courier", "lives": 3, "fallY": -12 } }
It requires physics.rigidbody, physics.port and game.engine. It is meant to run with the platformer character and action input kits. A project without courses plays the shipped Sky Courier campaign (three courses).
First example #
<!-- test: kits/game_engine/host/tests/world_platforms.rs::a_project_without_courses_plays_the_sky_courier_campaign --> Call the service in a project without course documents:
{ "op": "call", "service": "world.platforms", "method": "start", "args": ["mist_lighthouse"] }
course answers the sky_courier document at first, courses lists three, lives answers -1 (lives not counted). After start("mist_lighthouse") the variable course.index is 2 and course.total is 12 parcels.
Settings and defaults #
| Setting | Type | Default | Meaning |
|---|---|---|---|
courseId | string | sky_courier | Course played at the start (the first when unknown). |
pickup | object | radius 1, height 1.3, offset 0.65 | Reach of a parcel or stamp, metres. |
checkpoint | object | radius 2, height 0.3, lift 0.06 | Landing tolerance and respawn lift. |
goal | object | radius 1.8, height 0.35 | Delivery zone. |
fallY | number | -9 | Below this height the player returns to the last checkpoint. |
defaultPar | number | 60 | Express medal time of a course without parTime, seconds. |
islandThickness | number | 0.8 | Island collider thickness, metres. |
islandAsset | number | 8 | Authored width of the island asset; instances scale by width over this. |
landmark | object | width 1.3, height 2.6 | Landmark collider footprint. |
lives | integer | 0 | Lives per run when the course gives none; 0 means not counted. |
door | object | radius 1.4, height 1.5 | Reach of a hub door. |
All of these are moddable.
Services, events, variables and data #
world.platforms(service):start(id),next(),reset(),hub()(false when there is no hub),kill(cause)(a death from any kit, counted as a fall and a life),lives(),course(),courses(),collected(),respawnPoint(),needMet(need),setSurface(id, surface),supports().course.started(event): a run started from its spawn.course.pickupandcourse.stamp(events): payload{ id, count }.course.checkpoint(event): payload{ id }; it is now the respawn point.course.respawn(event): back at the checkpoint after a death;causeis absent for a fall.course.finished(event): payload{ seconds, falls }.course.failed(event): the last life was lost.course.doorandcourse.door_locked(events): a hub door started its course, or its need does not hold.course.lives,course.collected,course.total,course.seconds(variables).platform_courses(collection):{ id, name, spawn, goal, platforms, pickups, stamps?, kind?, doors?, goalNeed?, lives?, parTime?, theme? }. Aplatformsentry hasid,at,width(2 to 50) and optionallydepth,checkpoint,landmark(windmillorlighthouse) andtrees(0 to 4).kindishuborlevel. A door hasid,at,course,label?andneed{ var, count }on any numeric variable.
Hooks and modding #
| Hook | Mutable | Asked when |
|---|---|---|
course.collect | none | a parcel or stamp is about to be collected |
course.reach | none | a new checkpoint island is about to become the respawn point |
course.enter | course | a hub door is about to start its course (a tap may send it elsewhere) |
course.deliver | seconds, falls | the course is about to finish (a time bonus, a forgiven fall) |
course.recover | x, y, z | after a death, before the return to the checkpoint |
All are cancellable. A mod can also add platform_courses documents and change the moddable settings.
{ "id": "forgive_falls", "hook": "course.deliver", "priority": 0, "set": { "falls": 0 } }
Engines #
The same rules run on the web and the native Rust player; Godot, Unity and Unreal ship equivalent deliveries. The new hub, lives and surfaces rules (1.5) and the hooks (1.6) are available on the web and Rust runtimes.
When it does not do what you expect #
- A parcel is not collected: the player is outside
pickupreach, or acourse.collecttap cancelled it. - The goal does nothing: not every parcel is collected, or
goalNeeddoes not hold. - A hub door stays shut: its
needdoes not hold;course.door_lockedis emitted once per approach. - The player falls forever:
fallYis below the course.
Limits #
No character controller: use a platformer character kit. A course holds at most 100 platforms, 100 parcels and 32 hub doors.
Versions #
Kit 1.6.2. 1.6.0 added the hooks, 1.5.0 the hub, lives and surfaces, 1.4.0 the attachment to game.engine scenes.