ModuleClientApi - GameLib
The GameLib is Getiyo's game development framework that enables synchronized multiplayer experiences across all connected devices. Click here to view the introductions.
Rooms
getRoom
Get a game room.
api.GameLib.getRoom(roomId);
| Argument | Type | Description |
|---|---|---|
| roomId | string | The id of the room. |
Return GameRoom GameRoom instance.
hasRoom
Check if a game room exists.
api.GameLib.hetRoom(roomId);
| Argument | Type | Description |
|---|---|---|
| roomId | string | The id of the room. |
Return boolean Room exists.
Collision
toSpace
Creates a timespan object.
api.GameLib.Collision.toSpace(x, y, width, height, id?);
| Argument | Type | Description |
|---|---|---|
| x | number | The x coordinate of the top-left corner of the element you want to make a space from. |
| y | number | The y coordinate of the top-left corner of the element you want to make a space from. |
| width | number | The width of the element you want to make a space from. |
| height | number | The height of the element you want to make a space from. |
| (Optional) id | string | The id of the space. |
Return CollisionSpace CollisionSpace instance.
getObjectsInSpace
Get all objects in a space.
api.GameLib.Collision.getObjectsInSpace(space, objects);
| Argument | Type | Description |
|---|---|---|
| space | CollisionSpace | The space object you want to check with. |
| objects | CollisionSpace[] | An array of collision spaces. |
Return CollisionSpace[] CollisionSpace instances.
isOverlapping
Check if two spaces are overlapping.
api.GameLib.Collision.isOverlapping(space1, space2);
| Argument | Type | Description |
|---|---|---|
| space1 | CollisionSpace | The first space object. |
| space2 | CollisionSpace | The second space object. |
Return boolean True if the spaces are overlapping, false otherwise.
getDistance
Get the distance between two spaces.
api.GameLib.Collision.getDistance(space1, space2);
| Argument | Type | Description |
|---|---|---|
| space1 | CollisionSpace | The first space object. |
| space2 | CollisionSpace | The second space object. |
Return boolean _ The distance between the two spaces._
Timing
Several functions to synchronize clients.
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.
Getting Started
Module Development
- Introduction
- V2 Module Structure
- V1 Module Structure
- Development environment/Building
- Module Config
- Module Debugging
- GetiyoModuleTool
- Bug/Feature Reporting
- Contact Details
ModuleServerAPI
ModuleServerAPI GameLib
ModuleClientAPI
ModuleApi Shared
© Vix Entertainment 2023 - © Mooren Productief 2023 - All rights reserved