Jump to content


Monsters, clientside/servside and syncing?


3 replies to this topic

#1 HolySheepy

    New Member

  • Members
  • Pip
  • 1 posts

Posted 03 January 2008 - 10:42 PM

Hi,

(I dunno if it's better to put this into AI section or here, but since its more about lag, security and transfer i put it here)

so that online game has monsters, fully calculated servside(aggro, attacking, getting damage).
Now there are many players and many monsters, the problem is that the monsters(server) get kinda laggy from time to time.. well now for my question:

building a monster ai/controlling, what would you do clientside(calculated/processed at the computer of the players) or serverside(calculated/processed on server)? And how would you sync it... And if anyone has experience there(maybe, haha...) how do the big mmo's do it?(well, I guess their servers are better so they can do it fully serverside)

#2 onyxthedog

    Senior Member

  • Members
  • PipPipPipPip
  • 467 posts

Posted 04 January 2008 - 01:19 AM

HolySheepy said:

Hi,

(I dunno if it's better to put this into AI section or here, but since its more about lag, security and transfer i put it here)

so that online game has monsters, fully calculated servside(aggro, attacking, getting damage).
Now there are many players and many monsters, the problem is that the monsters(server) get kinda laggy from time to time.. well now for my question:

building a monster ai/controlling, what would you do clientside(calculated/processed at the computer of the players) or serverside(calculated/processed on server)? And how would you sync it... And if anyone has experience there(maybe, haha...) how do the big mmo's do it?(well, I guess their servers are better so they can do it fully serverside)
I am by no means an expert on this or any where near it and I am a beginner game-programmer, but everything I have read says do the calculations server-side. Just about anything client side can and, if the game gets popular, will be hacked!

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 04 January 2008 - 10:21 AM

Yes, make the server the ultimate authority on everything, but you can give the client a full copy of all the monsters' AI code as well, so they can predict what the monster will do and reduce the visibility of lag. However, the server should send update messages about the state of all entities (including monsters) and if the client finds that its local copy of the monster is out of sync, it just has to replace it with the server copy.

One potential wrinkle is dealing with random number generation. If the monster AI involves randomness, you'll need to ensure the client and server RNGs generate the same numbers for the monster. One possible way to do this is give each entity its own RNG and make its state part of the entity's state, so it will be part of the update messages.
reedbeta.com - developer blog, OpenGL demos, and other projects

#4 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 482 posts
  • LocationNowhere whenever

Posted 04 January 2008 - 11:56 AM

Also be wary of floating point calculations. Different hardware calculates floats differently!

Even the same hw does float calculation differently depending on fpu states, (and graphics libraries (opengl, d3d) tend to change that) as well as the clib implementations, but that's only an issue if you want to do cross-platform multiplayer games..

PC timers also run at slightly different speeds, which can be rather surprising when doing the sync code.
http://iki.fi/sol - my schtuphh





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users