Hello everyone,
When a new player registers to our game, we want to adjust some things on the player's profile/data. I was wondering if 2 rules can cause a conflict?
These are the rules that I set:
- player_added_title. The purpose of this rule is that adding a statistic to the new player. So that I can track and remove fake accounts by using a segment. Here's the code:
var initExperience = { "PlayFabId": currentPlayerId, "Statistics": [{ "StatisticName": "Experience", "Value": 0 }] }; server.UpdatePlayerStatistics(initExperience);
- player_displayname_changed. The purpose of this rule is that checking if the player changed the display name once. If the player's experience statistic value doesn't exist or is equal to 0, that means the player is new and can change the display name. If not, then I ban the player. Here's the code:
var getStatistic = { "PlayFabId": currentPlayerId, "StatisticNames": ["Experience"] }; var getStatisticResult = server.GetPlayerStatistics(getStatistic); if(getStatisticResult.Statistics.length != 0 && getStatisticResult.Statistics[0].Value != 0) { // Ban player }
I have experienced before that starting times of rules (calling time) varies. We can't know when or which order the rules will be executed. In my code, one is updating a statistic and the other one is trying to read it. There's a possibility of running these 2 rules at the same time. My question is that can these rules cause a conflict in this order?
- Player logs in with Android device ID (since it's a new player, the API will create a new account)
- Player calls UpdateUserTitleDisplayName API to update their display name as soon as the account is created. (Basically, in the result callback of LoginWithAndroidDeviceID, the UpdateUserTitleDisplayName API is called).