Network messaging on WZ2100

Discuss the future of Warzone 2100 with us.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: Network messaging on WZ2100

Post by cajadas »

And where can i find this calculation in the source?
Cyp
Evitcani
Evitcani
Posts: 784
Joined: 17 Jan 2010, 23:35

Re: Network messaging on WZ2100

Post by Cyp »

Somewhere in src/move.cpp, I think.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: Network messaging on WZ2100

Post by cajadas »

Hey,

I've introduced a new type of message to be sent and received during game time. To do this i've added the message type to the MESSAGE_TYPES list (lib/netplay/netplay.h) between GAME_MIN_TYPE and GAME_MAX_TYPE. Additionally, i've created send and receive functions to treat the messages.

The messages are correctly exchanged but i keep getting this error message on the sender side:

Code: Select all

error   |05:24:51: [NETend] Inserting GAME_PLAYER_ZOC into net queue.
error   |05:24:51: [NETend] Assert in Warzone: nettypes.cpp:480 (message.type > NET_MIN_TYPE && message.type < NET_MAX_TYPE), last script event: 'everySec'
Any clue?
Thanks.
Cyp
Evitcani
Evitcani
Posts: 784
Joined: 17 Jan 2010, 23:35

Re: Network messaging on WZ2100

Post by Cyp »

Try printing the message type, to check it is really the one you put in?
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: Network messaging on WZ2100

Post by cybersphinx »

cajadas wrote:between GAME_MIN_TYPE and GAME_MAX_TYPE.

Code: Select all

nettypes.cpp:480 (message.type > NET_MIN_TYPE && message.type < NET_MAX_TYPE)
Have a look at the if condition this assert is in.
We want information... information... information.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: Network messaging on WZ2100

Post by cajadas »

I figured it out. I've printed the message type and verified that my message type is number 136, which is between GAME_MIN_TYPE and GAME_MAX_TYPE. However, i've also printed queueInfo.queueType expecting to get QUEUE_GAME but it was QUEUE_NET.

So i've changed my code so that instead of sending game to the host's net queue it would be sent to the game queue but instead of sending the message to the host, i just got a segfault :S

What is the difference between the queues and which one should i use?

EDIT: I've realised that every GAME message is sent to other client inside a NET_SHARE_GAME_QUEUE message, and only NET messages are sent though the network. To solve my problem i just changed my message type to NET_PLAYER_ZOC.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: Network messaging on WZ2100

Post by cajadas »

Can someone answer me some questions about the code?

1. When are secondary orders used? And what kind of secondary orders are there?
2. When i create a group or associate a droid to a group (Ctrl + number), are the group fields inside the DROID struct (psGroup, psGrpNext) refreshed? My guess is they are not. So how can i know what group does a droid belong to? (when there is one).
3. In what situations are GAME_STRUCTUREINFO messages sent? Are they still used in the master version?

Thank you.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: Network messaging on WZ2100

Post by cajadas »

I've started testing my implementation and realized the best way to test would be using bots. In the master version you can fill the player slots with AI bots but they will be running in the host machine and that is not what i'm looking for.

What would be really great is some sort of "multibots": Bots running in each peer machine. They don't have to be intelligent, just make a sequence of moves. One easy way to do this is passing orders to droids when the game starts and queue them so they would be taken in order, but in that time i don't have a clue how to identify a droid or structure.

Does anyone know a better solution? Has anyone used something like this before?

Thanks
Last edited by cajadas on 05 Oct 2011, 18:44, edited 1 time in total.
cajadas
Trained
Trained
Posts: 56
Joined: 01 Mar 2011, 17:33

Re: Network messaging on WZ2100

Post by cajadas »

I've been researching the a code and noticed that in the files e3demo some orders are given to droids by code. This is one way to achieve what i'm looking for but a better way would be to assign a bot to a player when the game starts.

Something like what is done when i fill a multiplayer game slot with a bot, but instead i fill with an actual player whos actions are given by the AI running in his computer.

Can anyone help me?

Thanks