back

Weekly Game: Client-Server

The goal this week a technical, but rather non-constraining one: build a new multi-player game around a client-server architecture.

In a client-server architecture, one program (the server) is responsible for maintaining and updating an authoritative game state, while several other programs (the clients) display this game state to players and relay their actions to the server.

One of the points of this game is to get you familiar with the "bare metal" of sockets programming. So I'd like you to use a programming language where you are able to interact with real TCP or UDP sockets.

It's fine to use a library to get away from the tedium of opening and polling sockets. (In fact, I reccommend using libev for the latter task -- it makes building servers quite a bit easier. I'll be installing a copy in the course directory.)

You can build a real-time or turn-based (or hybrid -- e.g. "simultaneous turns" in multiplayer Civilization) game. Real-time games will be harder -- lag creates big playability issues -- but you may want the challange.

libev

I've installed libev in the course directory. To use it, you'll need to add -I/afs/cs.cmu.edu/academic/class/15466-f09/include to the command line when compiling source files and -L/afs/cs.cmu.edu/academic/class/15466-f09/lib -ev to the command line when linking. An example Jamfile:

TOP = . ;
SubDir TOP ;

C++ = g++ -Wall -Werror -O2 -I.  ;
CC = gcc -Wall -Werror -O2 -I. ;
LINK = g++ ;

NAMES =
        Client.cpp
        maze_server.cpp
        Maze.cpp
;
Objects $(NAMES) ;
ObjectC++Flags $(NAMES) : -I/afs/cs.cmu.edu/academic/class/15466-f09/include ;
MainFromObjects mazeserver : $(NAMES:S=$(SUFOBJ)) ;
LINKLIBS on mazeserver += -L/afs/cs.cmu.edu/academic/class/15466-f09/lib -lev ;

You'll also need to make sure libev.so is in your LD_LIBRARY_PATH when running your server. Doesn't work:

$ ./mazeserver maze
./mazeserver: error while loading shared libraries: libev.so.3: cannot open shar
ed object file: No such file or directory

Works:

$ LD_LIBRARY_PATH=/afs/cs.cmu.edu/academic/class/15466-f09/lib ./mazeserver maze

Logistics

Please see the page on weekly games for information about how to write an artist's statement and where to turn in your completed game, as well as the standard grading scale.

Those who include an ascii drawing in their artist's statement will recieve a small reward.