Network messaging on WZ2100
Network messaging on WZ2100
Hi.
I'm a computer science student and i am presently developing a framework for consistency maintenance on RTS games and want to apply it on WZ2100. As i am trying to figure out how the network communication occurs on Warzone 2100 i found two functions that deal with incoming messages: frontendMultiMessages(multiint.cpp) and recvMessage(multiplay.cpp).
Can anyone tell me what's the difference between the two and on what circumstances is each one used? Also can anyone tell me how consistency is maintained in the game and what functions should i look at.
I sorry for my english but i am portuguese.
Thanks.
I'm a computer science student and i am presently developing a framework for consistency maintenance on RTS games and want to apply it on WZ2100. As i am trying to figure out how the network communication occurs on Warzone 2100 i found two functions that deal with incoming messages: frontendMultiMessages(multiint.cpp) and recvMessage(multiplay.cpp).
Can anyone tell me what's the difference between the two and on what circumstances is each one used? Also can anyone tell me how consistency is maintained in the game and what functions should i look at.
I sorry for my english but i am portuguese.
Thanks.
Re: Network messaging on WZ2100
It is a mess. All the lower-level network functions are holed up in lib/netplay, while iirc recvMessage is the first layer of the higher level interface. Note that 2.3 and master have very different network code. In 2.3, entities are synchronized mostly by correcting errors after they happen, while in master code and frames are synchronized so that correction is not necessary.
Re: Network messaging on WZ2100
I'm working with the master code. Can you point me where should i be looking at (files/functions)? I assume that the file multisync.cpp is the one where all the magic happens. Thanks.
Re: Network messaging on WZ2100
During my research of the game code i've discovered the function sendQueuedDroidInfo (multibot.cpp), responsible for sending update messages about droids (or so i assume), however i'm having a hard time to discover where/how update messages are actually send to the remaining players.
Does each player send updates to all other players? Or does he send them to the host and the host is the one responsible for forwarding updates? If not, did this situation occurred in any previous releases?
Thanks.
Does each player send updates to all other players? Or does he send them to the host and the host is the one responsible for forwarding updates? If not, did this situation occurred in any previous releases?
Thanks.
Re: Network messaging on WZ2100
Everything goes through the host currently.
Re: Network messaging on WZ2100
Ok, but if the host receives the messages as any other player (recvMessage function on multiplay.cpp), how does the host redirect the update to every other player? Is there some routine that just the host runs? Where does this happen?
Thanks.
Thanks.
Re: Network messaging on WZ2100
The host sends any packet received from a player other than itself to all other players. It happens in lib/netplay/netplay.cpp
Re: Network messaging on WZ2100
Hi,
In some previous forum messages i've been informed that the host of a multiplayer session acts as the HUB, being responsible for transmitting messages between the clients. Although i've analyzed the netplay.cpp file on the NetPlay lib and found functions like NETprocessSystemMessage and NetSend that have specific cases for redirecting messages between clients, i've only found redirection of NET messages. However, i'm only interested to know where the redirection of GAME messages, like GAME_DROIDINFO messages, takes place.
Can someone help me with this situation?
Thank you.
In some previous forum messages i've been informed that the host of a multiplayer session acts as the HUB, being responsible for transmitting messages between the clients. Although i've analyzed the netplay.cpp file on the NetPlay lib and found functions like NETprocessSystemMessage and NetSend that have specific cases for redirecting messages between clients, i've only found redirection of NET messages. However, i'm only interested to know where the redirection of GAME messages, like GAME_DROIDINFO messages, takes place.
Can someone help me with this situation?
Thank you.
Re: Network messaging on WZ2100
GAME and NET messages are just the same, and rerouted at the same place.
Re: Network messaging on WZ2100
I thought that too but when i try to print the type of message the Host is going to redirect i just get 2 type: NET_PING and NET_SHARE_GAME_QUEUE. Thats why i thought GAME messages where handled else where. Can anyone explain to me how this works? I mean, are the GAME messages inside NET messages? How can i identify that a message being redirected is a GAME message?
I'm trying to intercept GAME messages the HOST must exchange between clients, so that a message only is redirected on demand.
Thanks
I'm trying to intercept GAME messages the HOST must exchange between clients, so that a message only is redirected on demand.
Thanks
Re: Network messaging on WZ2100
For which version of the game are you talking about ? As was mentioned above, 2.3.X and 'master' do things differently.
I am not sure I follow your redirect on demand question.
If the client needs to pass info to host, the host gets that message (whatever it is, a NET or GAME message), it processes it, and if needed, spits back the results to the original client, or all other clients, or a specific client.
I am not sure I follow your redirect on demand question.
If the client needs to pass info to host, the host gets that message (whatever it is, a NET or GAME message), it processes it, and if needed, spits back the results to the original client, or all other clients, or a specific client.
/facepalm ...Grinch stole Warzone contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.
Super busy, don't expect a timely reply back.
Re: Network messaging on WZ2100
I'm working on the master version (from 3 or 4 months ago). What i wanted to know is where, in the host code, do the messages that should get to the other clients (all clients or specific client), get redirected.
What i intend to do is applying an algorithm that will block, in the host, update messages that are no relevant for the gamestate of a client. The problem is i can't identify the code responsible for redirecting update GAME messages to clients. How can i block GAME messages that should be redirected by the host?
What i intend to do is applying an algorithm that will block, in the host, update messages that are no relevant for the gamestate of a client. The problem is i can't identify the code responsible for redirecting update GAME messages to clients. How can i block GAME messages that should be redirected by the host?
Re: Network messaging on WZ2100
Sadly the developer who improved this stuff and knows the most about it currently not available.
The code your looking for is at lib/netplay/*
The "broadcasting" works by "NETsend" (netplay.cpp), where this loop:
Sends data to every player if the param "player" was NET_ALL_PLAYERS.
Seems like that NetMessage has its "type" stored.
Also take a look at "NETbeginEncode" (nettypes.cpp), any message to compose gets initialized here.
I'm always at our irc channel #warzone2100-dev at freenode, don't hestitate to contact me there if you have more questions.
The code your looking for is at lib/netplay/*
The "broadcasting" works by "NETsend" (netplay.cpp), where this loop:
Code: Select all
for (player = firstPlayer; player <= lastPlayer; ++player)
{
Seems like that NetMessage has its "type" stored.
Also take a look at "NETbeginEncode" (nettypes.cpp), any message to compose gets initialized here.
I'm always at our irc channel #warzone2100-dev at freenode, don't hestitate to contact me there if you have more questions.
Nightly builds available here see buildbot for more infos about them
Lobby Server: here and here
SharpFlame the new WZ Map Editor
Lobby Server: here and here
SharpFlame the new WZ Map Editor
Re: Network messaging on WZ2100
I've been trying to understand, in the NETSend function, when the host is going to redirect certain GAME messages. The thing is, the type of messages i catch in this function are always NET messages: NET_SHARE_GAME_QUEUE or NET_SEND_TO_PLAYER, never GAME specific messages, even do i know other players receive them.
Does anyone know what i'm talking about? I'm a bit lost here.
Thanks
Does anyone know what i'm talking about? I'm a bit lost here.
Thanks