Developing a 2 player game on linux server help
Posted on 2011-03-24
I am a student andI need to implement a 2-player PacMan game (in C) for a Unix Machine. Each player will login into the same server with their respective user accounts, type the command ‘pacman’, and instantly will be placed in a FIFO queue (fifo.c) and wait for access to the game. When it is their turn to play, both users should find themselves in the ‘same maze’, competing against each other.
I did not implement the FIFO queue yet. Up till now, I have a one-player pacman game, pacman.c and in it I already have an IPC between player one and the ghosts via shared memory. Now, I would like to implement another IPC between player 1 and player 2, and I was thinking of using signals but I am not sure whether they are practical.
Can I assume that one instance of pacman.c is loaded on the server? Therefore, is it possible to load only one instance of the game (fifo.c will call exec() ONCE) and associate different processes (in pacman.c) with different user accounts (one process associated with player one, and maybe the child process with player 2)?