Network messaging on WZ2100

Discuss the future of Warzone 2100 with us.

Network messaging on WZ2100

Postby cajadas » 07 Apr 2011, 17:04

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.
cajadas
Trained

 
Joined: 01 Mar 2011, 16:33

Re: Network messaging on WZ2100

Postby Per » 08 Apr 2011, 09:33

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.
Per
Warzone 2100 Team Member

 
Joined: 03 Aug 2006, 18:39

Re: Network messaging on WZ2100

Postby cajadas » 12 Apr 2011, 23:39

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.
cajadas
Trained

 
Joined: 01 Mar 2011, 16:33

Re: Network messaging on WZ2100

Postby cajadas » 24 May 2011, 18:36

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.
cajadas
Trained

 
Joined: 01 Mar 2011, 16:33

Re: Network messaging on WZ2100

Postby Per » 24 May 2011, 22:52

Everything goes through the host currently.
Per
Warzone 2100 Team Member

 
Joined: 03 Aug 2006, 18:39

Re: Network messaging on WZ2100

Postby cajadas » 25 May 2011, 01:06

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.
cajadas
Trained

 
Joined: 01 Mar 2011, 16:33

Re: Network messaging on WZ2100

Postby Per » 25 May 2011, 17:59

The host sends any packet received from a player other than itself to all other players. It happens in lib/netplay/netplay.cpp
Per
Warzone 2100 Team Member

 
Joined: 03 Aug 2006, 18:39

Re: Network messaging on WZ2100

Postby Buginator » 27 May 2011, 02:41

The host is the hub of all network traffic.
and it ends here.
Buginator
Special

User avatar
 
Joined: 04 Nov 2007, 01:20

Re: Network messaging on WZ2100

Postby cajadas » 14 Jul 2011, 07:20

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.
cajadas
Trained

 
Joined: 01 Mar 2011, 16:33

Re: Network messaging on WZ2100

Postby Per » 14 Jul 2011, 08:07

GAME and NET messages are just the same, and rerouted at the same place.
Per
Warzone 2100 Team Member

 
Joined: 03 Aug 2006, 18:39

Re: Network messaging on WZ2100

Postby cajadas » 14 Jul 2011, 16:00

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
cajadas
Trained

 
Joined: 01 Mar 2011, 16:33

Re: Network messaging on WZ2100

Postby vexed » 17 Jul 2011, 06:21

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.
/facepalm ...Grinch stole Warzone🙈🙉🙊
vexed
Inactive

User avatar
 
Joined: 27 Jul 2010, 01:07

Re: Network messaging on WZ2100

Postby cajadas » 18 Jul 2011, 12:47

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?
cajadas
Trained

 
Joined: 01 Mar 2011, 16:33

Re: Network messaging on WZ2100

Postby Fastdeath » 18 Jul 2011, 15:25

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:
Code: Select all
      for (player = firstPlayer; player <= lastPlayer; ++player)
      {

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.
Nightly builds available here see buildbot for more infos about them
Lobby Server: here and here
Fastdeath
Regular

User avatar
 
Joined: 16 Jan 2010, 07:52

Re: Network messaging on WZ2100

Postby cajadas » 20 Jul 2011, 02:59

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
cajadas
Trained

 
Joined: 01 Mar 2011, 16:33

Next

Return to Development

Who is online

Users browsing this forum: No registered users and 5 guests