Difference between revisions of "UNX511 Winter2012 TeamB Network Protocol"

From CDOT Wiki
Jump to: navigation, search
(Created page with '== Project Platypus - Introduction == This semester we are developing a co-operative multiplayer game in UNX511. The project will include: a Unix-based server written in C and mu…')
 
 
Line 1: Line 1:
== Project Platypus - Introduction ==
+
== Network Core - General ==
This semester we are developing a co-operative multiplayer game in UNX511. The project will include: a Unix-based server written in C and multiple clients running on different platforms.
+
*[https://github.com/idshibanov/project-platypus/tree/network-core Current source code]
  
This is tile based defense zombie survival. Players will explore dead city, while searching for safe houses, building barricades or repairing city infrastructure and fighting against aggressive zombies. Game will be based on rounds, where players will have to reach goals. When goal is reached, server will reset map and round starts again, while players will get points for a round.
+
All network protocol related source files are located in /net folder.
  
 +
To prevent confusion, everything with "Client" in its name (e.g. ClientStatus or ClientSocketHandler) works on the client side, and similarly everything with "Server" - on the server side.
  
== Version History ==
+
Basic algorithm:
Project is in the planning phase.
+
*1. Client connects to a server, creates an instance of ClientSocketHandler class
 +
*2. To send data, client uses functions inside ClientSocketHandler class (e.g. SendChatMsg)
 +
*3. Client runs select() function, and if there is something, uses RecvPacket() function
  
== Platforms ==
+
== Authorization Process ==
We are planning to develop 3 interfaces for different platforms:
 
* Android application
 
* Linux client
 
* Web interface
 
  
== General Ideas ==
+
<syntaxhighlight lang="cpp">
Players work together to defend a building from increasingly difficult waves of zombies. In between waves, players can buy items (traps, obstacles, placeable weapons) and place them on the game map. Players are awarded points and money for kills. Players with the most points at the end of the game  "win". But everyone else wins too.. unless they all lose.
+
enum ClientStatus{
 +
    STATUS_CLIENT_OFFLINE,        // initial state
 +
    STATUS_CLIENT_REGISTRATION,  // trying to register
 +
    STATUS_CLIENT_CONNECTED,      // just connected
 +
    STATUS_CLIENT_AUTHORIZED,    // succesfully logged in
 +
    STATUS_CLIENT_JOINED,         // joined game lobby (intermission)
 +
    STATUS_CLIENT_GAME_STARTED,   // game is starting
 +
    STATUS_CLIENT_GAME_INIT,     // downloading game map data
 +
    STATUS_CLIENT_GAME_READY,    // ready to go
 +
    STATUS_CLIENT_GAME_ACTIVE,    // playing
 +
    STATUS_CLIENT_END            // always at the end
 +
};
 +
</syntaxhighlight>
  
If no players are logged in, game will be paused. Difficulty and scale will be based on the number of logged in players, so building will be expanded automatically.
 
  
The building can consist of several floors. Game begins on the ground level, but players can purchase "keys" to the next level, unlocking more space to place defensive items and create paths for enemies.
 
  
Game doesn't necessarily have to be real time. Could be based on action timers/cool-downs.
+
== Network Packet ==
 +
*[https://github.com/idshibanov/project-platypus/blob/network-core/net/packet.cpp packet.cpp]
 +
*[https://github.com/idshibanov/project-platypus/blob/network-core/net/packet.h packet.h]
  
(If time permits) Points collected during play spendable in cosmetic shop.
 
  
== Technical Ideas ==
+
== Client Socket Handler ==
=== Features ===
+
*[https://github.com/idshibanov/project-platypus/blob/network-core/net/client_socket.cpp client_socket.cpp]
 +
*[https://github.com/idshibanov/project-platypus/blob/network-core/net/client_socket.h client_socket.h]
  
Server creates instances of games that can contain up to ( 16 or 32 ) number of players. When instance is full, it automatically creates a new instance (fork).
+
ClientSocketHandler is a derived class from a abstract SocketHanlder and contains member functions that work specifically on a client side.
  
Server settings (diffictuly, port number, player limit) will be stored in separate file.
+
== Server Socket Handler ==
 +
*[https://github.com/idshibanov/project-platypus/blob/network-core/net/server_socket.cpp server_socket.cpp]
 +
*[https://github.com/idshibanov/project-platypus/blob/network-core/net/server_socket.h server_socket.h]
 +
Will be documented later.
  
We should implement pathfinding algorithm and AI for zombies.
+
== Links ==
 
+
*[https://github.com/idshibanov/project-platypus/network Committed progress graph]
MySQL database that will store accounts, players statistics and game data.
 
 
 
=== Roadmap ===
 
 
 
==== Basics ====
 
* Client connections handling
 
* Basic clients (Web, Android, terminal)
 
* Develop basic data protocol
 
* Chat
 
* Static maps
 
* Player Movement
 
* Server forking
 
* Zombies & damage (basic punching)
 
* Collision detection
 
 
 
==== Advanced ====
 
* Zombie AI and pathfinding
 
* Map generation
 
* Database implementation
 
* Improved client interfaces
 
* Item placement
 
* Weapons, inventory
 
 
 
==== Additional Features ====
 
* Auto-scaling
 
* Difficulty levels, server config
 
* Interaction with map (picking items, etc)
 
* Items crafting
 
* Highscores system
 

Latest revision as of 15:04, 2 April 2012

Network Core - General

All network protocol related source files are located in /net folder.

To prevent confusion, everything with "Client" in its name (e.g. ClientStatus or ClientSocketHandler) works on the client side, and similarly everything with "Server" - on the server side.

Basic algorithm:

  • 1. Client connects to a server, creates an instance of ClientSocketHandler class
  • 2. To send data, client uses functions inside ClientSocketHandler class (e.g. SendChatMsg)
  • 3. Client runs select() function, and if there is something, uses RecvPacket() function

Authorization Process

enum ClientStatus{
    STATUS_CLIENT_OFFLINE,        // initial state
    STATUS_CLIENT_REGISTRATION,   // trying to register
    STATUS_CLIENT_CONNECTED,      // just connected
    STATUS_CLIENT_AUTHORIZED,     // succesfully logged in
    STATUS_CLIENT_JOINED,         // joined game lobby (intermission)
    STATUS_CLIENT_GAME_STARTED,   // game is starting
    STATUS_CLIENT_GAME_INIT,      // downloading game map data
    STATUS_CLIENT_GAME_READY,     // ready to go
    STATUS_CLIENT_GAME_ACTIVE,    // playing
    STATUS_CLIENT_END             // always at the end
};


Network Packet


Client Socket Handler

ClientSocketHandler is a derived class from a abstract SocketHanlder and contains member functions that work specifically on a client side.

Server Socket Handler

Will be documented later.

Links