Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement multiplayer support for minimap #10

Merged
merged 5 commits into from Aug 10, 2019

Conversation

@darshan3
Copy link
Member

commented Aug 6, 2019

How to test:
Connect using multiple players, you should be able to see each other's arrows on minimap when in range.


@ReceiveEvent //Spawn, initial spawn on joining a server
public void onPlayerSpawnEvent(OnPlayerSpawnedEvent event, EntityRef player) {
if (minimapHUDElement != null) {

This comment has been minimized.

Copy link
@skaldarnar

skaldarnar Aug 8, 2019

Is this null check really necessary? I guess due it being a system we cannot make the member final and initialize it in the constructor...
Can we live with the risk of it being null?

This comment has been minimized.

Copy link
@darshan3

darshan3 Aug 9, 2019

Author Member

Sometimes the minimapHUDElement is not initialized and players are already getting spawned This mainly happens when a client joins the game, so the spawn event for other players already in the game is called.

This comment has been minimized.

Copy link
@skaldarnar

skaldarnar Aug 10, 2019

what happens with the event in that case? will the respective player be added to the minimap in that case?


@ReceiveEvent
public void onAwaitedLocalCharacterSpawnEvent(AwaitedLocalCharacterSpawnEvent event, EntityRef player) {
if (minimapHUDElement != null && entityManager.getCountOfEntitiesWith(AliveCharacterComponent.class) != 0) {

This comment has been minimized.

Copy link
@skaldarnar

skaldarnar Aug 8, 2019

Again the question, do we actually need this check?

Done - changed star import to individual imports

@skaldarnar skaldarnar merged commit bf92a50 into master Aug 10, 2019

@skaldarnar skaldarnar deleted the Multiplayer branch Aug 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.