Skip to content

Online game sessions

Daniel López Guimaraes edited this page Aug 21, 2023 · 2 revisions

Pou handles online multiplayer using "game sessions". The game session is managed by the client, and when it gets modified, it is sent to the Pou game server to update the status of the session. Currently, only two games support this mode: Four Pous and Tic Tac Pou.

Internal workings

Game sessions are structured using a string with a chain of numbers representing a table split in rows and columns. The chain is read as squares of the table from left to right, and top to bottom.

Each square has a numeric value which shows if the square is empty (with value 0) or occupied by the client or the opponent. The player who creates the session gets assigned the value 1, and the opponent has the number 2.

Game session objects

GameSessionInfo

This object contains some information about a game session.

Type Field Notes
int i Game session ID.
int t Turn count.
int tO Number of current turn.
int lT Unix timestamp of when the last turn was played.
int mI Number of my turn.
int oI Opponent ID.
string oN Opponent nickname.
string oMinI Object holding the Pou data of the opponent as a string.

GameSessionTable

This object contains the table of a game session represented with a chain of numbers. For example, this 3x3 table 001122210 is split as:

0 0 1
1 2 2
2 1 0
Type Field Notes
int nR Number of rows.
int nC Number of columns.
string pI Table of game session as a chain of numbers on a string.