ServerPseudeCode
From MountainfortWiki
for
ServerPseudeCode
Jump to:
navigation
,
search
== network == network send/recv/accept : c++ 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 : 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 : chunk updates : c++ server->client : mobile updates : c++ == mainloop (draft) == * poll network (calls c++) * fluidmanager,etc... (all registered managers) : check awake and enqueue sim job * multi-threaded : execute jobs:simulation (parallel with working threads) (produces messages in thread-message buffers) * backbuffer switch (terrain) * situation now : simulation=done, we have messages in thread-message-buffers (spawn/destroy object, awake fluid-block) * single-threaded : function HandleMessages() : * move messages in thread-message buffers to 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 objects : create jobs for handling in multithreaded way * 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) * wait for maxfps == usecase : water simulation step == * created as job for thread x (c++) * simulation can be lua or c++ code (gameplay relevant but might be perfomance critical) : called from lua-file * param : chunk coord * reads world (neighbor chunks) * writes own chunk (sets marker for resynch to client)
Return to
ServerPseudeCode
.
Views
Page
Discussion
View source
History
Personal tools
Log in
Navigation
Main page
Community portal
Current events
Recent changes
Random page
Help
Search
Toolbox
What links here
Related changes
Special pages