I am doing first-person game and I am wondering how would I go about doing multiplayer rendering of me to enemy. What I mean is how would I make the opponent see my entire character instead of floating hands with a gun.
Ok what I mean most first person only games you only use hands for model you do not use full 3d rendered model since it is more expensive in terms of animation to render model instead it is easier to only use hands however what I wanna find out if I am playing multiplayer and i see enemy in front of me how do i render full body of enemy instead only his hands
I canât tell you the specifics (Iâve not done net code in Unity yet), but I can give you some tips conceptually.
In multiplayer games, each client runs itâs own little simulation of the game world. It will check back with the server to make sure itâs version is correct, but each client is itâs own view of the world.
This means that, for other players, you treat them very similar to single-player enemies. The difference is that, instead of an AI, their actions are controlled via data sent from their respective client.
So, upon a client receiving the data pertaining to other players, you would instantiate a model/prefab/what-have-you that is a full body representation of the player. You then control that with the data youâre getting from the other clients.
I guess, think of multiplayer matches less like everyone meeting in the same conference room and more like everyone sitting in their own conference room, with everyone else represented in each conference room by a telepresence robot.
Thatâs easy, youâd just have to check if the playerâs networkview is his own, if not, use another model.
in code that would be something like this :
//This is different from the one below!
var Mine : boolean;
function Start (){
if( networkView.isMine ){
Mine = true;
}else{
//This part can be excluded but for learning purposes, it's good to have
Mine = false;
}
}
So now, when you start the game, the player object should check to see if it is mine with âif( Mine )â , if yes, use first person animation/mesh , if not ,use third person animation/mesh.
So now, when you start the game, the player object should check to see if it is mine with âif( Mine )â , if yes, use first person animation/mesh , if not ,use third person animation/mesh.