RaiseEvent vs RPC on local client

Options
I noticed that when using RaiseEvent the event is always sent via the server to all target clients(including the sender itself) where as RPC allow you to choose whether or not you want to send it via the server for all clients or only for other clients(instantly receive your own RPCs)

Is there a way to have RaiseEvent bypass the server and send directly to the local client where applicable?

Answers

  • Allough
    Options
    I actually haven't done much with anything other than the Turnbased SDK yet, but I'd imagine that you have a structure something like:

    1. Client raises event via some function SendAttackEvent()
    2. OnEvent() { DoSomethingWithAttackEvent();}

    You could modify it a little like this:
    1. SendAttackEvent() { RaiseEvent(); DoSomethingWithAttackEvent();}
    2. OnEvent(){ DoSomethingWithAttackEvent();}

    Use RaiseEventOptions to make sure that the event is sent to Others only.
    Then your method is triggered right away locally, and triggered on the others when it reaches them via the server.