GalaxyCrusade, a Game+Engine completely from scratch in D

Extrawurst spam at extrawurst.org
Tue Sep 18 02:28:57 PDT 2007


well we have talked in the #D channel already yesterday but i want to 
summarize the discussion a bit.

my main inspiration for the networking architecture was the 
unrealEngine's netcode. ( http://unreal.epicgames.com/Network.htm ). but 
as i saw no necessarity in this complex script abilities (for this 
little project, not in general) and cause my time was kind of short (3 
weeks) i decided to use a templated approach instead of the scripted one.

well basically the system is a event driven one where every participant 
in the network reacts on messages sent between each other. the client is 
kept really simple as it basically just sends inputs to the almighty 
server. the server updates everyone around and broadcasts messages for 
everyone who needs to know certain things.
of coarse this makes certain prediction necessary on client sides to get 
seemless movement of all the server controlled entities.

the next thing is i wrote the server completely standalone at first and 
used it as a dedicated all the time which i can just suggest everyone to 
do cause integrating it later in the client app is much less problematic 
than extracting an integrated server to have a dedicated afterwards.

the other big part was to write a network socket class that now does all 
the work for me under the hood. it is able to process two types of 
messages. one that is send via a reliable connection and one to send via 
a unreliable one. the inmplemention on Galaxy Crusade used just both 
UDP(unreliable) and TCP(reliable) to get this done. but it would be no 
problem to implement a handcoded reliable protocol on top of the fast 
UDP by oneself. but i can say for this project it is more than 
sufficient to use simply both (+ it is far less work).

the messages themself are implementing a basic interface and identify 
themself as reliable or unreliable when added in the queue of the socket 
class. when they are sent it is up to them to stream their content into 
a buffer which is sent over the net afterwards.
to have the messages as simple as possible to write and maintain they 
are heavily filled with mixins and template stuff which basically 
enables the clean view on the important stuff in them, the logic.

one thing that i tried but wasnt yet able to finish cause of BUGs in 
D2.x is a system where i could just put every variable(that has to be 
synced over the net when the messages is delivered) in a nested struct 
of the message class and then have the templates carve out some methods 
to do the streaming but the __traits were buggy at that moment (it is 
still a nice TODO on my list).

thats it for the moment. Tom i forget about some questions pelase let me 
know ;).

--Extrawurst

Tom S schrieb:
> I'd be especially interested in hearing about the networking 
> architecture. Have you got any plans to write a few words about it? 
> I'm working on a networking lib (a rewrite and redesign of Deadlock's 
> networking) at the moment



More information about the Digitalmars-d-announce mailing list