6
ModuleClientAPIGameLib
Mees van der Wijk edited this page 2025-08-14 18:49:56 +02:00

ModuleClientApi - GameLib

The GameLib is Getiyo's game development framework that enables synchronized multiplayer experiences across all connected devices. The client-side GameLib focuses on timing calculation functions and custom controller development, while all core game logic, collision detection, state management, and business rules are handled server-side through the ModuleServerAPI GameLib. If you want to make a game, you need to look at the ModuleServerAPI GameLib where all the core functionality resides.

Controller

newController

Send a message to the ModuleServerAPI.

api.GameLib.newController(roomId, controllerId);
Argument Type Description
roomId string The ID of the game room.
controllerId string The ID of the controller.

Return Controller Controller instance.

Timing

Several functions to synchronize clients using the synced time you can retrieve using api.getTime().

toTimeSpan

Creates a timespan object.

api.GameLib.Timing.toTimeSpan(duration, startTimestamp?);
Argument Type Description
duration number The duration of the timespan in milliseconds.
(Optional) startTimestamp number The start timestamp of the timespan in milliseconds.

Return TimeSpan TimeSpan instance.

toFrameCycle

Creates a frame cycle object.

api.GameLib.Timing.toFrameCycle(startTimestamp, frameInterval, totalFrames, startFrame?);
Argument Type Description
startTimestamp number The start timestamp of the frame cycle in milliseconds.
frameInterval number The interval between frames in milliseconds.
totalFrames number The total number of frames in the cycle.
startFrame number The start frame of the cycle.

Return FrameCycle FrameCycle instance.

toRatio

Creates a ratio object.

api.GameLib.Timing.toRatio(value);
Argument Type Description
value number The value of the ratio.

Return Ratio Ratio instance.

getCurrentFrameIndex

Gets the current frame index of the frame cycle.

api.GameLib.Timing.getCurrentFrameIndex(cycle);
Argument Type Description
cycle FrameCycle FrameCycle instance

Return number The current frame index.

getFrameIndexAtTimestamp

Gets the current frame index of the frame cycle.

api.GameLib.Timing.getFrameIndexAtTimestamp(cycle, timestamp);
Argument Type Description
cycle FrameCycle FrameCycle instance
timestamp number The timestamp to get the frame index at.

Return number The frame index at the given timestamp.

getCurrentTimeSpanRatio

Gets the ratio of the current time span.

api.GameLib.Timing.getCurrentTimeSpanRatio(span);
Argument Type Description
span TimeSpan TimeSpan instance

Return Ratio The ratio of the current time span.

getTimeSpanRatioAtTimestamp

Gets the ratio of the time span at the given timestamp.

api.GameLib.Timing.getTimeSpanRatioAtTimestamp(span, timestamp);
Argument Type Description
span TimeSpan TimeSpan instance
timestamp number The timestamp to get the ratio at.

Return Ratio The ratio of the time span at the given timestamp.