ServerPseudeCode

From MountainfortWiki

Jump to: navigation, search
(Created page with "== network == network send/recv/accept : c++ client->server : player-movement : c++ (distribution of player-sent message) client->server : weapon/targetting/tooluse : handled by...")
 
Line 1: Line 1:
== network ==
== network ==
-
network send/recv/accept : c++
+
* network send/recv/accept : c++
-
client->server : player-movement : c++ (distribution of player-sent message)
+
* client->server : player-movement : c++ (distribution of player-sent message)
-
client->server : weapon/targetting/tooluse : handled by lua (client    msgA:sends start/stop    msgB:target(pos+quaternion+block+side))
+
* client->server : weapon/targetting/tooluse : handled by lua (client    msgA:sends start/stop    msgB:target(pos+quaternion+block+side))
-
client->server : drop item / put in container : lua (object is spawned in world and removed from inventory, object)  
+
* client->server : drop item / put in container : lua (object is spawned in world and removed from inventory, object)  
-
server->client : object created/changed : c++ (object lists / manager)
+
* server->client : object created/changed : c++ (object lists / manager)
-
server->client : chunk updates : c++
+
* server->client : chunk updates : c++
-
server->client : mobile updates : c++
+
* server->client : mobile updates : c++
-
== mainloop ==
+
== mainloop (draft) ==
* poll network (calls c++)
* poll network (calls c++)
Line 16: Line 16:
* multi-threaded : execute jobs:simulation (parallel with working threads) (produces messages in thread-message buffers)
* multi-threaded : execute jobs:simulation (parallel with working threads) (produces messages in thread-message buffers)
* backbuffer switch (terrain)
* backbuffer switch (terrain)
-
 
* situation now : simulation=done, we have messages in thread-message-buffers (spawn/destroy object, awake fluid-block)
* situation now : simulation=done, we have messages in thread-message-buffers (spawn/destroy object, awake fluid-block)
-
* single-thread : move messages in thread-message buffers to global message queue
+
* single-threaded : function HandleMessages() :
-
 
+
* move messages in thread-message buffers to global message queue
-
* single thread : global message queue :  
+
** single thread : global message queue :  
** messages for manager (fluid, light, objectspawn) : handle now (also timed events, e.g. lumberjack tree)
** messages for manager (fluid, light, objectspawn) : handle now (also timed events, e.g. lumberjack tree)
** messages for objects : create jobs for handling in multithreaded way
** messages for objects : create jobs for handling in multithreaded way
* multi-threaded : execute jobs:object-messages/think
* multi-threaded : execute jobs:object-messages/think
 +
 +
* call HandleMessages() again (handles object updates that can be sent to client before the maxfps wait)
 +
** needs to be called twice to (1) start jobs for objmessages    and (2) send updates to the clients
* backbuffer switch (object properties)
* backbuffer switch (object properties)

Latest revision as of 23:06, 1 November 2010

Personal tools