Multiplay and Star systems
20 years 3 weeks ago #11845
by Joco
Replied by Joco on topic Multiplay and Star systems
Slow progress due to real life. Was wondering if anyone has documented which parts of the multiplayer POGs get fired by the server v's the clients/players in the mission.
Cheers,
Joco.
Cheers,
Joco.
Please Log in or Create an account to join the conversation.
20 years 3 weeks ago #11846
by MajorTom
Replied by MajorTom on topic Multiplay and Star systems
Sorry, I would like to answer, but I'm not sure I understand the question.
Do you mean:
which of the script functions are run only on the server and which ones are active on the client?
or:
Which of the POG commands/functions will only work on the server (v's those that will run on the client).
Which one of the standard MP scripts, from the SDK, would you like to use as a reference?
Iwar2 Multiplayer Fan Site
Do you mean:
which of the script functions are run only on the server and which ones are active on the client?
or:
Which of the POG commands/functions will only work on the server (v's those that will run on the client).
Which one of the standard MP scripts, from the SDK, would you like to use as a reference?
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.
20 years 3 weeks ago #11848
by Joco
Replied by Joco on topic Multiplay and Star systems
Ah - sorry on re-reading I was a bit obtuse. Let me rephrase.
In a Multiplay script there seem to be a number of standard functions. Now using a nice simple script as a base reference (ideathmatch.pog) what I as wondering is if there is some past documentation that goes through what events trigger what functions/procedures in the script for the client and for the server.
Now some of the functions in the sample script do say when they are called but not all. Also I am getting tied in knots over the nature of the event model used by i-war. Now I did work this out a small amount about 2 years ago but I am buggered if I can remember that learning now.
In some respects I guess I am almost thinking in terms of a lifecycle diagram for a multiplay pog script as at the moment I am having problems getting that type of picture in my head as well as the specifics around what script procedures are called when.
Hope that makes this a little clearer.
Cheers,
Joco.
In a Multiplay script there seem to be a number of standard functions. Now using a nice simple script as a base reference (ideathmatch.pog) what I as wondering is if there is some past documentation that goes through what events trigger what functions/procedures in the script for the client and for the server.
Now some of the functions in the sample script do say when they are called but not all. Also I am getting tied in knots over the nature of the event model used by i-war. Now I did work this out a small amount about 2 years ago but I am buggered if I can remember that learning now.
In some respects I guess I am almost thinking in terms of a lifecycle diagram for a multiplay pog script as at the moment I am having problems getting that type of picture in my head as well as the specifics around what script procedures are called when.
Hope that makes this a little clearer.
Cheers,
Joco.
Please Log in or Create an account to join the conversation.
20 years 3 weeks ago #11851
by MajorTom
Replied by MajorTom on topic Multiplay and Star systems
There is no documentation other than the the comments in the multiplayer scripts and in the iMultiplay.h
In iDeathmatch.pog and iTeamdeathmatch.pog the server and client function blocks pretty clearly marked.
I don't even know what a lifecycle diagram is but I can share some knowledge with you on the event handeling.
Events are handled by the functions:
ServerOnUserMessage and ClientOnUserMessage.
They are basically just "case" switch that are triggered by the functions: iMultiplay.ServerSendUserMessage and iMultiplay.ClientSendUserMessage
Note that all 4 of those functions have the same arguments( int type, hsim sim, hsim sim2, string data )
the int type is the "case" no. sim and sim2 are Handles and "data" is a string that you can use or or set blank with "".
A few of the case numbers are reserved because they deal with events that are reported by flux or by imultiplay. Otherwise, you can add case numbers to create custom events.
An example event would be: You want do something with a player who is inside a jumpgate and let all the other clients know about it.
When the server range function has detected that a player is within 500 meters distance of the center of the jumpgate. The server range function would assign the name "500m_player" to the player in the proximity and then transmit the event by calling:
iMultiplay.ServerSendUserMessage( 50, 500m_player, none,"")
This is a custom event so I've chosen "50" as an arbitrary number for the case, "500m_player" is the servers handle for the player that was detected, "none" means no one else is involved in this message and "" means we don't need any additional string data this time.
iMultiplay then transmits the event to all the clients. Every client processes that message using it's own script function ClientOnUserMessage.
(The arguments here are the same, so 50 is the case no., sim is now the handle of "500m_player" and the other stuff is blank)
i.e the client runs down it's "case" list until it finds the number 50 and preforms the tasks defined in that case.
For example:
case 50:
{
// hide the sim that is in the jumpgate from all the other players
// while you "do_something" with it
if (iShip.FindPlayerShip() != iShip.Cast( sim )) iSim.SetHidden(sim, true);
if (iShip.FindPlayerShip() == iShip.Cast( sim )) do_something(sim);
break;
}
You can of course communicate events from any client to the server by calling iMultiplay.ClientSendUserMessage on the client. That is then processed by the ServerOnUserMessage function in the same way as described above.
You can't broadcast an event directly from one client to all other clients. Therefore, the ServerOnUserMessage case routine will usually (in addition to whatever else it does) include a message transmission to all the other clients ("feedback" to pass the word around).
That is done with iMultiplay.ServerSendUserMessage as described above.
I know it sounds complicated, but I hope that was understandable?
(A diagram of that process would be cool)
The reserved events I know of are:
case 1: triggered by the server when a new client enters the game
case 15: triggered by imultiplay when flux (client) detects an undock event and also used by the server to confirm the event
case 16: A client request to the server for a score update
case 99: used for some simple debugging on the server
case 202: triggered by either the client or the server when a remote link is establised or to confirm the link
case 203: same as above when the remote link is disconnected
case 204: triggered by imultiplay when flux (client) detects a docking event and also used by the server to confirm the event
Iwar2 Multiplayer Fan Site
In iDeathmatch.pog and iTeamdeathmatch.pog the server and client function blocks pretty clearly marked.
I don't even know what a lifecycle diagram is but I can share some knowledge with you on the event handeling.
Events are handled by the functions:
ServerOnUserMessage and ClientOnUserMessage.
They are basically just "case" switch that are triggered by the functions: iMultiplay.ServerSendUserMessage and iMultiplay.ClientSendUserMessage
Note that all 4 of those functions have the same arguments( int type, hsim sim, hsim sim2, string data )
the int type is the "case" no. sim and sim2 are Handles and "data" is a string that you can use or or set blank with "".
A few of the case numbers are reserved because they deal with events that are reported by flux or by imultiplay. Otherwise, you can add case numbers to create custom events.
An example event would be: You want do something with a player who is inside a jumpgate and let all the other clients know about it.
When the server range function has detected that a player is within 500 meters distance of the center of the jumpgate. The server range function would assign the name "500m_player" to the player in the proximity and then transmit the event by calling:
iMultiplay.ServerSendUserMessage( 50, 500m_player, none,"")
This is a custom event so I've chosen "50" as an arbitrary number for the case, "500m_player" is the servers handle for the player that was detected, "none" means no one else is involved in this message and "" means we don't need any additional string data this time.
iMultiplay then transmits the event to all the clients. Every client processes that message using it's own script function ClientOnUserMessage.
(The arguments here are the same, so 50 is the case no., sim is now the handle of "500m_player" and the other stuff is blank)
i.e the client runs down it's "case" list until it finds the number 50 and preforms the tasks defined in that case.
For example:
case 50:
{
// hide the sim that is in the jumpgate from all the other players
// while you "do_something" with it
if (iShip.FindPlayerShip() != iShip.Cast( sim )) iSim.SetHidden(sim, true);
if (iShip.FindPlayerShip() == iShip.Cast( sim )) do_something(sim);
break;
}
You can of course communicate events from any client to the server by calling iMultiplay.ClientSendUserMessage on the client. That is then processed by the ServerOnUserMessage function in the same way as described above.
You can't broadcast an event directly from one client to all other clients. Therefore, the ServerOnUserMessage case routine will usually (in addition to whatever else it does) include a message transmission to all the other clients ("feedback" to pass the word around).
That is done with iMultiplay.ServerSendUserMessage as described above.
I know it sounds complicated, but I hope that was understandable?
(A diagram of that process would be cool)
The reserved events I know of are:
case 1: triggered by the server when a new client enters the game
case 15: triggered by imultiplay when flux (client) detects an undock event and also used by the server to confirm the event
case 16: A client request to the server for a score update
case 99: used for some simple debugging on the server
case 202: triggered by either the client or the server when a remote link is establised or to confirm the link
case 203: same as above when the remote link is disconnected
case 204: triggered by imultiplay when flux (client) detects a docking event and also used by the server to confirm the event
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.
20 years 3 weeks ago #11860
by Joco
Replied by Joco on topic Multiplay and Star systems
Thanks heaps. That does help a lot. I will take that and start putting a diagram together for my own use. If it doesn't look like a complete pile of rubbish I'll make it available.
Cheers,
Joco.
Cheers,
Joco.
Please Log in or Create an account to join the conversation.
20 years 3 weeks ago #11862
by MajorTom
Replied by MajorTom on topic Multiplay and Star systems
Cool, A diagram would be great! Event handeling is key to the whole multiplayer game. In theory the technique used in EOC is probably pretty much the same as for any other MP game? ? ?
Maybe there are diagrams from other games that would be helpfull as a template?
Iwar2 Multiplayer Fan Site
Maybe there are diagrams from other games that would be helpfull as a template?
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.