I have a project that is a single player game.
- On play asteroids are spawned programmatically with a Job.WithCode()
- I can hit space bar to trigger my InputSpawnSystem to spawn my player
- Once I have a player I can then spawn bullets by hitting space bar
- Once I have a player my InputMovementSystem takes in WASD to adjust the PhysicsVelocity on the player
All is fine and this boring simple game is working.
I added NetCode to my project.
Now (as expected) I have “Server World” and “Client World” instead of “Default World”.
I have not made any adjustments to the project so there is no Ghost Collection yet and no GhostAuthoring components, so there should be no networked objects.
I hit play and…
- The asteroids spawn
- I hit space bar and can spawn my player
- I hit space bar again and can spawn bullets
- When I used WASD the player does not move (?!).
I understand “NetCode is an authoritative server predicted-client model, you need to make inputs commands and send them to the server which will act on the ghosted objects, what you are doing is not the correct implementation”, yes for sure, totally agree.
BUT, I want to really understand DOTS and NetCode and how it works and I am absolutely stumped why if I have “Server World” and “Client World”. And there are no ghosted entities. And no “server only” or “client only” systems. Why I am able to spawn a player and bullet entities, but cannot adjust the PhysicsVelocity on these entities.
This type of “input does not result in action” error I would expect to be if it was a ghosted object and I was trying to control a server-owned entity, but there is no ghost collection yet.
It seems like I should be able to so it is revealing that there is some glaring misunderstanding.
EDIT
The InputMovementSystem is definitely running. I am able to adjust the rotation of my player using the mouse.
Literally only updating the PhysicsVelocity does not work when adding the NetCode package.
I am wondering if there is some type of logic that is along the lines of “if running DOTS physics and running NetCode, then changes in PhysicsVelocity can only be executed by the server”?
( @timjohansson ?)