Original Post
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 ;)
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 ;)