Skip to content

The IDs are not consistent between connected systems #315

@TobbetheStalker

Description

@TobbetheStalker

The situation is the following:

Both the Host and Clients systems is identical:
Player1 EntityID = 1
Player2 EntityID = 2
Ball1 EntityID = 3
Ball2 EntityID = 4

The way we update them over the network is by sending the update together with the ID of the entity.
Then when the client receives the packet, it will check the ID and do one of the following things:
if ID == 1
Player2->GivePacket()
if ID == 2
Player1->GivePacket()
if ID == 3
Ball1->GivePacket()
if ID == 4
Ball2->GivePacket()

untitled
The problem is that if we have a condition like this:
if (Player1 && Ball1)
//Do something

it will mean different things on other machines since the object that got moved on one system is not the one moved on the other system.

This is NOT that great of a deal currently since this only involves ONLY the Player1,Player2,Ball1,Ball2 variables in 'LevelState'. The only place we currently uses Fields is to change level between maps, and then the condition is only if both players is inside the field, which both will be on both systems.

NOTE: I only put up this issue to clear this up. If you still have question on what to or not to do, just come and ask me.

Metadata

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions