Skip to main content

World

A .world document is a world's definition, like a main scene with its autoloads in Godot. It is the root of what Play runs and, later, of what is deployed. The living world's state is never written here; it stays on the server.

The Design tab is a form:

Section
Worldthe label; the Environment (chosen from the project's environments, kept as its uid); the Scene the world lives in ("Choose…" / "Clear"). An environment or scene that is not in the project is written as a problem.
Startthe year, month, day and time the world's clock starts at; below it, the day of the week and the season it falls on (Sunday · Winter)
Fieldsthe world's own fields, such as power.on (Fields)
Publishesthe events the world sends when its fields change
Componentsthe world's scripts (extends World), as cards with Add Component (Scripts)

A new world starts on 1 March of year 1, the first day of spring and a Monday, at 08:00, with no fields. In the file the month is a number and the time is minutes (08:00 is 480).

The calendar​

Caria's year has 12 months of 28 days: four weeks a month, and every month's 1st is a Monday. The season comes from the month. Scripts read the date with year() month() day() weekday() season() (Caria's calendar).

Publishes​

The world sends the town's events from its own fields: a World script writes a field (power.on), and a publication sends an event when that field really changes.

"publishes": [
{"event": "city.powerChanged", "when": "power.on", "payload": {"powered": "power.on"}}
]
  • Add Publication chooses an event from the project and fills its payload with the world's fields of the same type; every payload field takes a world field's value or its own default.
  • When is the field that sends the event. The event comes after object.stateChanged, with the fields' new values.
  • An event, a field or a type that does not fit is written as a problem, and Play does not start until it is fixed.