borrascador / rain

Demo for upcoming rainforest game.
https://borrascador.github.io/rain/
0 stars 1 forks source link

Remove NPCs from party #318

Closed amos1814 closed 5 years ago

amos1814 commented 5 years ago

Get rid of "NPC" field in party member list

Only player-controlled party members will be tracked. When a party member logs out, the following update will be sent:

{
   "payload": {"party": [{
      "status" : "offline"
      "id": int
   }]},
   "type": "UPDATE"
}

Similarly when a party member logs in

{
   "payload": {"party": [{
      "status" : "online"
      "yCoord": int,
      "yPos": int,
      "xCoord": int,
      "xPos": int,
      "id": int
   }]},
   "type": "UPDATE"
}
amos1814 commented 5 years ago

Also add a message in chat for logging in and out

borrascador commented 5 years ago

Thinking about it again, it seems that this issue is a good chance to talk about session end behavior more broadly. I suggest we build from this protocol for the following cases:

When any party member, player, or npc has health <= 0, then the server can send that player's "inventory" for looting, and block any further actions by that entity. This requires a looting UI and looting interface. A dead player may observe (receive real-time data) and chat and without exiting from the party, with a new "dead" status visible in the UI for other party members. If there is a resurrection ability, it can happen here because the player is still taking up their slot and observing. Being kicked out, logging out when dead, and exiting the party will disassociate the player from the party and open a slot for a new player to join. By the way, we could have an advanced feature later to ban kicked out players so they can't rejoin.

Anyway what do you think?

borrascador commented 5 years ago

One more thing, status is probably the wrong name for this variable. Can we do "online": bool instead?

borrascador commented 5 years ago

96b0324 includes changes that will show a player as offline if online: false and a player as dead if health <= 0. There is no handling of the npc field, so that can be removed.

After server has implemented online: bool, I will adjust the logic to check for online: true instead of false.

amos1814 commented 5 years ago

Change party generation

Old: Every party member is generated when party is created

New: Party member is generated upon joining a party

Max party size is 3 for now

borrascador commented 5 years ago

While you're at it, I found a bug where the current party member shows up as online: false, self: true while the leftover npc characters have online: true.

amos1814 commented 5 years ago

The avatar doesn't disappear when a player logs out. Should we make it so it does?

{
   "payload": {
      "messages": [{"text": "b has logged out."}],
      "party": [{
         "online": false,
         "id": 1
      }]
   },
   "type": "UPDATE"
}
borrascador commented 5 years ago

I made it so the avatar grays out to communicate offline status. The avatar is still there unless that party member is removed from the group.

borrascador commented 5 years ago

By the way I found a bug with the new implementation: if I am in a party and someone else joins or logs in, then the other player's data has self: true. The result is that multiple players have the red background which is supposed to indicate self: true.

borrascador commented 5 years ago

Overall this is a lot better though thanks :+1:

amos1814 commented 5 years ago

I'll fix that right now forgot about the self field