Mise en contexte
“Electronic Arts” © (hereinafter referred to as “EA”), small company specialized in import / export of maple syrup, has decided to widen its circle of activities in order to increase its power gain.To do this, they chose to get into the emerging market for video game applications.
EA does not intend to do it the easy way, they want to make a big splash, releasing the first innovative, immersive, addictive, and (most importantly) profitable game. They now appeal to you to make this masterpiece which will leave a permanent trace in the history of video games. Your mission is to develop a program meeting the following specificities:
The goal is to fight players (spread over several teams) on a two dimensions game board.
The last team remaining on the board is the winner.
To kill a player, a minimum of two players from the same team (and different from the first) need to be in contact with the player to kill. It means on a square next to the one where the player you want to kill stands on. (including diagonally)
When a player realizes he is surrounded by at least 2 players of the same opponent team, he must leave the board game (yes, because it is well known that NPC are honest in games, they scrupulously respect the rules … yep, ask the mustachioed plumber on his kart if he cheats sometimes … well nope!)
A square cannot host more than one player simultaneously.
Notion of IPC
The Linux IPC (Inter-process communication) facilities provide a method for multiple processes to communicate with one another. There are several methods of IPC available to Linux C programmers:
These facilities, when used effectively, provide a solid framework for client/server development on any UNIX system (including Linux). Here a little link for illustrate the difference between POSIX and SYSV IPCs
Use of IPCs
For this project we had to use SYSV message queue, SYSV style semaphores set as well as SYSV style shared memory segments.
- Messages queue are used for the communication of the team and convey messages to all the members of the team.
- The shared memory represent the battlefield, so it’s obligatory to be common to all the process.
- Semaphores are used in the binary way, to allow only one process at a time to modify the map without having interference with others process.
The most important part of the project was the AI. Our choice was really easy, due to a lack of time we opted for a random AI.
This projet was really interesting to achieve, the viewing knowledge was new for us which made the projet fun to do despite the short period we had…
https://lc.cx/QJA Small video explaining our feelings.