What if opposing stats actually used two variables?

Hello everyone! :blush:

Anyone who has coded in ChoiceScript before knows that opposing stats is really just one variable. But what if it actually used two?

I haven’t seen anyone use something like this yet (please correct me if I’m wrong), so in my WIP, I’m trying out a stat system using a variable for each opposing side. I’m using it for both personality and relationship stats, although I still don’t know how viable it is (especially for relationship stats) long term.

Here's an overly simplified code I'm using in my WIP for the Warm/Cold Personality Stat
*create warm 0
*create cold 0
*create warm_percent 0
*choice
	#This choice increases the Warm personality stat.
		*gosub_scene stat plus 5 "warm"

This is the file named “stat”:

*label plus
*params amount stat

*if (stat = "warm")
	*set warm +amount
	*goto warm_cold_check
*elseif (stat = "cold")
	*set cold +amount
	*goto warm_cold_check
*elseif (stat = "warm_cold")
	*set warm +amount
	*set cold +amount
	*comment (For neutral choices if we want to increase both at once)
	*label warm_cold_check
	*if ((warm = 0) and (cold = 0))
		*set warm_percent 50
	*elseif ((warm = 0) and (cold > 0))
		*set warm_percent 0
	*elseif ((warm > 0) and (cold = 0))
		*set warm_percent 100
	*else
		*set warm_percent (round(((warm/(warm + cold))*100)))
	*return
*else
	*bug

Stats Page:

Please note that the actual stat chart uses only a single variable. This is the variable you use when checking a stat.

*stat_chart
	opposed_pair warm_percent
		Warm
		Cold

I have a setting where you can see the actual values of Warm and Cold, but I’ve disabled this by default because having two numbers for a stat is more confusing.

The actual code I use is more complex, but that’s not really important.


So, why use two variables?

Below are some things I have thought of for why you might want to use this system. To better explain my points, let’s say we have a generic Good vs. Evil stat.

More accurate percentage of choices picked

The Good/Evil stat would normally start out at 50/50. But even if we picked all the “Good” choices in Chapter 1, your stat bar will probably show something like 70% or 80% Good instead of 100%, which doesn’t really make sense to me.

With two variables, you will have 100% Good if you pick all the Good choices as early as Chapter 1. Of course, not all choices are equal, so you still need to vary the amount you gain with each choice.

Easier stat checking / Two methods of stat checking

This was actually the main draw for me for using two variables. But how would doubling your variable count make checking them any easier?

Well, you don’t need to track the highest points for a certain stat every time you need to check a stat. Since the Good/Evil stats can be anywhere from 0-100% as early as Chapter 1, we no longer need to check if 80% Good is the highest you can get the Good stat at Chapter 1.

At any point, 40/60% is an easy check, 20/80% is hard, and 0/100% means picking every choice up to that point.

If you ever need it, you can still check the actual Good/Evil values instead of the percentage, since 80% Good has different meanings depending on whether you are in Chapter 1 or 10.

Another thing to consider is that adding points to the Evil stat doesn’t necessarily decrease your Good stat (just the percentage), so this could be useful if you’re also checking the actual point values.

Different branches having unequal stat opportunities is less of a problem

With two variables, it doesn’t matter much if a branch has more opportunities to gain a certain stat. 0% and 100% is always achievable.

Easier way to make a stat turn neutral

If you have a neutral choice, you just need to add points to both Good and Evil equally, and no matter the value, the percentage will get closer to 50%.

Natural diminishing returns (without fairmath)

Because we’re comparing two values, diminishing returns will naturally occur, as long as you keep adding to both values instead of subtracting (though that’s an option too).

Choosing a choice opposite your highest stat can be less punishing

With fairmath, choosing to steal while you’re at 90% Good is very punishing, and it’ll be much harder to get it back to 90%.

With two variables, it will still drop, but if your actual Good stat value is high enough, it will barely move at all. This can incentivize people to choose what they actually want to do instead of being forced to min-max.

100% is not a limit / All stat gains have a permanent effect*

This is the second main draw for me. For longer games, you will probably hit the limit/soft cap for opposing stats early on.

With a single variable, increasing your Good stat beyond 100% won’t do anything (unless you deliberately make it go past 100). So we pick an evil choice, and it goes down to 80%. But we can still build it up back to 100%, like you never did anything evil (this can be resolved by using other variables, but it’s not reflected in the stat itself).

*With two variables, increasing your Good stat even if you’re at 100% still has an effect, because picking an Evil choice later on will have less of an effect. If we do this, however, we can never get back the Good stat to 100%, and that one choice will haunt you forever (unless you remove the Evil points, of course).


With that all said, why not use two variables?

It’s just more complex

Sometimes, simple is best, especially for shorter games. I wouldn’t recommend using this system for beginners.

Early game choices have a greater effect than late game

