#[Local multiplayer] Creating a world for each player

1 messages · Page 1 of 1 (latest)

spiral violet
#

Hello! I am new in using DOTS and it will be a huge support if someone could help me with this issue please. I am creating a local multiplayer with DOTS and I thouhgt about this approach:

  1. creating a world for each player
  2. adding the systems for each player (input for example)
  3. creating the player entities in there

However, I am getting an error with instantiating the player. Could anyone help me please?

thank u in advance!

#

btw I call this code in this system:

lost zenith
#

Posting the error might help?

#

Though I suspect the error is from you trying to modify the player loop from within the player loop?

spiral violet
#

I get the error when creating the new entity of the player

#

with the playerWorld.EntityManager.Instantiate(playerEntity)

lost zenith
#

you still haven't said what the error is?

spiral violet
#

I am so sorry, it is a null reference

#

the thing is that I don't know if I should do a world per player, I am a bit confused here rn

#

In my mind I created one world for each player to call use an input system and a physics system

#

but I am not sure if I can do it in that way because of the physics

lost zenith
#

it depends on your network solution

#

and tbh your game

#

but you are adding a lot of overhead here having to simulate the world per player

spiral violet
#

Oh I see

#

the thing is it should also work with a local multiplayer

#

with Input System and gameobjects it's kinda easy to set it up to have two player inputs in one scene, each with a device (e.g. a P1 with keyboard and P2 with gamepad)

#

but I cannot picture the way to do it with ECS

lost zenith
#

just put a component on each player with their input asset?

spiral violet
#

and how can I set the device for each player?