Hello my name is john and i have been developing a multiplayer raceing game i got 2 problems
1)i don’t know when I’m soposed to spawn my server and the client
2)if i spawn the player the player useing a start function i get control of the other player car…i tried useing networkView.isMine function but it’s just blocking my whole car script…
You can spawn the player right when the client connects or server initializes (if the server is a player). You would probably want new clients to get up to speed, receive all updates etc before spawning themselves. You could also do a setup phase where everyone connects and then when everyone is connected and set up they spawn.
You could modify your car script so that Network.isMine only controls if the user input is handled, all other code is still active. If it is owned by another player then updates will come over the network and all local input should be ignored.
function FixedUpdate () {
if (networkView.isMine)
QueryAndHandleUserInput();
HandlePhysics();
UpdateWheels();
UpdateAudio();
}
that doesnt work…i wanted to use raknet but someone told me(dont remember who) to use the unity master server(didnt understand that) but i found a good tutorial on youtube about the game lobby multiplayer and stuff but the lobby script isnt full, have a look at it and if u can finish it somehow…
P.S. the script gives most errors because of other scripts missing or maybe a few whrong whrute coding