I have not been able to get working Index based spawning using coherence, so experience in a car racing game is… not good, because when we want to spawn cars at locations, then we aren’t able to do so, because we land on each other when two players play, alteruna is hard for car racing, other wise i would have used alteruna since it has spawn position based index, player 1 goes to spawn point 1, player 2 goes to spawn position 2 etc…
BUT COHERENCE, JUST JUST coherence can’t do that?? this is so sad
I thought coherence making multiplayer so simple, can’t do that??
If that’s the case, it’s easy! You just need a network entity that manages it. Whoever has control of that entity, they can just have some code like:
Have a list of starting positions
Have an index that starts at 0
Everytime someone joins, pick a new position from the list and move their car (or spawn a car for them) there. Increment the index.
Repeat
Now, who owns this manager entity and who owns the cars themselves depends on how you want to structure the game. For a competitive game with a server (we call them Simulators), it would be the server who does that, spawns the cars and retain authority on them.
For a more relaxed distributed-authority game, you could have one of the clients do this. The first one to connect also becomes the car-spawner. So they spawn cars, and then pass authority on those cars to the player who just joined. Imagine:
Client 1 joins. They take authority on the CarSpawner network entity.
Client 1 spawns a car for themselves at position 0.
Amazing i hadn’t thought of it like that, but i don’t know how to do it, and infact, i know little bit only about coherence yet, and that is: Coherence Lobby and Coherence Sync, so i need help in how to set it up.
Here is how i configure it:
first the scene loads up with a Carselection, where the user can select a car.
then click start, after that they come into a race scene where they have the option to make a room or join one, and then anyone can join it further causing cars to collide in each other causing cars to fly and become upside-down.
So i need help since i just started using coherence a few days back.
Anyway Thanks for the idea, but please reply for a solution
Don’t use lobbies for now. Just use Rooms directly. There’s a sample UI included in the package that makes connection trivial.
You can worry about lobbies later, once you’ve understood coherence more.
For the spawner, look into our Package samples. They are included in the Unity package (so in Package Manager). There’s one scene about spawning.
Also look at the First Steps demo. By reading through its docs it’s gonna make things easier.
The problem is with the different location spawning like you mentioned earlier in the 1st reply, and that is my problem, so can you list like steps for me to follow?
I am still not able to make this work, i tried to make it’s scene look like my scene, but i have no idea of what to do, since it is not working i would like a step by step.
i could show how i setup my scene, but please give me a step by step guide