(Massively Multiplayer Online ASCII Art Game!)
Make a game that runs in a terminal. It must allow any number of players to play over a network connection. Do not limit your game to a maximum number of players -- your game should be designed to handle hundreds of players if they connect.
You'll need to submit your game as usual, but don't specify a test target (just submit the code). You'll demo your games in class near the end of the semester.
You can work in a group if you'd like.
Some considerations: - You will probably want to use ncurses but it's not required.
- You can use TCP/IP or UDP/IP:
- If you use TCP, you can base your server on the previous project (sans the shell part). Your client can just be telnet/nc, or you can write your own client with ncurses.
- If you use UDP, you'll need to write your own client. Here's two approaches:
- UDP client/server: your server maintains a global "game state" which is continuously broadcast to all clients, say every 100 milliseconds. Each client displays the game state to the user and accepts input. When a client makes a "move", it sends a UDP datagram describing the move to the server. The server changes the game state accordingly.
- UDP peer-to-peer: Each peer keeps track of its own info, e.g. the player's position and health. This info is continuously broadcast to all other peers.
- In either case, players can try to move at the same time (a race condition) and UDP datagrams can be lost or dropped. If this is a problem for your game, don't use UDP!
- You'll very likely need to use multithreading and synchronization for this project.
I'll attach some examples (below) as the semester progresses. |