Developers
andrew_taft
—
2016-04-12T14:50:01-04:00 —
#1
The "/design/versions/latest/rules/my-rule-name" route doesn't return the rank name for the levels. For example, if Level 1 is called "Level One", then levels[0].rank is showing up as "level_one", which I assume is the internal identifier rather than the name.
Also, I find the "/runtime/actions/action-name/play" return object to be very useful for my needs. The events.global object tells me if a new level has been reached, and even has the correct level name (rather than the internal id). For every action, I would really like the return object to also have the player's current level and amount to go until the next level so that I can display these on a message without having to make so many API calls. Is this something that can easily be added to the return object?
Thanks!
peter_john
—
2016-04-13T04:14:52-04:00 —
#2
Hi Andrew,
Yeah the internal levels[0].rank = "level_one" is the id of the state metric state so since you configured this level rule I think you you should have a state metric like this
{
"id": "Levels",
"contraints": {
"states": [
{
"id": "level_one",
"name": "Level One"
}
]
}
}
Our internal id's are basically the snake_case of your name's. You can use a un-snakeifier case or you have to fetch the /runtime/definitions/metrics to get all the metrics of the game and get the state metric and lookup with that.
The runtime action play you would have to read the player profile after every play or read it if there is a significant change as our rest api doesn't support that.
Its best that you read the /runtime/definitions/metrics on the start of the app and use that in Looking up the internal id's that's how our simulator is also created. You can see on opening the simulator it makes a lot of requests first to get the definitions.
We are working on a graphql API which would solve this issue but its still in the works and its going be the v3 api which will solve most of these use cases.
andrew_taft
—
2016-04-13T18:54:29-04:00 —
#3
OK, thanks. This makes sense. I'm just looking for ways to minimize the requests and simplify the code.