UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

58 lines (28 loc) 1.25 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [startServer](./server.startserver.md) ## startServer() function The entry point for running game setup and starting the game server. **Signature:** ```typescript export declare function startServer(init: ((() => void) | ((world: World) => void))): void; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> init </td><td> ((() =&gt; void) \| ((world: [World](./server.world.md)<!-- -->) =&gt; void)) </td><td> A function that initializes the game. The function can take no parameters to just initialize game logic, or it can accept a world parameter. If it accepts a world parameter, a default world will be automatically created and passed to the function. </td></tr> </tbody></table> **Returns:** void ## Remarks This function should always be called first when initializing your game. It will internally handle initialization of the physics engine and other systems required systems. All of your game setup logic should be executed in the init function.