hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
167 lines (76 loc) • 2.17 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [WorldLoop](./server.worldloop.md)
## WorldLoop class
Manages the tick loop for a world.
**Signature:**
```typescript
export default class WorldLoop extends EventRouter
```
**Extends:** [EventRouter](./server.eventrouter.md)
## 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
<h2>Events</h2>
This class is an EventRouter, and instances of it emit events with payloads listed under [WorldLoopEventPayloads](./server.worldloopeventpayloads.md)
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
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[currentTick](./server.worldloop.currenttick.md)
</td><td>
`readonly`
</td><td>
number
</td><td>
The current tick of the world loop.
</td></tr>
<tr><td>
[isStarted](./server.worldloop.isstarted.md)
</td><td>
`readonly`
</td><td>
boolean
</td><td>
Whether the world loop is started.
</td></tr>
<tr><td>
[nextTickMs](./server.worldloop.nexttickms.md)
</td><td>
`readonly`
</td><td>
number
</td><td>
The next tick time in milliseconds.
</td></tr>
<tr><td>
[timestepS](./server.worldloop.timesteps.md)
</td><td>
`readonly`
</td><td>
number
</td><td>
The fixed timestep of the world loop in seconds.
</td></tr>
<tr><td>
[world](./server.worldloop.world.md)
</td><td>
`readonly`
</td><td>
[World](./server.world.md)
</td><td>
The world that the loop manages.
</td></tr>
</tbody></table>