What is the best way to make physics based melee combat authoritative? The combat system would be similar to Chivalry: Medieval Warfare or War of the Roses; where a player can swing an axe, sword or other type of weapon and then if the weapon hits another player, that other play takes damage. I was thinking of making it so that the client just sends an input to the server and the server simulates it and updates the players health, but this solution seems laggy; does anyone know a better way to do this?
Creating this is probably similar to making a FPS with authoritative bullet physics.
What am i using for my Isometric-Shooter:
Everytime a Player shoots, he calls an RPC (a function that will be executed by every connected player) that istanciate a bullet.
On every player i put a simple OnCollisionEnter function, that checks if the player hits a gameObject that has the tag “Bullet”…if so take damages.
I don’t know if this is the best solution, but i tried an online game with 10 people and everything worked fine…
Example Script:
//Checking Collisions with Bullets
void OnCollisionEnter(Collision col){
if (col.gameObject.tag == "Bullet") {
Debug.Log ("Took Damage");
if(photonView.isMine)
takeDamage(col.gameObject.name);
}
}