Re: SendTrigger() Params


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]

Posted by Osan`gar on March 15, 1998 at 19:34:51:

In Reply to: Re: SendTrigger() Params posted by CogKing on March 15, 1998 at 19:26:17:

> > Ok CogKing or whoever else is reading this. I've been trying to figure out the parameters for the SendTrigger() verb, and I can't. What are the parameters and how exactly does it interact with the other cogs? Does it just send the information it has aquired in the particular cog it is in and make that info available to all the other cogs or what? I'm thinking it goes SendTrigger(CogSentTo, ?, FirstVariableSent, SecondVariableSent, ?, ?); How's that for a start? Thanks to whoever gets this one. ;)

>
> SendTrigger(destinationPlayer, triggerID, param0, param1, param2, param3);

> destinationPlayer is the reference of a player, in which case a trigger:
> message is sent to ALL the cogs of that player
> OR
> destinationPlayer is -1 in which case a trigger: message is broadcast to ALL
> the cogs of ALL the players in the game

> triggerID is simply an integer ID that you define so you know what trigger is
> being sent and can decide if a particular cog wants to handle it or not
> Use GetSenderID() to retrieve this in the trigger: handler.

> param0... param3 are 4 user parameters into which you can pass any information
> you want.
> Use GetParam(0)...GetParam(3) to retrieve these values in the trigger: handler.

> The use of this is VERY important to
> 1) reduce network traffic -- in the breaking glass example, you certainly don't
> want to send information about 50 glass shards over the internet, so instead a
> trigger is sent and each machine handles it and manages its own shards locally.
> NOTE: I'm currently rewriting doors for instance to use triggers to reduce the
> bandwidth in multiplayer games (imagine that we currently send a message for
> changing the switch cel, for playing a switch sound, for moving the 3do, for
> changing the sector adjoins,... then all the rever messages a few seconds later.
> That is 8 messages PER PLAYER CONNECTED (minus 1, you don't send to yourself).
> By using triggers we could reduce this to 1 message per player connected and
> possibly raise the number of players who can play at the same time. Especially
> in cunjunction with the better bandwidth in MoTS obtained by reducing the
> powerup messages (you don't have to ASK the server for the powerup anymore in
> MoTS, in effect gaining 2 messages per powerup taken, gaining the lag before
> you receive the answer, and also gaining a sound message BTW).

> 2) to execute accross the network things that are not possible in other ways.
> For instance the CTF script (running on the server) sends a trigger to ask a
> client to display an icon (the flag) on its screen. This is not directly
> feasible in cog, since issuing the command to display the icon on the server
> would simply display it... on the server !

> Hope this wasn't too long... :-)

> -CogKing
>

That was definitely not too long. That was perfect. I love the idea about the doors. While I was looking through the CTF cogs I noticed that LEC seemed to be leaning toward using the SendTrigger() verb as they went further into development. It is extremely obvious in the CTF_main.cog where in the histery section of the cog you can see that they started using SendTrigger near the end to reduce lag and cut down on the packets. Those door cogs would really allow editors to use more doors in levels than we do now. Using doors is kind of discouraged right now because so many players (and doesn't everyone) wants low lag. With the SendTrigger() doors, editors would be much more free to use doors in their levels, which I enjoy. :) Thanks again CK. Hope mine wasn't too long.


Follow Ups:



Post a Followup

Name:
E-Mail:
Subject:
Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]