1
\$\begingroup\$

This a followup to my previous question: How to implement physics and AoE spells in an MMO game?.

There, we concluded that all physics have to be done on the server, and that I should use cylinders for calculations.

Now, how can I check for collision detection on a ground-to-player basis on the server? It's fairly easy if the ground is a flat space, I just check if the player's z coordinate is lower than some value and voila, but, what if the map/ground itself is a model? How do I know where hills are on the server-side? How do I know when object collisions happen?

I'm using node.js and socket.io.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Does the exact height of the player have an influence in the outcome? If it has not, there's no need to do it (precisely) on the server, you can use a simplified model of the terrain (simple triangles for instance) for a quick cheat check, but ultimately let the client handle the exact height that will be displayed to the player. Small visual discrepancies might appear, it's up to you to decide if that a tradeoff (accuracy vs performance) is acceptable or not in you case.

Whatever solution you use (full or simplified terrain), some model of the terrain must exist on the server side, there's no way around that. If you're not using a physics engine, and plan to do the calculations yourself, this question might be a good starting point (you can assume the player/object position is a single point - the bottom center of its bounding cylinder - and to detect whether or not it collided with the floor between two frames, check if the point remains in the same "side" of the plane right below it).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .