question

martinliu1993 avatar image
martinliu1993 asked

Implementing complex skill trees and branches

So we are looking at implementing the skill trees/branches portion of our game. Our skill tree will look pretty similar to Skyrim's skill tree. Basically, we may have a few classes of skills (2 handed heavy, 1 handed heavy. etc....), and for each skill tree, there may be an arbitrary amount of branches that players can allocate skillpoints towards.

To make this situation even more complicated, we may have crossed skills across branches. Let me draw a graph and illustrate. (Forgive my crappy drawing)

There are 3 Skill trees (A,B and C), and yet there are arbitrary amount of skill branches with skills crossing between branches, and for each skill (node in the graph) within the skill branch, players can assign a set amount of points to each skill from a common pool of points players gain on level up.

For a skill based system as complicated as this, is this implementable in PlayFab? How much of this can I implement in PlayFab while maintaining as much scalability and maintainability as possible without the need to hardcode everything?

capture.png (22.1 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

I'm not sure exactly what you're referring to, in terms of implementation. There isn't a built-in skill system in PlayFab that you would use for this, but you could fairly easily define the skill system in Title Data or as static data in Cloud Script, and then use Cloud Script calls to validate the players' choices when they level up. You would store the player's current save state in player data (specifically, UserReadOnlyData), so that there's no way for the player to cheat those values (since only a server-authoritative call could update them).

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

martinliu1993 avatar image martinliu1993 commented ·

What I want is a map structure basically. I am looking for some advice as to how to implement this on PlayFab. It seems that on PlayFab using the player data, you are only allowed 1 layer of data. Suppose I have skill A, with subskills A-1, A-2, A-3 and so on to be unlocked in order, does that mean I have to create one type of player data for each subskill? I would like to create that more dynamically because what if the amount or types of those subskills changes?

Again, I'd like to refer back to the skill tree I drew in my original question. For each skill tree, there are subskills within that tree that can unlock other subskills. if A and B are branches, A-1 skill can unlock B-2 skill for example. How would I express that relationship in PlayFab in a scalable way? I can just add a ton of player data from A-1, A-2 all the way to A-10, and perhaps also B-1 all the way to B-10. But that's hard to scale.

Does PlayFab offer something extra to handle what I just described above? Or am I stuck using simple 1 level player data structures? Does PlayFab support something like a graph or a map to better support the skill trees I drew above?

0 Likes 0 ·
brendan avatar image brendan martinliu1993 commented ·

Personally, I would put the map of all skills in Title Data. I'd likely put it in as one map of all skills, but you could break it down by major areas, if you really wanted to break it up. If the only place I then needed to use that mapping was Cloud Script, I'd probably just move it to static data in my script, so that I could use it for validation in my handlers.

But ultimately, I would save the player's unlocked skills in UserReadOnlyData, for the reasons above. Player data is a simple string/string key/value pair, though we will be supporting arbitrary file upload in the near future. But from my experience, I'd just store the player's unlocked skill state in a JSON object, with all the unlocked skills noted. The Title Data (or Cloud Script static data) would be where I would have all my dependency data, since you need that to be global for purposes of checking everyone the same way.

But put another way - the player data structures are generic string/string right now. You can put any representation of data in that you like.

0 Likes 0 ·
martinliu1993 avatar image martinliu1993 brendan commented ·

Hey Brendan, can you go into a bit more detail of what you mean? I don't completely understand

I would imagine Skill A, Skill B and Skill C would be key values in Title Data, then do I create a JSON structure for each skill tree's values indicating the skill unlock progression?

So if I save player's unlocked skills in UserReadOnlyData, I would imagine that I would only need to store key of the unlocked skill? Or would I store another JSON structure?

Who would be the one parsing the JSON structure? Would I parse it in the CloudScript or game code? I guess I would create a CloudScript that checks the player skill against the JSON skill map structure stored in Title Data?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.