As a Developer, I'd like it if there was a standard naming convention for replication and event callbacks in C++ code so that I don't get confused about what code will handle a particular event and I don't have to worry that the name of a C++ method will clash with the name of a BlueprintImplementableEvent method.
Conditions of Acceptance
Given I'm adding an event callback to a class (e.g., APF2PlayerControllerBase) and that event will need to be handled both in C++ code and Blueprint:
I'd expect there to be a standard naming convention I can follow for the event notification that:
Clearly communicates whether the code being called is implemented in C++ or Blueprint.
Guarantees no naming clash between the C++ event and Blueprint BlueprintImplementableEvent.
I'd expect to find that all existing event callbacks in the OpenPF2 and OpenPF2Playground code and Blueprints have been updated to follow the new naming convention.
Given I'm implementing a replication callback: I'd expect there to be a standard naming convention for replication callbacks so that they don't conflict with other types of event callbacks.
Conventions from Other Projects
The UE4 RTS project from Daedalic Entertainment has the following naming convention:
Replication callbacks: Appear to use a Received prefix (e.g., ReceivedPlayerOwner, ReceivedCurrentHealth,ReceivedContainer`, etc.).
C++ event callbacks: Appear to use a NotifyOn prefix (e.g., NotifyOnPlayerDefeated, NotifyOnBuildingPlacementStarted, NotifyOnIssuedOrder, etc.).
Blueprint event callbacks: Appear to use a ReceiveOn prefix (e.g., ReceiveOnPlayerDefeated, ReceiveOnBuildingPlacementStarted, ReceiveOnIssuedOrder, etc.).
Proposed Naming Convention
Replication callbacks: Use an OnRep_ prefix (e.g., OnRep_PlayerState, OnRep_EncActionPoints, OnRep_Party, etc.).
C++ event callbacks: Use a Native_On prefix (e.g., NativeOnEncounterTurnStarted, NativeOnEncounterTurnEnded, NativeOnModeOfPlayChanged, etc.).
Blueprint event callbacks: Use a BP_On prefix (e.g., BP_OnEncounterTurnStarted, BP_OnEncounterTurnEnded, BP_OnModeOfPlayChanged, etc.).
Dynamic Multicast Delegate UPROPERTY Properties: Use On prefix (e.g., OnOwnerChanged, OnEncounterTurnStarted, OnEncounterTurnEnded, etc.).
Rationale: This seems more consistent with what Epic does in several places of the engine itself.
As a Developer, I'd like it if there was a standard naming convention for replication and event callbacks in C++ code so that I don't get confused about what code will handle a particular event and I don't have to worry that the name of a C++ method will clash with the name of a
BlueprintImplementableEvent
method.Conditions of Acceptance
APF2PlayerControllerBase
) and that event will need to be handled both in C++ code and Blueprint:BlueprintImplementableEvent
.Conventions from Other Projects
The UE4 RTS project from Daedalic Entertainment has the following naming convention:
Received
prefix (e.g.,ReceivedPlayerOwner
,ReceivedCurrentHealth,
ReceivedContainer`, etc.).NotifyOn
prefix (e.g.,NotifyOnPlayerDefeated
,NotifyOnBuildingPlacementStarted
,NotifyOnIssuedOrder
, etc.).ReceiveOn
prefix (e.g.,ReceiveOnPlayerDefeated
,ReceiveOnBuildingPlacementStarted
,ReceiveOnIssuedOrder
, etc.).Proposed Naming Convention
OnRep_
prefix (e.g.,OnRep_PlayerState
,OnRep_EncActionPoints
,OnRep_Party
, etc.).Native_On
prefix (e.g.,NativeOnEncounterTurnStarted
,NativeOnEncounterTurnEnded
,NativeOnModeOfPlayChanged
, etc.).BP_On
prefix (e.g.,BP_OnEncounterTurnStarted
,BP_OnEncounterTurnEnded
,BP_OnModeOfPlayChanged
, etc.).UPROPERTY
Properties: UseOn
prefix (e.g.,OnOwnerChanged
,OnEncounterTurnStarted
,OnEncounterTurnEnded
, etc.).Rationale: This seems more consistent with what Epic does in several places of the engine itself.