From d347545c20807560ad9e4744b97b5868ed85cc51 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Thu, 6 Jun 2013 02:55:06 +1000 Subject: [PATCH] Moved documentation into doc branch --- common/packet_list.hpp | 2 +- docs/TODO.txt | 11 ---- docs/client.txt | 9 --- docs/networking outline.txt | 125 ------------------------------------ docs/pseudocode.txt | 74 --------------------- docs/server.txt | 58 ----------------- 6 files changed, 1 insertion(+), 278 deletions(-) delete mode 100644 docs/TODO.txt delete mode 100644 docs/client.txt delete mode 100644 docs/networking outline.txt delete mode 100644 docs/pseudocode.txt delete mode 100644 docs/server.txt diff --git a/common/packet_list.hpp b/common/packet_list.hpp index 7e5bd38..6ac6242 100644 --- a/common/packet_list.hpp +++ b/common/packet_list.hpp @@ -85,7 +85,7 @@ struct Movement { }; //------------------------- -//this state of this is great +//the packet itself //------------------------- union PacketData { diff --git a/docs/TODO.txt b/docs/TODO.txt deleted file mode 100644 index 034b614..0000000 --- a/docs/TODO.txt +++ /dev/null @@ -1,11 +0,0 @@ -Each client needs to know about each other client now. - - -Have multiple players moving around the server at the same time -keep the docs up to date!!!!! - -Player's internals a weird. - -clarify some of the names in the server project -reimplement the server's time system. -Overall, I think the server needs restructuring \ No newline at end of file diff --git a/docs/client.txt b/docs/client.txt deleted file mode 100644 index 2c05482..0000000 --- a/docs/client.txt +++ /dev/null @@ -1,9 +0,0 @@ -Architecture - -SceneManager: -- Splash -- MainMenu - - Lobby -- InGame - - Combat -- TestSystems (debug scene) \ No newline at end of file diff --git a/docs/networking outline.txt b/docs/networking outline.txt deleted file mode 100644 index 7cafbb6..0000000 --- a/docs/networking outline.txt +++ /dev/null @@ -1,125 +0,0 @@ -Client: - SceneManager: - TCPSocket - end -end - -Server: - TCPServerSocket - SocketList --list of all client sockets if one is closed, remove it. -end - -When the player enters the lobby, they can choose what server to connect to. When they connect to the server, they'll enter a sort of character creation screen. Once that is done, they will enter the game world proper. - -This is controlled through the config files for now. - -using ';' delimited commands, how can I get it to work? - -------------------------- - -UDPNetworkUtility: - void Open(port, packSize) - void Close() - - //bind to an available channel - int Bind(ip, port) - int Bind(address) - - //bind to a certain channel - int Bind(ip, port, channel) - int Bind(address, channel) - void Unbind(channel) - - int Send(channel, data, len) - int Receive() - - GetIPAddress(channel) - - GetOutData() - GetInData() - - GetOutPacket() - GetInPacket() - - UDPsocket socket - UDPpacket packOut - UDPpacket packIn -end - -------------------------- - -packet_list.hpp: - Ping: - end - Pong: - end - JoinRequest: - avatarName - ... - end - JoinConfirm: - yourID - end - NewPlayer: - id - position - motion - avatarName - end - MotionUpdate: - id - position - motion - end - union Packet: - MotionUpdate - end -end - -------------------------- - -Networking protocol: - //connections - ping: - ping the server - pong: - a response to a ping - join request: - from client to server, this is the initial contact the client makes. it carries all of the client's information, like the handle, avatar, etc. - join confirm: - the response to a join request, this makes the client enter the game proper, and carries the client's playerID. - disconnect: - from either the client or server, his officially ends communications between the two programs - - //information control - synchronize: - update both the server and client - new player: - a new player enters the world. carries all player info - delete player: - a player leaves the world, carries the player ID - movement: - this is the initial position and motion of a player in the world. it is relayed to all clients, and progresses using delta progression - -------------------------- - -Server: - ClientData: - int playerID - int channel - str handle - str avatar - vec position - vec motion - end -end - -Client: - Lobby: - ServerData: - name - address - end - end -end - diff --git a/docs/pseudocode.txt b/docs/pseudocode.txt deleted file mode 100644 index 40f1ba4..0000000 --- a/docs/pseudocode.txt +++ /dev/null @@ -1,74 +0,0 @@ -Client: - loops - handles input from the user - handles graphics and sound - communicates with the server (how?) - -------------------------- - -Server: - loops - accepts new connections, disconnections, and handles loss of connections - holds the positions/data of all players - -Player: - id - [graphical stuff] - position - velocity - avatarName - -------------------------- - -Player: - index --global index on the server - position - motion - image --avatar chosen by the player (later) - ShiftMotion(vector relativeMotion) - - -PlayerManager: - NewPlayer(index, avatar, x, y) - Update(delta) //all player objects - Synchronize(dataArray) //possible - -------------------------- - -Remember: Top down programming/K.I.S.S. - -KeyDown: - up: - PlayerManager.ShiftMotion(playerIndex, up) - down: - PlayerManager.ShiftMotion(playerIndex, down) - ... -end - -Receive: - switch(message->type): - player update: - PlayerManager.Update(message) -end - -------------------------- - ---send info about the specified client to all clients ---use this for new connections, movement, etc. -SendClientData(int playerID): - for (clientMap): - Send(it.channel, clientMap[playerID]) - end -end - -NewClientData := SendClientData - - ---send all info about the server to the specified client ---send this to new connections -SynchronizeClient(int playerID): - for (clientMap): - Send(clientMap[playerID].channel, it) - end -end - diff --git a/docs/server.txt b/docs/server.txt deleted file mode 100644 index 1ace583..0000000 --- a/docs/server.txt +++ /dev/null @@ -1,58 +0,0 @@ -init and quit are self explanatory. - -the main server loop will have three main phases: - -* receive messages from the clients -* update the server-side game world -* send all updates out to the clients - -As far as possible multithreading goes, each of these main phases can run several operations at once; I need to actually *learn* multithreading, what better excuse? - -------------------------- - -Messages from the clients refers to anything from player movement to text communications to new player connections. Anything that has changed is marked as such, so that it can be sent out again later. - -Updating the game world involes updating players or monsters already in motion, loot drop count downs, entity AI and anything else that needs to happen each frame. - -Finally, updating the clients is important: anything that has been marked as "changed" needs to be resent to the players. Any new players that have joined need to receive everything as far as client-side data goes. - -If a player is in motion, the server will update their internal position, but this *won't* be marked as changed; only the beginning and end (and changes of direction) of a player's movement will be considered changes. Each client will preform their own updates based on the last known information. The server-side updates are required for new connections. - -------------------------- - -This outline is only the most basic example of the server's operation possible, but it's a good start. I'll need to consider things such as server-specific map data, scripts and other resources being sent to new connections. - -------------------------- - -Player: - ID --unique, incremental - position - motion - avatarName --make sure you've transfered the assets first - - Update(int) - - Set - Get - - GetPosition() - GetMotion() - GetAvatarName() -end - -class PlayerManager: - maxPlayers - currentPlayers - ticker --incremental - - Init(maxPlayers) - Quit() - - UpdateAll(int) - - NewPlayer(...) - GetPlayer(index) - DeletePlayer(...) - - DeleteAll() -end