aboutsummaryrefslogtreecommitdiff
path: root/pipermail/nel/2001-July/000470.html
blob: 74ca67585021551901275d697093b633ae34fa64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Nel] Snowballs building problem</TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:miller%40nevrax.com">
   <LINK REL="Previous"  HREF="000469.html">
   <LINK REL="Next" HREF="000471.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Nel] Snowballs building problem</H1>
    <B>Daniel Miller</B> 
    <A HREF="mailto:miller%40nevrax.com"
       TITLE="[Nel] Snowballs building problem">miller@nevrax.com</A><BR>
    <I>Tue, 3 Jul 2001 10:51:48 +0200</I>
    <P><UL>
        <LI> Previous message: <A HREF="000469.html">[Nel] Snowballs building problem</A></li>
        <LI> Next message: <A HREF="000471.html">[Nel] Snowballs building problem</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#470">[ date ]</a>
              <a href="thread.html#470">[ thread ]</a>
              <a href="subject.html#470">[ subject ]</a>
              <a href="author.html#470">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Your best bet for now is to look at the layer 4 code sample
(<A HREF="http://www.nevrax.org/cvs/cvsweb.cgi/code/nel/samples/net_layer4">http://www.nevrax.org/cvs/cvsweb.cgi/code/nel/samples/net_layer4</A>)

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[] =
{
        { &quot;PING&quot;, cbPing }        // when receiving a &quot;PING&quot; message, call
cbPing()
};


/*
 * Callback array for message received from the ping service
 */
TCallbackItem PingServiceCallbackArray[] =
{
        { &quot;PONG&quot;, cbPong }        // when receiving a &quot;PONG&quot; 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 &quot;C&quot; and &quot;D&quot;),
and game messages (such as &quot;PAN&quot; and &quot;SHO&quot;). Otherwise the principles are
the same.

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

-----Original Message-----
From: <A HREF="mailto:nel-admin@nevrax.org">nel-admin@nevrax.org</A> [mailto:<A HREF="mailto:nel-admin@nevrax.org">nel-admin@nevrax.org</A>]On Behalf Of
Yann Morvan
Sent: Monday, July 02, 2001 8:05 PM
To: <A HREF="mailto:nel@nevrax.org">nel@nevrax.org</A>
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 &quot;pieces of code&quot;.
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
<A HREF="mailto:Nel@nevrax.org">Nel@nevrax.org</A>
<A HREF="http://www.nevrax.org/mailman/listinfo.cgi/nel">http://www.nevrax.org/mailman/listinfo.cgi/nel</A>


</pre>


<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI> Previous message: <A HREF="000469.html">[Nel] Snowballs building problem</A></li>
	<LI> Next message: <A HREF="000471.html">[Nel] Snowballs building problem</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#470">[ date ]</a>
              <a href="thread.html#470">[ thread ]</a>
              <a href="subject.html#470">[ subject ]</a>
              <a href="author.html#470">[ author ]</a>
         </LI>
       </UL>
</body></html>