Stats will heavily fluctuate in the early game, while they will barely move in the late game, if you only keep adding points and not subtracting them.

You have less control

With two variables, you can’t set/add/subtract a stat easily. It’s possible, but it’s clunky, and depending on if you add or subtract values, it will have wildly varying results.

You also won’t be able to use fairmath. While using two variables allow for increasing/diminishing returns, it’s harder to calculate its actual effect. Fairmath is consistent, and can be used in all stages.

It doesn’t fit your needs

Different stories need their own way of doing their stats. Using two variables for opposing stats is just another way. Since I’m already using a subroutine for my notification images, this isn’t much of a hassle for me.

For the reasons above, I only recommend using this for personality stats and longer games, since by the end, the game should have a very clear idea of what kind of character you are playing as. I’m also using this for relationship stats, but having more control over those is probably a better idea.


This is mostly theorycrafting at this point, but I wanted to share this, and I’m curious to hear what others’ thoughts and opinions are! :heart:

6 Likes

While I do agree on the fact that you’ll need two variables if you don’t want increasing one stat to decrease the other, or otherwise want to keep track of them separately, I don’t quite understand how switching from one variable to two variables would magically change your gain from achieving 80% to 100%? Isn’t it all in how you set up the stat increases? I don’t see how opposed pair alone would make achieving 100% impossible (although if you want to use it to show the percent of player’s choices leaning one way or another, you of course need to track it a bit differently).

That said, I do like what you’re doing.

1 Like

I think we’re misunderstanding each other here. Can you quote/clarify which point you are referring to?

It’s impossible to reach 100% using fairmath, but you can reach 100+ by just adding flat values.

Might be the language barrier, yes. I was referring to this:

Which I read as you saying ”it isn’t possible to achieve 100% if you use opposed pairs”.

It’s not possible to achieve 100% with fairmath, that’s true, but that is true whether you’re using opposed pairs or not.

Gotcha! Let’s say you only have three opportunities to increase your Good stat in Chapter 1.

Then let’s say each choice gives +10%. Your stat bar will only show:

Good: 80% | Evil: 20%

at the end of Chapter 1 (assuming you begin at 50/50). You picked ALL the good choices, and yet somehow you’re 20% Evil?

With two variables, because your Evil is zero, your Good stat will be 100% at that point. I hope that’s clearer? :sweat_smile:

I figured elsewhere in the post that was what you were going at, but the way it was put just threw me off. :joy:

1 Like

So you basically wan to do this?

*create stat1 50
*create stat2 20
*create totalstat
*create combinedopposed
*set totalstat (stat1 + stat2)

*set combinedoposed = (100/(totalstat/stat1))

splitting the stat1 and stat2 individually without topping them to 100 but topping the opposed pair value to 100 to show in the stat page.

1 Like

Never find someone would write percent from sum as

100/(sum/value)

Just something fun I oughta mention. I’d do it as val/sum*100 which is basically the same, but *100 there exists only to percentage the equation.


Something worth for referencing is Divinity: Original Sin’s Traits system.

3 Likes

I have a comic and a tragic stat in my WIP (they aren’t called that in the stat screen). I didn’t want to set them up to be oppositional because I wanted to flag playthroughs that had high values in both.

For example: Butch Cassidy and the Sundance Kid. The heroes are both highly tragic and highly comic.If you were using oppositional stats then this would be indistinguishable from “neither tragic or comic”

Having a high tragic stat is relevant and useful information even if the comic stat is roughly of equal value.

If I want these two variables to function a single opposed stat that’s achievable simple arithmetic.

2 Likes

@Loudbeat Yup. But I also admit I haven’t seen percentage calculated that way before. :sweat_smile:

@Szaal Ooh, can you explain how Divinity’s Traits system work? I also have a trait system, but the way I do it is to just add a multiplier to the base value of one of the stats before calculating the percent.

@Jose_Garcia I’m not saying you should turn your stats to opposed pairs. If a stat works better not as an opposed pair, then of course don’t. :slightly_smiling_face:

I’m just suggesting an alternative way to show the percentages.

And by the way, you can still show the values of the individual stats are high even if you use opposed stats. This is what I meant by having two methods of stat checking. (You can either test the values, or the percentage.)

stats2

This is just one way to show it, of course. The stat bar text gets really small if I include the stat name on the bar itself.

2 Likes

It’s exactly the same as what you posted here, except the system doesn’t deal with percentage whatsoever and settle on “which has the biggest tally.”

There are several trait-pairs and each start at 0. For example, altruism vs. pragmatism.
Any decision will count towards one of those, but not all event/choice is always about pair-traits (all of them never puts you to pick from a pair, in fact). Having more altruism grants you some sort of defensive buff on combat, while pragmatism increase gold drop, IIRC. Social events are not dictated by the traits flavorly and is fully controlled by the player through the event/choice.

3 Likes