I am writting a real time game which contains Enemy AI I need write Enemy AI on server to send action( move, attack, .. ) to clients? or any way to do that? If i write Enemy AI on client? how to be authoritative enemy's actions?

  • 3
    \$\begingroup\$ Given the mmo tag, yes, the server handles enemy AI. Do you have a concrete problem you are having trouble to solve? \$\endgroup\$ – Theraot Jul 30 '18 at 4:53
  • \$\begingroup\$ i am using Photon Engine, i want to know some Physic engines which support move, collision, .. written by C# \$\endgroup\$ – Lenon Jul 30 '18 at 5:43
  • \$\begingroup\$ Odd you ask about a physic engine in a question about enemy AI. I suppose you have your reasons to want C#... I do not have any to recommend (heck, I do not even know if you want 2D or 3D or what sort of features you need). In fact, it is not rare that people who are not using a full blown engine (e.g. Unity3D) will spin their own. Asking for tools is off-topic in this site anyway. However, I am sure you can find a few if you search. \$\endgroup\$ – Theraot Jul 30 '18 at 6:12
  • \$\begingroup\$ Voting to close this as off topic because i want to know some Physic engines which support move, collision makes it sound like a software recommendation question. \$\endgroup\$ – Charanor Jul 30 '18 at 13:38
  • \$\begingroup\$ You can't write it on the client. The server needs to handle it and just send the data such as AI position, notification that it attacked etc. Nobody can tell you how to do that in your engine. \$\endgroup\$ – Joza100 Jul 30 '18 at 13:48

Enemy AI is one of those things which should always be handled on the server.

Remember that anything which happens on the client can be manipulated by a hacked client. If you let the client handle enemies, the client can just claim that the ultimate raid boss just committed suicide and dropped the rarest item in the game.

But even if you assume that all your clients play fairly (you can't), that you can just slap an anti cheat tool on it and it will fix any cheating problems (it won't) or that you can detect cheating heuristically (will cause you more problems than it solves), you still need to deal with synchronization problems. What do you do if multiple clients fight the same monster and they come to different conclusions about how the fight turned out? Due to network latency, this is quite likely to happen.

  • \$\begingroup\$ thanks, i see. so, i need a physic engine on server which support c# \$\endgroup\$ – Lenon Jul 31 '18 at 1:31
  • \$\begingroup\$ @Lenon When this answer answered your question, please accept it by clicking the checkmark-icon next to it. \$\endgroup\$ – Philipp Jul 31 '18 at 8:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.