MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.68k stars 1.34k forks source link

OwnerEvent gets send to host + owning client #2548

Open oniatus opened 8 years ago

oniatus commented 8 years ago

The UniqueServerNames module sends an @OwnerEvent to a client after it connects to ask the client to enter a new name.

When hosting a game with another client, the event gets replicated to the remote client and also triggeres the hosting player, opening up the renaming dialog on the host, each time a player connects.

Switching the event filter on the client to REMOTE_CLIENT does not work because this will remove the renaming feature from the hosting player.

A simple fix would be to skip the local event if the event has been network replicated and was an @OwnerEvent but before submitting a PR some feedback for this behavior would be nice :)

There is also a similar problem when a client sends an @ServerEvent, the event will trigger on the client too. However this is less likely to cause an issue as the serverside event-handlers are registered as authority most of the time.

Simple check to reproduce/test the issue: Checkout the module, host the game with one player, rename the player, connect with a second instance -> the host gets also the renaming popup.

Cervator commented 8 years ago

Hey @oniatus - seeing the second commit to #2582 made me think about this one, specifically the second commit by @Josharias where he reacts differently based on authority status. Does that help?

oniatus commented 8 years ago

Not sure if this helps because it need to distinguish if the event target is the local client or a remote one.

In case one player hosts the game, he should still get the renaming popup for himself because he would be the authority too.

oniatus commented 7 years ago

Adding EventTests here, I used the module from time to time to drill down event quirks.