Tool for decision path score calculation

The Architect

Singing dancing crap of the world
Game Developer
May 2, 2017
542
1,812
Hi !
Does anyone knows a good free tool to help calculate scores for decision path/trees in games?

I mean, during the game the player might choose between several options, scoring different state values.

I need to easily know at certain point of the plot, what possible values the player might have given a certain decision path.

Currently I'm trying to use an Excel spreadsheet for this. But it's a pain the ass finding the values...
 

Studio Errilhl

Member
Game Developer
Oct 16, 2017
315
237
Normally, this would be handled by either set-lists, or by adding up unique numbers -
 

tooldev

Active Member
Feb 9, 2018
710
639
You could also chose a bitwise operation like using flags that necessarily make up unqiue numbers by decision.

P.S. might also be useful for you
 

The Architect

Singing dancing crap of the world
Game Developer
May 2, 2017
542
1,812
Thanks for the suggestions! My problem is more with counters instead of flags. Some mutual exclusive story branches increase a counter A while others increase a counter B (branches always join back to the main story flow). I'd like a quick way to check if a certain combination of A and B is possible given with the set of possible branches. Excel helps with it, but checking a new combination in it takes some precious time...
 

Droid Productions

[Love of Magic & Morningstar]
Donor
Game Developer
Dec 30, 2017
7,174
18,355
It depends a little on what you're trying to do. When you say 'score', it implies that there is a value assigned to each point (good/medium/bad, 3/2/1, for example). Are you trying to work out the theoretical min/max scores a player could get to by following a certain path? (So for example if he chose A/A/B/B/B/C/A/A he would have a corruption score of 20 and you can lock your 'best' ending to something like that? I guess you could try building a parser that walk all possible paths of the graph in-game, and outputs the score to a CSV file? Depends a little on your underlying tech.
 

The Architect

Singing dancing crap of the world
Game Developer
May 2, 2017
542
1,812
It depends a little on what you're trying to do. When you say 'score', it implies that there is a value assigned to each point (good/medium/bad, 3/2/1, for example). Are you trying to work out the theoretical min/max scores a player could get to by following a certain path? (So for example if he chose A/A/B/B/B/C/A/A he would have a corruption score of 20 and you can lock your 'best' ending to something like that? I guess you could try building a parser that walk all possible paths of the graph in-game, and outputs the score to a CSV file? Depends a little on your underlying tech.
That's exactly what I want. But my hope is that some free tool that do the job exists. Time is already short to work on the game, and I can't spend much of it writing the parser (it would be fun, though).
 

Droid Productions

[Love of Magic & Morningstar]
Donor
Game Developer
Dec 30, 2017
7,174
18,355
What engine are you using? There might already be a tool for this if you're using a standard engine (like Renpy).

The big problem with an external tool is you'd need to re-input all your data, which is slow and error-prone. At least with an internal tool you know that you don't need to re-enter any data (which is then subject to change and changes need to be, but rarely are, mirrored in the second set of data).
 

The Architect

Singing dancing crap of the world
Game Developer
May 2, 2017
542
1,812
It's my own VN framework over Unity, but i have data well structured. I think I might try writing the parser. Thanks for the idea!
 

Droid Productions

[Love of Magic & Morningstar]
Donor
Game Developer
Dec 30, 2017
7,174
18,355
Sounds good. If you're already tech savvy and own the data, doing a depth-first graph traversal of all the possible paths, then spitting it out to a Comma Separated Values (CSV) text file you can open in XLS is the cleanest way. That won't just give you access to 'best' score, but will also let you know lowest, means, averages, etc.
 

V.A. Laurie

Game Writer & Editor
Game Developer
Oct 9, 2017
557
1,875
I have been wondering about this as well. A tool like this would be invaluable. I've tried using tools like Twine to keep track of the story flow, and that is a fine tool for some, but it doesn't really help with the intersection of the paths and accounting for point possibilities.

Both games I'm writing are using Ren'py and I wish there was a tool that would just run though the game choosing every possible combination and spitting out the results in a txt file. that'd be perfect. But I don't know if that exists.

