Net Code for thousans of monsters

Blitz3D Forums/Blitz3D Programming/Net Code for thousans of monsters

Neochrome(Posted 2005) [#1]
I want to make a project that is a little like Doom2, but written by me :)

i want to make it so i can multiple players engage in a massive killing spree like in doom2... the problem i face is. there are alot of monsters in a room and the data needed to transmit is HUGE.

is there anyway i can these monsters efficiently tell the other gamers where they are with out having a massive data packet?


KuRiX(Posted 2005) [#2]
The Best way is to compress the data the maximum. Try to fit the positions x,y,z in a 2 byte integer or so.

For example:

If the monster can be in the x positions between 0 and 1.000 you can fit this in only 2 bytes.

xtotransmit = (Entityx(Monster)*1000.0) + 32767
Then you compress this with some IntToStr(value,2) function.

In the other side you make:
xreceived = (xrecv-32767)/1000.0

This is only a compression method. There are others, like having 2 integers in only one long integer.

P.D.: UDP has a maximum packet size, so do not send more than 1300 bytes in the same msg. But always try to send the maximum.

Good Luck!


Neochrome(Posted 2005) [#3]
man this is a bigger problem than i thought! hehe, how did doom2 do it!


Regular K(Posted 2005) [#4]
"But always try to send the maximum."

Why do you say that?


KuRiX(Posted 2005) [#5]
This only means that you should try to fill an udp packet rather than sending lot of mini udp packets.

If you need to send the information for 20 monsters, send it in the same message, not 20 messages.

Other solution is what Starcraft does. In Starcraft every message contains a synchronization number and the input. So the messages are very small and the game is the same on every machine if in the same frame the input is the same!. This is an incredible good idea but only works for some kind of games.

Perhaps Doom2 only sends the information of active monsters, not all. And if 30 active monsters you can send information for that in one message.


Neochrome(Posted 2005) [#6]
yupp thats my thinking too!

one big packet of monster data and only the monsters that are active. hmm you may be on to something there!
COOL i'll try that what the time comes :)


Vorderman(Posted 2005) [#7]
try this -
http://doom.wikicities.com/wiki/Doom_networking_engine


Storm8191(Posted 2005) [#8]
Hmm, that sounds like an interesting problem. What you might consider doing (this sounds a bit like that starcraft example idea), is making all the monsters run on the same AI code. If they all have the same surroundings as far as action variables go, all the monsters should behave exactly the same, across all PCs. You could possibly send only enough AI data for a monster to allow it to run without any further network input for a second or two (or much longer, perhaps). If this works correctly, the monsters should all behave the same on all systems. But I imagine, in reality, a few discreptancies will develop over time, and you'll have to re-update the monster AI data. Maybe you could handle this one monster at a time, and thus updating all monsters won't be a 1000-byte package to send.

Good luck. I'll be interested in seeing how things go, and what methods work.