Gama side - project-SIMPLE/simple.webplatform GitHub Wiki

If you want to create the corresponding GAML file (model) to describe the Game, you would have to write some mandatory actions that the Middleware would send via the 'Expression' and 'Ask' command.

Creating & Removing players

In order to add the player to the simulation, the middleware will send this following expression:

do create_player(id_player);

id_player is a string containing the id of the player given during the first connection. Thus, your model needs to contain an action written in the experiment part which has the following header:

action create_player(string id_player) {
   ...
}

In the same way, to remove players, you need to add the following action in the experiment part:

action remove_player(string id_player) {
   ...
}

[!TIP] These two actions are mandatory to avoid compilation errors when these action would be called by the middleware.

Expressions & Asks sent by players

If you want to add interactions between players and the simulation, you will have to add actions called by the players via 'Expression' or 'Ask' command in the experiment part.

For instance, if you allow the player to move, it can send an expression such as do move(id_player, direction);, and you will have to add the action:

action move(string id_player, string direction) {
   ...
}

[!TIP] You should always use strings for input variables for actions that will be called remotely by players. Il would avoid casting problems.