Opened 12 months ago

Last modified 5 months ago

#6804 assigned defect

Chat commands should only be sent to the relevant players.

Reported by: Stan Owned by: phosit
Priority: Must Have Milestone: Alpha 27
Component: Network Keywords:
Cc: Patch: Phab:D5061

Description

Currently all commands are sent to all players, even the player sending them. See Phab:D4775.

For most commands this is intended as you need them to get the correct state. Chat commands however should only be sent to the relevant players.

I believe it should go as follows:

  • Observer chat messages should only be sent to other observers. See also: #5816
  • Ally message go to allies
  • Enemy messages go to everyone you're not allied or neutral with
  • Global message go to everyone.

This ticket does not cover the fact the server will receive all the messages, which would ideally be fixed by having dedicated trustworthy servers see Phab:D3973 and be encrypted see: #5467

Notice that the network code will somehow have to keep track of diplomacy changes, and this needs to be done carefully.

Change History (6)

in reply to:  description comment:1 by Itms, 12 months ago

Component: Core engineNetwork
Milestone: BacklogAlpha 28
Priority: Should HaveMust Have

Replying to Stan:

Notice that the network code will somehow have to keep track of diplomacy changes, and this needs to be done carefully.

I don't think so. Currently, diplomacy-dependant chat works like this:

  1. a client sends a chat command to the server
  2. the server relays it to everyone
  3. each client determines, using simulation data, whether to display the chat message (this can be modded and used to cheat)

A fix to this ticket should change the design to the following:

  1. a client wants to send a message, and it determines, using simulation data, who the recipients are
  2. the client sends the chat command to the server, and the command contains the list of recipients (this could be an optional field, to preserve the previous "broadcast to everyone" behavior by default, and this default behavior can be improved with an adapted version of Phab:D4775)
  3. the server relays it to recipients only
  4. each recipient displays it

This design change doesn't require the network to be aware of the diplomacy. It is an involved change that will need rewriting a bit of code, but the bulk of the changes will be limited to:

  • adding the recipients system to the network code
  • moving the moddable logic from the receivers to the sender

comment:2 by Stan, 12 months ago

Indeed that's a better design. I suppose one could change post network commands to accept either a list of players or a playermask (I think we use that somewhere else?)

  • -1 => INVALID_PLAYER => All players
  • 0000 0001 player 1 etc
  • 0000 0010 player 2 etc
Last edited 12 months ago by Stan (previous) (diff)

comment:3 by phosit, 12 months ago

Would the "list of recipients" only be inside chat-messages or (optionally) in all messages-types?

comment:4 by Stan, 12 months ago

I suppose all messages could have it. For instance map ping is not a chat command, yet you don't want to send it to players that are not either observers or allies.

comment:5 by Stan, 11 months ago

Milestone: Alpha 28Alpha 27

Push back

comment:6 by phosit, 5 months ago

Owner: set to phosit
Patch: Phab:D5061
Status: newassigned

Whith this patch the server sends messages from the chat dialog only to the adressee and to the client who sent it.

Note: See TracTickets for help on using tickets.