loader gif

Final Degree Project

July 1, 2012

As my Computer Science final degree project I developed a fight game in C++ and OpenGL for PC and I got a mark of 9 out of 10. It is a cross-platform game (Windows and Linux) and it is an online game. The game don’t try to be a fast paced game, but a slightly slower one in which fight tactics are more important. The project was divided in two sections: the client and the server.

Note: I used to have it online on my old server. But since I don’t have that old computer anymore, I don’t have a server with the game server available.

The game works with the PGLib library, which was specifically developed for this project.

Client

You fight alone against all the enemies! You can try different strategies in order to increase your damage to other players and also try to defense yourself to avoid some damage. When there is only one player alive, a new game is started automatically after 5 seconds. At the moment the client is executed, it connects to the server specified in the “server” file (it’s a normal plain text file) and the servers adds this client to the first available game. Games have a maximum capacity of 6 players.

Controls

  • Keyboard cursors: move the player
  • A: Simple attack
  • S: Strong attak
  • C: defense
  • E: look down
  • D: look up
  • Enter: opens the chat window

Server

The server manages the communications between the different clients and is also responsible of the games. By default, the game communcation is done through a UDP socket, but as I detect some problems (probably firewall) in my university lab, I also allowed TCP connection when UDP failed on a specific client. So, the server is ready for both type of clients, ones connecting over TCP and others connecting over UDP. It actually accepts connections on a TCP port and then performs a test over UDP when a client is connected.

How to use the server

On one hand, to test the server on a local network no special configuration is needed. The only thing to do is to configure the clients with the correct server IP address. On the other hand, in order to access the server from the Internet, the following actions have to be performed before:

  1. Open 55001 port in TCP. It is the main port to accept all connections
  2. Open 55002 port in UDP. In this port, a test is executed to know the connection status of a client. The result of this test will determine wheter the client can use UDP or not. If not, the initial TCP connection will be used for all the game communication with the specific client.
  3. From the port 55003 (included), 2 UDP ports must be opened for every 5 players.