UE3 - UDK Simulated Functions

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

storm33229

New Member
Jan 20, 2010
7
0
0
az
I'm trying to understand what simulated functions are and more importantly why they are used and why I should use them and when.

My search started with google and lead me to: http://wiki.beyondunreal.com/Legacy:Simulated_Function

This answered quite a few questions. However I'm still a bit confused on why this keyword is important to me and why I should use it...or not use it.

Why are there simulated functions?
Why should I use them (or not)?
When should I use them (or not)?

I don't want to waste your time, so if you'd rather link me to a solid explanation that would be wonderful as well.

Thank you for the help!
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
The point in using simulated functions can be derived directly from the meanding of that keyword: "Functions that are called in the context of an actor will not be executed if the Actor's local Role (not RemoteRole!) is less than or equal to ROLE_SimulatedProxy unless the function is declared as simulated or as native."

In other words, if you have a replicated actor and e.g. implemented the event Tick() in it, that event is always executed serversidely. Whether it is also executed on the client depends on the clientside Role (= the serverside RemoteRole) of the actor and whether the Tick() function is declared with or without the simulated modifier. Almost all replicated actors have the clientside role ROLE_SimulatedProxy, so they only execute functions that are declared with the simulated modifier.

Cases when using "simulated" would be pointless or redundant include classes not derived from Actor, static functions (no actor context in both cases!) and Actors spawned clientsidely (as opposed to spawned serversidely and replicated to a client), such as the HUD. Also, it is completely pointless to declare any functions "simulated" if the actor never leaves the server (e.g. GameInfo) or always has the role ROLE_AutonomousProxy on the client (PlayerController - only exists on the server and owning client).