Game variable discussion

Discussion in 'Authors' Hangout' started by bejjinks, Aug 21, 2024.

  1. gene.sis

    gene.sis CHYOA Guru

    Well, there is a "better" way, though you need to prepare things way earlier.

    So you set up "foe tricky" before you set up the main character.
    At the same time, you create a variable "foe disadvantage".
    The values will be
    foe tricky = 9 -> foe disadvantage = 3
    foe tricky = 10 -> foe disadvantage = 2
    foe tricky = 11 -> foe disadvantage = 1
    foe tricky = 12 -> foe disadvantage = 0

    When you later set up the main character, you change the variable foe disadvantage in the same chapter you set (choose) the variable tricky.
    tricky = 9 -> foe disadvantage + 0
    tricky = 10 -> foe disadvantage + 1
    tricky = 11 -> foe disadvantage + 2
    tricky = 12 -> foe disadvantage + 3

    (Depending on when you create the opponent, it might even be better to do it the other way around and create a variable "advantage" during character creation. When you later set up the variable foe tricky, you modify the variable "advantage".)

    If you later change the variable tricky or foe tricky, change the variable foe disadvantage accordingly.

    Though there might be issues with this approach. E.g. if you have multiple possible opponents, you might need to set up a set of variables for each of them.


    Another way that might be possible later would be to use an intermediate chapter to precalculate the value. (E.g. right before the match.) In that case, you would offer 4 options to set the variable foe disadvantage and use the following chapter question with 4 options to modify it. (You need a landing chapter for both steps and to keep it easy, I suggest a non-accessible chapter at the same level as mentioned in earlier posts.)


    Changing things back at the beginning of the story can make the game "break" for readers with an old save game. So you might want to let readers know that their save game is outdated. (E.g. using a variable "version")


    Whether the suggested ways might actually be better or not, depends on more factors. E.g. the number of possible opponents or how often you might need the value.
     
  2. bejjinks

    bejjinks Really Experienced

    First, I'm so early in the process of creating the game that going back to fix things is not that difficult.

    Second, I already have several variables in play including strength, agility, stamina, skill, tricky, arousal, and more and foe counterparts for all of these variables. The success of a move depends on what kind of move it is. If it's an agility move like putting the opponent in a cradle hold, it would be "if agility > foe agility".

    I did think of something though that would be better than my original idea. Chapter 18 would have the following chapters:
    • If tricky = 9 then result = 3
    • If tricky = 10 then result = 4
    • If tricky = 11 then result = 5
    • If tricky = 12 then result = 6
    Then chapter 19 would have the following chapters:
    • If foe tricky = 9 then no change
    • If foe tricky = 10 then result - 1
    • If foe tricky = 11 then result - 2
    • If foe tricky = 12 then result - 3
    Then I would have the same result chapters I spelled out earlier.

    Then I would clear the result variable so that it can be used again to calculate the next move. Points, victories and a few other variables would also change to keep track of the long term results. For example, if "you" succeed at stripping the shorts off your opponent, then foe shorts = 0 and that would affect what moves "you" could try next. You wouldn't be able to strip your opponent of his shorts if he's no longer wearing shorts.
     
    gene.sis likes this.
  3. gene.sis

    gene.sis CHYOA Guru

    Well, it might be no problem for the author to change things.
    The issue I was pointing at was that readers might start a game and play until chapter 3. Then you introduce a new variable in chapter 1. When the reader continues from their chapter 3 savegame, they won't have the new variable and might run into a dead end in chapter 5 where the variable is needed.
    So if such a situation could occur, you might want to implement some kind of safeguard. E.g. telling the reader to reset their game progress.


    Doing these comparisons often and with new values, that approach is certainly better.
     
  4. bejjinks

    bejjinks Really Experienced

    I am aware of this which is why I put an Under Construction notice on page one. The game isn't really ready to be played at this time and when it is ready to be played, I'll put a message an page one telling readers that if they did start playing before such and such a date, they should reset.
     
    gene.sis likes this.
  5. gene.sis

    gene.sis CHYOA Guru

    That might work.

    There are also ways to do that depending on the "version" of the reader's save game. (That would be another variable that is added in the introduction chapter.)
     
  6. bejjinks

    bejjinks Really Experienced

    I'm curious what you meant by this. Did you mean a never-accessible chapter or were you instead talking about a chapter that is only accessible depending on conditions? I can't figure out any reason to have a never-accessible chapter so I'm assuming you meant the latter.
     
  7. gene.sis

    gene.sis CHYOA Guru

    I meant a chapter that can't be accessed (directly)

    If you have a chapter with the condition
    anyVariableName > 100000
    it is impossible to directly access the chapter as the maximum value of a variable is 100000, so the condition will always fail.
    The actual name of the variable doesn't matter. It also doesn't matter if the variable name is in use or whether it might exist in the reader's score or not.

    While this chapter can't be accessed directly, you can still choose it as the destination chapter of a link chapter.
    So if the reader clicks on the link chapter, they get forwarded to the chapter even though the condition isn't met. (The conditions of destination chapters aren't checked.)

    While the conditions aren't checked, the Score Changes are still applied.

    This means that Score Changes of both chapters (link chapter and destination chapter) are applied.

    In general, that can be an advantage or a disadvantage.


    So if you have a hub chapter H with two options A and B.
    Chapter A would be a regular chapter that "continues" the branch.
    Chapter B would link to chapter A, so the different outcomes would be displayed in chapter A with if statements.

    If both chapters have Score Changes,
    - choosing chapter A will apply the Score Changes of chapter A
    - choosing chapter B will apply the Score Changes of chapter B and then the Score Changes of chapter A.

    With this construction, you might need to consider the Score Changes of chapter A in chapter B. So if you are going to do "variable + 5" in A, you might need to do "variable -5" in B to achieve the intended result.


    The alternative is to have a hub chapter H with three options A, B, and C.
    Chapter A would be a regular chapter that "continues" the branch and displays the different outcomes. It has a condition that blocks direct access.
    Chapter B would link to chapter A.
    Chapter C would link to chapter A.

    So
    - chapter A can't be chosen as the condition isn't met
    - chapter B will apply the Score Changes of chapter B and chapter A
    - chapter C will apply the Score Changes of chapter C and chapter A

    With this construction, you can keep the Score Changes of chapter A empty or apply Score Changes that apply to all chapter options. (E.g. introducing new variables that are necessary in later chapters.)
    The Score Changes in chapter B and C don't have to be adjusted to achieve the intended result, so it might be clearer what Score Changes are applied with each choice.


    Another advantage is that you can have different titles.
    Let's say that you named the options in the first example
    A "Left door" and
    B "Right door"
    then choosing link chapter B "Right door" will forward you to chapter A and the title will say "Left door" even though the chapter text will display the event "Right door".

    Using the alternative with chapters A, B, and C, you can have three different chapter titles. E.g.
    A "The Room"
    B "Left door"
    C "Right door"
    So the chapter option would show the choice. Then, the user gets forwarded to chapter A and the title will be "The Room", no matter whether the user chose B or C.


    With "landing chapter" I mean the destination chapter of the link chapters.

    I guess you could also branch out for each step but then you would have quite a lot of redundant chapters, leading to a lot of effort to maintain it when you want to change some details.
     
  8. bejjinks

    bejjinks Really Experienced

    So let me see if I understand. Currently, I have the following:

    Chapter 1: You are John Doe. You have participated in wrestling competitions in the past but this will be your first time sex wrestling. But it isn't like . . .
    Chapter 2: You are okay with incest. incest = true
    Chapter 3: link to chapter 3 You think about your lover.​
    Chapter 2: You are not okay with incest. incest = false
    Chapter 3: You think about your lover. (This is the landing pad)​

    What you are suggesting is that I could organize it the following way:

    Chapter 1: You are John Doe. You have participated in wrestling competitions in the past but this will be your first time sex wrestling. But it isn't like . . .
    Chapter 2: condition unavailable > 100000 You think about your lover. (This is the landing pad)
    Chapter 2: You are okay with incest. incest = true
    Chapter 3: link to chapter 2 You think about your lover.​
    Chapter 2: You are not okay with incest. incest = false
    Chapter 3: link to chapter 2 You think about your lover.​

    I still don't see how that is a useful method. Maybe you could make up a better example of how it might be used.
     
  9. gene.sis

    gene.sis CHYOA Guru

    In your first example, the reader clicks the first of the options "Chapter 2" they will land in the chapter with the content
    Code:
    You are okay with incest.
    Then they have to click on "Chapter 3: You think about your lover" to get to the landing pad.

    So the reader has to click 2 times to effectively achieve one step. For the second click, there is no choice as it would always be the landing pad or a link to the landing pad.


    What I suggested would be more like
    Code:
    Chapter 1.1: You are John Doe. You have participated in wrestling competitions in the past but this will be your first time sex wrestling. But it isn't like . . .
        Chapter 2.1 (landing pad): condition unavailable > 100000 You think about your lover.
        Chapter 2.2 (links to 2.1): You are okay with incest. incest = true
        Chapter 2.3 (links to 2.1): You are not okay with incest. incest = false
    Chapter content of 2.1
    Code:
    {if incest = true}You are okay with incest.{else}You are not okay with incest.{endif}
    You think about your lover.
    Here, the reader only has to click 1 time to achieve the same step. So it might be more convenient for the reader.


    If you use a similar "1-click structure", you might run into the problem I mentioned.
    Code:
    Chapter 1.1: You are John Doe. You have participated in wrestling competitions in the past but this will be your first time sex wrestling. But it isn't like . . .
        Chapter 2.1 (landing pad): You are okay with incest. incest = true
        Chapter 2.2 (links to 2.1): You are not okay with incest. incest = false
    Chapter content of 2.1
    Code:
    {if incest = true}You are okay with incest.{else}You are not okay with incest.{endif}
    You think about your lover.
    The problem with this is that the chapter 2.1 will always show
    Code:
    You are okay with incest.
    You think about your lover.
    even if you clicked Chapter 2.2. In chapter 2.2, the variable incest will be set to false. Then, you get forwarded to chapter 2.1 and there, the score changes will be applied. So incest will be set to true.


    There are ways to still use the "1-click structure" and show the right result but it might be more complicated
    Code:
    Chapter 1.1: You are John Doe. You have participated in wrestling competitions in the past but this will be your first time sex wrestling. But it isn't like . . . incest = true
        Chapter 2.1 (landing pad): You are okay with incest. NO SCORE CHANGE
        Chapter 2.2 (links to 2.1): You are not okay with incest. incest = false
    Here, you define the value for the landing pad in chapter 1.1 and only change it when the reader chooses 2.1
     
  10. bejjinks

    bejjinks Really Experienced

    Alright, I understand now and thank you. This will reduce the amount of repetitive chapters I'm forced to create.

    Along those lines, I have a question. Because of what you suggest, I will be moving chapters around and eliminating almost every other chapter but as it is now:
    Chapter 12 determines your position variable
    Chapter 15 determines your foe tricky variable
    Chapter 17 determines your move variable
    Chapters 19 and 21 do some calculation to determine your result

    If you choose Ryan and your first move is to go for his shorts, position = 1, foe tricky = 9, move = 1 and you get a certain chapter as your result. (Currently, Ryan is the only opponent I have defined so I'm making the other opponents up just for illustration.)
    If you choose Carl and your first move is to go for his shorts, position = 1, foe tricky = 10, move = 1 and you get a completely different chapter as your result.
    But if you choose Chad and your first move is to go for his shorts, position = 1, foe tricky = 9, move = 1 and you get the same exact chapter as you got with Ryan except with Chad in his place.

    Now I do not want to make this overly complicated. The reason I stopped working on Ganymede University is because it got overly complicated and if I do anything with that story it will be to reorganize it into something simpler. But are there some simple ways I can improve this or is it okay since Chad and Ryan are similar?
     
  11. bejjinks

    bejjinks Really Experienced

    While I'm at it, I might as well ask, is there a way that I can cause a reader to receive a message that they need to reset the game no matter which chapter they click on?

    Would it be to create a game version variable and set every chapter to be only available if the game version equals the right number and if the game version is less than that number, the only chapter available to them is the one that tells them to reset? Or is there a better way?
     
    Last edited: Sep 16, 2024 at 5:30 AM