> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spurdoverse.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Game

> Engine time, ticks, map and local match state.

Engine globals and your match state, as of the current tick.

```ts theme={null}
import game from "@native/game";
```

All properties are read-only. Read them off the default export (`game.curTime`); there are no named exports.

| Property | |
| :- | :- |
| `serverTime: number` | server time, seconds |
| `curTime: number` | client time, seconds |
| `frameTime: number` | time between frames, seconds |
| `absFrameTime: number` | same, unscaled |
| `tickFraction: number` | interpolation fraction within the current tick |
| `tickCount: number` | |
| `frameCount: number` | |
| `maxClients: number` | |
| `intervalPerTick: number` | seconds per server tick (CS2 runs at 64) |
| `mapName: string \| null` | map path, `null` with no map loaded |
| `shortMapName: string \| null` | `"de_dust2"`, `null` with no map loaded |
| `connected: boolean` | connected to a server, possibly still loading |
| `inGame: boolean` | fully in a game, not the main-menu background map |
| `localTeam: number \| null` | `2` T, `3` CT, `1` spectator, `null` when not in a game |
| `teammatesAreEnemies: boolean` | `mp_teammates_are_enemies` (deathmatch), `false` when not in a game |

***

## Example

Logs the map when you join and a timestamp every second.

```ts theme={null}
import game from "@native/game";

let lastMap: string | null = null;
let lastSecond = 0;

on("tick", () => {
    if (!game.inGame) {
        lastMap = null;
        return;
    }
    if (game.shortMapName !== lastMap) {
        lastMap = game.shortMapName;
        console.log(`joined ${lastMap} as team ${game.localTeam}`);
    }

    const second = Math.floor(game.curTime);
    if (second !== lastSecond) {
        lastSecond = second;
        console.log(`t=${second}s tick=${game.tickCount}`);
    }
});
```
