[Nel] Snowballs building problem

Daniel Miller miller@nevrax.com
Tue, 3 Jul 2001 10:51:48 +0200


Your best bet for now is to look at the layer 4 code sample
(/cvs/cvsweb.cgi/code/nel/samples/net_layer4)

In this example the 'client' sends messages to the 'frontend', the
'frontend' treats these messages and sends them to the 'ping service'. The
'ping service' receives messages from the 'frontend', treats them and sends
back new messages. The 'frontend' receives messages from the 'server',
treats them and dispatches new messages to the 'client'...

The following chunks of code in the 'frontend' is the key. You can extend
the callback arrays to include messages for all the actions that the player
can send to the shard:


/*
 * Callback array for messages received from a client
 */
TCallbackItem CallbackArray[] =
{
        { "PING", cbPing }        // when receiving a "PING" message, call
cbPing()
};


/*
 * Callback array for message received from the ping service
 */
TCallbackItem PingServiceCallbackArray[] =
{
        { "PONG", cbPong }        // when receiving a "PONG" message, call
cbPong()
};



Snowballs, being based on an older version of NeL, is far less clean - the
callback table contains a mixture of admin messages (such as "C" and "D"),
and game messages (such as "PAN" and "SHO"). Otherwise the principles are
the same.

// Callback array as a server
TCallbackItem CallbackArray [] =
{
        { "ES", cbServerProcessEntityState },
        //{ "BT", cbSpawnBot },
        { "C", cbConnect },
        { "D", cbDisconnect },
        //{ "RST", cbResetServer },
        { "NAM", cbAssignName },
        { "PAN", cbPan },
        { "SHO", cbShoot },
        { "RMW", cbProcessRemoveWeapon },
        { "AUT", cbWelcome },
        { "DUMP", cbDumpState },
        { "CHAT", cbChat },
        { "PING", cbPing },
        { "PONG", cbPong }
        //{ "ACC", cbGiveAccess } // this is for the test client. Remove it
for a real use or any client can connect with any password !
};

-----Original Message-----
From: nel-admin@nevrax.org [mailto:nel-admin@nevrax.org]On Behalf Of
Yann Morvan
Sent: Monday, July 02, 2001 8:05 PM
To: nel@nevrax.org
Subject: Re: [Nel] Snowballs building problem


That was exactly why I wanted to have a look at Snowballs.
The point I was particularly interested in was the mecanism
used by the server to identify a player's action and call the
matching piece of code, and how to define those "pieces of code".
I've compiled the documentation, so I'll just have to look at it,
but if you can think of informations I may have troubles to find,
don't hesitate to tell me about it.

	Yann

_______________________________________________
Nel mailing list
Nel@nevrax.org
/mailman/listinfo.cgi/nel