Moved documentation into doc branch

This commit is contained in:
Kayne Ruse
2013-06-06 02:55:06 +10:00
parent dfac9c1518
commit d347545c20
6 changed files with 1 additions and 278 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ struct Movement {
};
//-------------------------
//this state of this is great
//the packet itself
//-------------------------
union PacketData {
-11
View File
@@ -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
-9
View File
@@ -1,9 +0,0 @@
Architecture
SceneManager:
- Splash
- MainMenu
- Lobby
- InGame
- Combat
- TestSystems (debug scene)
-125
View File
@@ -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
-74
View File
@@ -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
-58
View File
@@ -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