The Game Story Project

Home| Motivations | API | Download | How can you help? | Mailing Lists

API

The API allows players developed by all party to be plugged into the Game Story engine. This project right now targets Linux only. The plug-in mechanism will be Linux-specific, although one can readily recognise equivalents on Windows.

At this moment, the game of choice is Big2. This is a pretty popular Chinese card game. You can find the rules here. Of course, as the project gets big, the list of games will be expanded.

A player is simply a shared library. The library will be loaded dynamically into the engine at run-time, in order to allow easy swapping of players. The library must implement all of the following functions:

Signature Parameters / Return Meaning
void
hand_init()
None
Called before a new game starts.
void
hand_regopp(int)
int - ID of your opponent.
Remember who your opponents are. This function will be called as part of game initialization, after hand_init() is called.
void
hand_recv(struct card)
card - the card dealt to the player.
Called when a card is given to the player.
int
hand_play(struct card*, int)
card* - an array into which the player plays its cards.
int - the length of the card array.
Return - the number of cards placed into the array.
Called when it is the player's turn to play.
void
hand_watch(int, struct card*, int)
int - ID of the player who just played the cards.
card* - the array of cards another player just played.
int - number of cards another player just played.
Called after one of your opponents has just played his turn.
void
hand_clean()
None
Called when a game is finished.