• 0 Votes
    1 Posts
    147 Views
    No one has replied
  • 0 Votes
    2 Posts
    156 Views

    Hello! Thanks for your inquiry.

    The format of this response has been used for several years so to change it at this point would cause many errors for our clients. However, in situations like this, we have included the JsonFx library to help deserialize dynamic JSON objects with.

    One way to deserialize the JSON items would be to include a DeserializeItems(string) method in your Data class to be able to store them in an array using JsonFx's JsonReader.Deserialize(string) method:

    public List<Item> Items = new List<object>(); public void DeserializeItems(string jsonResponse) { var response = JsonReader.Deserialize<Dictionary<string, object>>(jsonResponse); var data = response["data"] as Dictionary<string, object>; var items = data["items"] as Dictionary<string, object>; foreach (Dictionary<string, object> item in items.Values) { var newItem = new Item(); newItem.itemId = (string)item["itemId"]; newItem.defId = (string)item["boost_rapidfire"]; newItem.quantity = (int)item["quantity"]; // etc... Items.Add(newItem); } }

    Alternatively, you can also use JsonFx's JsonWriter.Serialize(object) method in the foreach loop to then be able to use Unity's JsonUtility to automatically map it as an Item.

    Understandably, both methods have their own pros and cons. However, it should be able to get the job done in this case.

    Hope this helps! Please let us know if you have further questions or inquiries about this.

  • 0 Votes
    5 Posts
    199 Views

    @Paul-Winterhalder said in Async match without opponent:

    Hi,

    brainCloud currently offers two forms of matchmaking:

    Offline matchmaking - for async match (i.e. words with friends) or one-way multiplayer (i.e. class of clans) style games. Both of those multiplayer types require you to have an opponent to play against when the match starts.

    There is also online matchmaking - which uses our lobby system - which is suitable of any online / real-time sort of multiplayer.

    (That one doesn't require you to have an opponent in mind when the lobby starts... and the lobby can start a match via a relay or room server session right away...)

    That said - I get the feeling that you are talking about more of an async match scenario (i.e. not-necessarily-online multiplayer) - where the match can start before an opponent has been identified.

    Am I correct that that is the scenario you are wanting to target?

    It's an interesting approach - as there's a much lower chance of matching against another player who isn't going to respond in a timely manner.

    Let me know if I've got the scenario right and we'll give it some more thought...

    Paul.

    Hi Paul,

    Yes, you are correct. When a user starts a new game, it'd essentially see if someone has already started a game but has no opponent, If a match is found the second player will be added to the game and can then make their move. If no match is found that is awaiting a player, it'll create a new game, let player 1 make their move and then go "dormant" until a player two is ready.

    If you have ever used the turn based aspect of Apples Game Center turn based service, this is essentially how that works.

  • 0 Votes
    1 Posts
    116 Views
    No one has replied
  • 0 Votes
    2 Posts
    126 Views

    Call AttachUniversalIdentity() method from client lib, the username is uniqueness enforced.

  • 0 Votes
    1 Posts
    118 Views
    No one has replied
  • 0 Votes
    1 Posts
    129 Views
    No one has replied
  • 0 Votes
    5 Posts
    293 Views

    Hello Gavin and Andreas, apologies for the late response. Could you give more information to reproduce the crash you're experiencing in iOS? I've attempted to reproduce the crash and 202 error and I wasn't able to. For these cases versions are important so if you could provide the Unity Engine version, iOS version, and what iPhone device used to test with.

  • 0 Votes
    2 Posts
    125 Views

    To limit operations like IncrementExperiencePoints() to cloud code only. This will essentially take away the ability to make these calls from the bare client API. You can see a script that enforces these restrictions here - https://getbraincloud.com/apidocs/cloud-code-central/handy-cloud-code-scripts/restrictclientcalls-script/

    Refer to another post below for more strategies you can apply to prevent cheating: https://forums.getbraincloud.com/topic/23/discussion-strategies-to-prevent-cheating-in-tournaments

  • 0 Votes
    2 Posts
    56 Views

    I downloaded the BrianCloud plug in for Unreal Engine, I can integrate user authentication, and real-time chat between connected players in a day.

  • 0 Votes
    4 Posts
    158 Views

    Hi Chris,

    User entities are primarily indexed by profileId + entityType - so the singleton API will scale well no matter how many players you have.

    That said, if your use case gets more complicated, with say hundreds of entities of a particular type per user (say maybe you are modelling user created towns, that sort of thing) - you could consider using Owned Custom Entities instead. You can define addition, custom indexes for those... keeps those lookups fast and efficient.

    In addition, if you end up having >1000 Global Entities, you should definitely look at switching to Unowned Custom Entities. Same deal - you can define your own custom indexes...

    Hope that helps!

    Paul.

  • 0 Votes
    3 Posts
    195 Views

    @Henry-Smith said in Recommended way to read Entity data? (Unity, C#):

    Sorry to bring back an old thread, but I'm just learning the platform and I thought I'd share my solution to this.

    First, define a generic class to handle the raw json response data:
    eg. my Tut1_AddTwoNumbers api returns:

    {"data":{"response":{"answer":24},"success":true},"status":200} public class Response<T> { public ResponseData<T> data; public int status; } public class ResponseData<T> { public T response; public bool success; }

    Then for each api call that you have, define a class that contains the fields that are custom to that response.

    public class Tut1_AddTwoNumbersResponse { public int answer; }

    Now, you call your function and handle the response like this:

    public void Tut1_AddTwoNumbers() { string scriptName = "Tut1_AddTwoNumbers"; // Anonymous object to supply the params. var data = new { num1 = 16, num2 = 8 }; var jsonScriptData = JsonWriter.Serialize(data); SuccessCallback successCallback = (response, userdata) => { var responseObject = JsonReader.Deserialize<Response<Tut1_AddTwoNumbersResponse>>(response); //var responseObject = JObject.Parse(response); Debug.Log($"Success The answer is '{responseObject.data.response.answer}' | raw_json={response}"); }; FailureCallback failureCallback = (status, code, error, userdata) => { Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error)); }; // Call the script _bc.ScriptService.RunScript(scriptName, jsonScriptData, successCallback, failureCallback); }

    this line is the important part:

    JsonReader.Deserialize<Response<Tut1_AddTwoNumbersResponse>>(response);

    Hope that helps someone!

  • 0 Votes
    1 Posts
    38 Views
    No one has replied
  • 0 Votes
    2 Posts
    58 Views

    Hi,

    This is easily doable in brainCloud.

    Just go to Design | Custom Config | Files in the Design Portal - and use the Global Files (formerly S3 service) to download the files to your app.

    Hope that helps!

    Paul.

  • 0 Votes
    20 Posts
    448 Views

    @David-St-Louis-0 @Paul-Winterhalder
    Hi again.
    I would like to debug my server locally, in Unity. I have the _S2S stuff all hooked up as described in the walk through.
    But then I tried to do the following (actual numbers redacted)

    #if UNITY_EDITOR var appId = "00000"; var serverName = "MyServerName"; var secret = "00000000-0000-0000-0000-000000000000"; _lobbyId = "00000:myLobbyTypeId:00"; #else // Load environment variables passed in by brainCloud to our container var appId = Environment.GetEnvironmentVariable("APP_ID"); var serverName = Environment.GetEnvironmentVariable("SERVER_NAME"); var secret = Environment.GetEnvironmentVariable("SERVER_SECRET"); _lobbyId = Environment.GetEnvironmentVariable("LOBBY_ID"); #endif

    However, I am getting a perpetual error:
    #S2S S2S Failed: {"packetId":1,"messageResponses":[{"reason_code":40613,"status_message":"Processing exception: Unrecognized lobby: 00000:myLobbyTypeId:00","status":400}]}

    I even signed up for a Dev+ subscription, just in case that was the problem, per this thread. No luck.

    How can I test my server code locally, while still planning for the full-on S2S Docker container deployment?
    Thanks

  • NodeJS setup question

    Unsolved APIs
    6
    0 Votes
    6 Posts
    230 Views

    Thanks @Paul-Winterhalder and @David-St-Louis-0 . I'm communicating with our web dev and am passing on the information to him. I'll respond here once I get more information from him. Appreciate the quick replies.