However, there is a tool that helps... from the ren'py documentation site:
When or is True, pressing the fast_skip key (by default, ">") causes the the game to immediately skip to the next important interaction. For this purpose, an important interaction is one that is not caused by a say statement, transition, or pause command. Usually, this means skipping to the next menu, but it will also stop when user-defined forms of interaction occur.
So basically, while in developer mode, press > and Boom, at the next menu. Faster than Skipping even if you turn speed up to maximum.

Even though we write these games, combing through the scripts can get annoying as fuck when you want to make sure of these details

Anyway... watching this thread because if a tool pops up that does this, I want it.
 
Mar 14, 2018
199
176
You just need a tree datastructure that represents the choices (a list of nodes with their associated values, and the list of edges that define how the nodes are connected), then a simple tree traversal algorithm that goes down the tree through every branch and spits out the list of values collected through each traversal.

If you google "Everything you need to know about tree data structures" you should get a good article showing you all this with python code.

It's such a general task, I hardly expect anyone will have made a tool for it, apart from maybe some Computer Science educational tool that can explore/search node graphs interactively and coincidentally be able to spit out the answer for you.
 

CheekyGimp

Active Member
Donor
Game Developer
Mar 8, 2018
843
5,176
Do you really need to know every single possible score at each point ? If you are using excel, why not just use two columns per variable to denote the max score possible at that particular point and the min score posisble. For each branch or decision point, change the min & max columns for any possible option where the variable is increased or decreased. It won't give you all possible combos at each point, but it will give you the max, min & range, i.e. at any particular branch the min value for a variable (assumes every option up to that point that affects the variable negatively was chosen) and max (assumes all positive choices were taken).
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
Do you really need to know every single possible score at each point ?
It depend (I don't know his game), but probably not this often.

Let's say it's a submitting/seduction game. Come the moment when the MC raise is voice against the NPC. NPC's reaction while depend if it is more submissive or more seduced. So, the best way to deal with it is something like this :
Code:
if submission < seduction:
   branch according of the seduction level
else:
  branch according to the submission level
The only possible conflict is when the two variables have the exact same value. In this case, the code below will prioritize submission.
It's the best way to deal with the possible conflicts which can happen if the code was :
Code:
if submission < value1:
  [blabla]
elif submission < value2:
  [blabla]
elif seduction < value1:
  [blabla]
elif seduction < value2:
  [blabla]
and it should works with any kind of multi path.
 

V.A. Laurie

Game Writer & Editor
Game Developer
Oct 9, 2017
557
1,875
It depend (I don't know his game), but probably not this often.

Let's say it's a submitting/seduction game. Come the moment when the MC raise is voice against the NPC. NPC's reaction while depend if it is more submissive or more seduced. So, the best way to deal with it is something like this :
Code:
if submission < seduction:
   branch according of the seduction level
else:
  branch according to the submission level
The only possible conflict is when the two variables have the exact same value. In this case, the code below will prioritize submission.
It's the best way to deal with the possible conflicts which can happen if the code was :
Code:
if submission < value1:
  [blabla]
elif submission < value2:
  [blabla]
elif seduction < value1:
  [blabla]
elif seduction < value2:
  [blabla]
and it should works with any kind of multi path.
yeah let's say you are writing a scene and want a to only allow something t happen if, let's say 3 variables have reached a certain value. Using a tool could let someone know what the potential point combinations could be up to that point. Then you have some very specific conditions that could be used.

it's not useful 100% of the time, and it's not like every possible combination is going to be relevant, but it can verify that certain points could reach a threshold in specific combinations.

just seems like a neat thing to have.
 

The Architect

Singing dancing crap of the world
Game Developer
May 2, 2017
542
1,812
I was able to scrap a little time today and wrote a quick and dirty parser. It follows the graph defined in a .csv file and build an output .csv with value combinations for all possible paths. It even validates some state condition checks before entering a branch (as it happens in the game).

Now, the output grows geometrically and I hope the game won't have enough branches to cause a stack overflow in the parser. I attached the source Java program and sample input/output files if someone is interested.