Improbable Icon

Specify Command response destination

12-2

#1

Hi!

I want to be able to receive a response on a different worker than the one who issue the command.

When you send a command you target an entity’s component but the response is sent directly to the worker who sent the command.

What if you could specify where to sent the response.

egg. UnityWorker(entity A) send command to entity B component X. CustomWorker1 authoritative on component X(entity B) then sent the response to entity A for any worker with attribute K.

Just an idea I had, probably way too complicated for what its worth.


#2

I think it’s a worthwhile idea. Sometimes you want commands to be issued as if from an entity (e.g. a player opening a door) with the response being intended for the entity (e.g. you can’t open that door, it’s locked). If the entity moves to a different worker by the time the command response comes back, the worker that originally send the command ends up saying to itself, “Well the player asked me to open the door, but it’s locked. I should let him know. Now where did he run off to?” and he has to send that information to the player a different way.

I can think of two workarounds:

  1. The command includes the EntityId of the player. When the door worker responds to the command, it sends the EntityId back. When the player worker receives the response, if the player is no longer on this player worker, the worker sends a command to the player (using the EntityId) to tell him the door was locked.
  2. The command includes the EntityId of the player, and instead of being a “try to open this door” command, it is a “try to open this door and let this entity know what happens” command. As part of processing the command, the door worker sends a command to the player letting him know whether the door was locked (which reaches him on whatever worker he is on now). The player worker that sent the original command can just drop the response it gets on the floor and carry on.

#4

I did not thought about when an entity switch worker but yes it would be cool to not skip a command response.