Ren'Py Using Integers vs Flags

Cyan

Member
Jul 25, 2017
126
551
I have a problem with the concepts of 'going with x only', or 'going with whatever you like'. If you want to be a serious and professional developer, you need to consider the future - which system(s) will give you the most flexibility, which system(s) are the easiest to work with, etc. Just going with what works for the moment will probably end up biting you in the ass down the line.

In my opinion, you should plan for using your system across multiple games (even if you only plan to make one), since it will give you a very good idea of which types of things you would rather not redo and/or be built inherently into your system.

For example, there are several tedious subroutines baked into Unity that I dislike, so I rewrite them to make them easier for me.
 

Studio Errilhl

Member
Game Developer
Oct 16, 2017
315
235
Given that I am fairly new to the development of games, I've played around with a few ideas regarding this (how to display / manage affections, kinks and other values in-game). I'm personally using floats for the various stats and modification-values that might occur. My game is built on the premise that you need to up specific stats to be allowed to do specific things to specific people. The values can turn negative, which will mean you'll have to work on getting them up, and while I haven't done it yet, I plan on having multiple random dialogues happening depending on what stats show what, and when.

For instance, you mess up something with a loved one / love interest, or similar. This takes their current stat, and lowers it by a set amount of points then and there. This might affect the overall status (depending on what the number is to start with), or it might not do anything at all, if the stat is high enough from before. However, doing something like this will also cause the stat to decrease daily - until you make a mence, either by gifts, or by saying sorry, or both. This way, your misdeed is consequential for multiple things.
1. You do something stupid / bad
2. It leads to a decrease for specific stats (let's say Love, in this case)
3. Your Love-stat, which was on 50 before your action, is now 40 (you lost 10)
4. You also set a flag, let's say "npc_mad" to True
5. Depending on what the Love-stat affects, you will most likely have lost at least one "level" of love, in this case
6. You do not say sorry, or try to console the person that day
7. Next morning (or overnight, or in the evening) you have a function for the start of or end of day, which calculates things based on what has happened, and if you still have one or more flags like the action above would set, it will modify the stat(s) accordingly.
8. "npc_mad" is still True, and you lose another 3 Love. This will continue to happen every day, until the relationship is mended

And so on and so forth.
This does also (based on the flag) affect other interactions, which again might lead to more loss of affection during the events of the day.

Random dialogue-options makes it seem slightly less repetitive, and notifications to the player reminds him/her that there are unsolved situations that should be handled. And so on.

So, I'm using both. Both integer values for relations, and flags to set specific events, states etc.

It's not a perfect system, and it will lead to some repetition and grinding, but for a dating sim / repeatable, day-to-day game, with different events happening based on stats and relations, it's a fairy obvious choice, at least to me.