Skip to content

Latest commit

 

History

History
145 lines (67 loc) · 1.94 KB

File metadata and controls

145 lines (67 loc) · 1.94 KB

Home > server > WorldLoop

WorldLoop class

Manages the tick loop for a world.

Signature:

export default class WorldLoop extends EventRouter 

Extends: EventRouter

Remarks

The world loop automatically handles ticking physics, entities, and other world logic.

The internal order of tick operations is as follows:

  1. Update chunks and meshing

  2. Tick entity logic

  3. Step physics

  4. Check and emit entity updates

  5. Synchronize network packets with player clients

Events

This class is an EventRouter, and instances of it emit events with payloads listed under WorldLoopEventPayloads

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the WorldLoop class.

Properties

Property

Modifiers

Type

Description

currentTick

readonly

number

The current tick of the world loop.

nextTickMs

readonly

number

The next tick time in milliseconds.

timestepS

readonly

number

The fixed timestep of the world loop in seconds.

world

readonly

World

The world that the loop manages.