Jump to content
  • Advertisement
Sign in to follow this  
Zoultrex

Collision over the server

This topic is 2822 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im using a server for my game called Photon (http://photon.exitgames.com/) and I want to implement some basic collision for my space shooter game.
The game engine im using is Unity that has already some nice physics and collision for me but I really do not want to trust the clients, as always...

The server knows no information whatsoever about the collision, so far I only have some states for the players (speed,position,rotation etc) and now I want to implement the collision for the shooting, I dont need any other collision at the moment but I will definitely need some collision for the players with the enviroment (this I plan to do somehow together with the game engine)

I would like to hear from you guys what approaches can I look for to implement the collision detection over the server, something simple for now. Once I asked someone and I was told that I could even make the server read the meshes of the objects and work a collision detection somehow, I really dont think I want that because I think it could demmand too much processing from the server, right?!?

I was planning to start coding from scratch collision detection between projectiles and players by "boxing detection" where I would get the boundaries of both and disregard whatever shape they have but only try to get the general width, height and length, and try to do some comparison of their position + the dimentions, something like

if(player.x+10>=projectile.x||player.x-10<=projectile.x...)
But... things rotate, that is one problem already, and they are not even, their central pivot point can often be displaced.


I think you guys get the idea of the problems I can run into and I was wondering how is this generally done and if you guys ever had to code this by hand from scratch.

Thanks in advance ;)

Share this post


Link to post
Share on other sites
Advertisement
Well, server or not, collision detection works the same. If you want to spare the server of a lot of processing, you can make a hierarchical collision system. First, there is a general bounding volume to check against the projectiles for each player's model. If projectiles don't interesect those, go to the next volume. If however it intersects a bounding volume, you can go to the next step, which would be some approximation for the limbs of the player model, like a convex hull, and check against that. The convex hull would be bound to model's skeleton like the player skin is bound, so it always aproximates the current stance of the player model. That should do it.

Share this post


Link to post
Share on other sites
I have no idea as I never worked on such a thing before, but I'm working now and this is how I plan to implement it.

Share this post


Link to post
Share on other sites
I have posted the same question in the server developer forum and a user there recommended me to use an authoritative server to middle the collisions.
Its just basic a copy of the game that "can see" all the players and will tell the server when a collision happens.

If you are also using Unity, there is a feature that you can disable audio and graphics when you build, all you get is a console application, so I guess it could work out fine.

If I go with that approach I guess that I will have to make the players 1 step behind this "collision server" so everything happens at the same time for all, maybe this could work.

I would like to know what you guys have to say about that, is this a common approach? It would be great for me if this really works well as I dont have to code neither physics or mesh importers.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!