Points or Percentages?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Points or Percentages?
Hi all,
Forgive me if this is a stupid question... I'm wondering if it's possible to use a percentage system in Ren'Py rather than points? I've only used points up until now, but I think I'd like to try percentages next time.
For example, I'm planning on having some character traits change throughout the game: Confidence VS Fear. Fear would be a low % and confidence would be a high %. Now, I could use points again, but there will be a lot of variables adjusting these traits throughout the game, and the outcomes/ endings will show this. I think I'll get the numbers wrong if I use points, and percentages feel a little more natural for me... I think these kind of traits are more on a spectrum than on/ off.
If this isn't possible, I'll just have to build the perfect set up for points But if percentages are a possibility, I'd much prefer to use them here.
Forgive me if this is a stupid question... I'm wondering if it's possible to use a percentage system in Ren'Py rather than points? I've only used points up until now, but I think I'd like to try percentages next time.
For example, I'm planning on having some character traits change throughout the game: Confidence VS Fear. Fear would be a low % and confidence would be a high %. Now, I could use points again, but there will be a lot of variables adjusting these traits throughout the game, and the outcomes/ endings will show this. I think I'll get the numbers wrong if I use points, and percentages feel a little more natural for me... I think these kind of traits are more on a spectrum than on/ off.
If this isn't possible, I'll just have to build the perfect set up for points But if percentages are a possibility, I'd much prefer to use them here.
Re: Points or Percentages?
Percentages is just a different way of calculating points. The basic set up would be:
Massage the math as necessary, but the basic idea is the same.
Code: Select all
default confidence = 0
default fear = 0
default cf_result = 0
label start:
menu:
"Confident thing":
$ confidence += 1.0
"Fearful thing":
$ fear += 1.0
$ cf_result = confidence / (confidence + fear)
$ pc = cf_result * 100
$ pf = (1-cf_result) * 100
"You are [pc] \% confident. You are [pf] \% fearful."
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Re: Points or Percentages?
Wow, awesome! Thank youphilat wrote:Percentages is just a different way of calculating points. The basic set up would be:
Massage the math as necessary, but the basic idea is the same.Code: Select all
default confidence = 0 default fear = 0 default cf_result = 0 label start: menu: "Confident thing": $ confidence += 1.0 "Fearful thing": $ fear += 1.0 $ cf_result = confidence / (confidence + fear) $ pc = cf_result * 100 $ pf = (1-cf_result) * 100 "You are [pc] \% confident. You are [pf] \% fearful."
So, to refer to it, would I do something like this:
Code: Select all
if pf > 50: #50 percent
e "Are you scared?"
elif pc > 50:
e "You look confident!"
- KuroOneHalf
- Regular
- Posts: 129
- Joined: Fri Apr 25, 2014 6:18 pm
- Completed: Cuttlebone
- Projects: Somewhere In The Shade
- Deviantart: KuroOneHalf
- itch: kuroonehalf
- Contact:
Re: Points or Percentages?
Seems like that should work, yep. Give it a whirl and see.
ps: That if/else statement could just be:
ps: That if/else statement could just be:
Code: Select all
if pf > 50: #50 percent
e "Are you scared?"
else:
e "You look confident!"
- wyverngem
- Miko-Class Veteran
- Posts: 615
- Joined: Mon Oct 03, 2011 7:27 pm
- Completed: Simple as Snow, Lady Luck's Due,
- Projects: Aether Skies, Of the Waterfall
- Tumblr: casting-dreams
- itch: castingdreams
- Location: USA
- Contact:
Re: Points or Percentages?
The only thing I would caution on is that you could accidentally divide by zero causing your game to crash.
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Re: Points or Percentages?
Ah, good point. I guess there would need to be enough points scored before that code goes in? That should solve the issue, right?wyverngem wrote:The only thing I would caution on is that you could accidentally divide by zero causing your game to crash.
- wyverngem
- Miko-Class Veteran
- Posts: 615
- Joined: Mon Oct 03, 2011 7:27 pm
- Completed: Simple as Snow, Lady Luck's Due,
- Projects: Aether Skies, Of the Waterfall
- Tumblr: casting-dreams
- itch: castingdreams
- Location: USA
- Contact:
Re: Points or Percentages?
Just make the flag equal to 1. Then you'll always divide by 1 instead of zero.
- xavimat
- Eileen-Class Veteran
- Posts: 1460
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Points or Percentages?
Another way of dealing with it:philat wrote:Percentages is just a different way of calculating points.
Besides the math, the difference I see between points system and percentage system is the logic:
- with percentage there is a maximum
- with points there is no need of maximum
If your game has no maximum, the percentage system won't be so meaningfull. I'm using currently a simple combat system where the HP and skills have no maximum. There can be always increased, and new enemies can be always stronger than the older.
In your case, with two opposing stats, I'd use maximums. So the percentage is:
Code: Select all
value_percent = value / 100 * MAX_VALUE
opposing_value_percent = (MAX_VALUE-value) / 100 * MAX_VALUE
Code: Select all
"You have a value of [value]%"
$ opposing_value = 100 - value
"You have an opposing_value of [opposing_value]%"
EDIT to elaborate:
Xela's solution is interesting, it calculates the max_value using fear+confidence, a value that will change over the game.
The result of that is: the first decision in the game, that adds for the first time +1 to one of the values (fear or confidence) will be the equivalent to 100%. Later in the game, when the player has done 19 decisions, the next +1 will have an effect of 5%. If the game is long, after 199 decisions, the next decision will change the values in a 0.5%. So, your game should take this into account.
For example, later decisions could add more than +1 (+5, +20, +1000 points, for example).
Last edited by xavimat on Sun Dec 25, 2016 11:32 am, edited 2 times in total.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- Ocelot
- Lemma-Class Veteran
- Posts: 2384
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Points or Percentages?
I would call it a baseline, not maximum: some special value which has special meaning.Besides the math, the difference I see between points system and percentage system is the logic:
- with percentage there is a maximum
- with points there is no need of maximum
It might actually be maximum value, it might be softcap, after which you have diminishing returns or parameter decays over time, it might be normal value which is usually compared to other anyway (e.g. special attack deals 130% of normal damage)
< < insert Rick Cook quote here > >
- xavimat
- Eileen-Class Veteran
- Posts: 1460
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Points or Percentages?
I understand 130% in an attack system, from a baseline (base damage points in an attack-skill), but OP talks about stats, and more specifically "opposing stats". More confidence is less fear (and the other way around). So 130% confidence would be -30% fear?, I think this beats the reason to have percentages.Ocelot wrote:I would call it a baseline, not maximum: some special value which has special meaning.Besides the math, the difference I see between points system and percentage system is the logic:
- with percentage there is a maximum
- with points there is no need of maximum
It might actually be maximum value, it might be softcap, after which you have diminishing returns or parameter decays over time, it might be normal value which is usually compared to other anyway (e.g. special attack deals 130% of normal damage)
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Who is online
Users browsing this forum: Ahrefs [Bot]