Improbable Icon

A minor documentation (diagram) issue

docs-issue

#1

on https://docs.improbable.io/reference/13.1/shared/design/shooting
under “Visualising shooting” diagram. The first thing that CW1 sends might need to be not “Sends I hit something to P1”, but “Sends I shot at something to P1”. The hitting is (correctly) sent a bit later.

And thank you for improving the docs!


#3

Am I correct that the first part of this diagram is “abbreviated” a bit? It shows “sends command” but right after that shows all client and server workers “receives event”. Reading about commands and events differences… does it mean command gets to SW1 (the one with write access to P1), and SW1 can trigger an event based on it, and now all client and server workers get this event. I think the second part of this diagram (with “got hit”) shows that “command to event” flow?
Thanks!


#4

Good spot - you’re totally right that there’s a mistake here, that panel in the diagram should say that Client worker 1 “Triggers ‘I’m shooting’ event”, rather than a command.

I can see how this has caused confusion! As I think you’ve said, there’s a big difference between events and commands - an event is received by any worker or client who has the entity checked out, whereas a command is only received by the worker/client authoritative over the component.

Yes, the “got hit” part of the diagram shows how the event is going to go. Except, in the case of the “shooting” event, you don’t need to send a command to the server worker: saying “I’m shooting” doesn’t need any verification, because the only consequence is showing a shooting animation, so it’s fine for the client to trigger that event itself.

I’ll try to get the diagram fixed up!


#5

Thank you for the explanation!
I was wondering about if client can just use event or it has to issue command to SW1 and SW1 would issue event mostly because event can be triggered only by a worker with write access to a component. And SW1 has write access (authority) to at least some components on P1. But I guess client still has write access to some other component(s) on P1, and can trigger event on that P1’s component directly, right?
This is better anyway - avoids a trip to server for starting P1 local shooting effects/etc and can broadcast event to CW2/etc immediately.


#6

Yes - if the client has authority over the component that the event is in, it can trigger the event. And you’re right that avoiding the round trip to the server will speed things up.

Essentially, you need to send a command to the server-side worker when the action you want to take is something that only the server-side worker can do. But otherwise, the client can do it.