More specs
21
ModuleApiGameLibFrameCycle.md
Normal file
21
ModuleApiGameLibFrameCycle.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# ModuleApi - GameLib FrameCycle
|
||||
|
||||
Simple object used to perform time calculations for sychronized rendering across clients.
|
||||
|
||||
## Structure
|
||||
|
||||
```JSON
|
||||
{
|
||||
"startTimestamp": 1754754260809,
|
||||
"frameInterval": 1000 / 60,
|
||||
"totalFrames": 10
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
| Attribute | 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. |
|
||||
| (Optional) startFrame | number | The start frame of the cycle. |
|
||||
18
ModuleApiGameLibTimeSpan.md
Normal file
18
ModuleApiGameLibTimeSpan.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# ModuleApi - GameLib TimeSpan
|
||||
|
||||
Simple object used to perform time calculations for sychronized rendering across clients.
|
||||
|
||||
## Structure
|
||||
|
||||
```JSON
|
||||
{
|
||||
"startTimestamp": 1754754260809,
|
||||
"endTimestamp": 1754754270809
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
| Attribute | Type | Description |
|
||||
| -------------- | ------ | ------------------------------------ |
|
||||
| startTimestamp | number | The start timestamp of the TimeSpan. |
|
||||
| endTimestamp | number | The end timestamp of the TimeSpan. |
|
||||
@@ -17,20 +17,112 @@ api.GameLib.newController(roomId, controllerId);
|
||||
| roomId | string | The ID of the game room. |
|
||||
| controllerId | string | The ID of the controller. |
|
||||
|
||||
**Return** [Controller](./ModuleClientAPIGameLibController) _The GameLib Controller_
|
||||
**Return** [Controller](./ModuleClientAPIGameLibController) _Controller instance._
|
||||
|
||||
## Timing
|
||||
|
||||
Several functions to synchronize clients using the synced time you can retrieve using `api.getTime()`.
|
||||
|
||||
### toTimeSpan
|
||||
|
||||
Creates a timespan object.
|
||||
|
||||
```javascript
|
||||
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](./ModuleApiGameLibTimeSpan) _TimeSpan instance._
|
||||
|
||||
### toFrameCycle
|
||||
|
||||
Creates a frame cycle object.
|
||||
|
||||
```javascript
|
||||
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](./ModuleApiGameLibFrameCycle) _FrameCycle instance._
|
||||
|
||||
### getCurrentFrameIndex
|
||||
|
||||
Gets the current frame index of the frame cycle.
|
||||
|
||||
```javascript
|
||||
api.GameLib.Timing.getCurrentFrameIndex(cycle);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | ------------------------------------------ | ------------------- |
|
||||
| cycle | [FrameCycle](./ModuleApiGameLibFrameCycle) | FrameCycle instance |
|
||||
|
||||
**Return** number _The current frame index._
|
||||
|
||||
### getFrameIndexAtTimestamp
|
||||
|
||||
Gets the current frame index of the frame cycle.
|
||||
|
||||
```javascript
|
||||
api.GameLib.Timing.getFrameIndexAtTimestamp(cycle, timestamp);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| --------- | ------------------------------------------ | ---------------------------------------- |
|
||||
| cycle | [FrameCycle](./ModuleApiGameLibFrameCycle) | 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.
|
||||
|
||||
```javascript
|
||||
api.GameLib.Timing.getCurrentTimeSpanRatio(span);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | -------------------------------------- | ----------------- |
|
||||
| span | [TimeSpan](./ModuleApiGameLibTimeSpan) | TimeSpan instance |
|
||||
|
||||
**Return** [Ratio](./ModuleApiGameLibRatio) _The ratio of the current time span._
|
||||
|
||||
### getTimeSpanRatioAtTimestamp
|
||||
|
||||
Gets the ratio of the time span at the given timestamp.
|
||||
|
||||
```javascript
|
||||
api.GameLib.Timing.getTimeSpanRatioAtTimestamp(span, timestamp);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| --------- | -------------------------------------- | ---------------------------------- |
|
||||
| span | [TimeSpan](./ModuleApiGameLibTimeSpan) | TimeSpan instance |
|
||||
| timestamp | number | The timestamp to get the ratio at. |
|
||||
|
||||
**Return** [Ratio](./ModuleApiGameLibRatio) _The ratio of the time span at the given timestamp._
|
||||
|
||||
### toRatio
|
||||
|
||||
Creates a ratio object.
|
||||
|
||||
```javascript
|
||||
api.GameLib.Timing.toRatio(value);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | ------ | ----------------------- |
|
||||
| value | number | The value of the ratio. |
|
||||
|
||||
**Return** [Ratio](./ModuleApiGameLibRatio) _Ratio instance._
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
- ModuleApi Shared
|
||||
- [GameLib GameDetails](./ModuleApiGameLibGameDetails)
|
||||
- [GameLib EndScreen](./ModuleAPIGameLibEndScreen)
|
||||
- [GameLib TimeSpan](./ModuleApiGameLibTimeSpan)
|
||||
- [GameLib FrameCycle](./ModuleApiGameLibFrameCycle)
|
||||
- [Module Debugging](./ModuleDebugging)
|
||||
- [ModuleStore](./ModuleStore)
|
||||
- [Bug/Feature Reporting](./Reporting)
|
||||
|
||||
Reference in New Issue
Block a user