Defining Plot Progress with Variables

Discussion in 'General Discussion' started by Faherya, Apr 23, 2018.

  1. Faherya

    Faherya The Knight of the Sad Figure Veteran

    Messages:
    199
    Likes Received:
    482
    Location:
    Brazil
    First Language:
    Português
    Primarily Uses:
    RM2k3
    @bgillisp has raised a very interesting point in his status: How to use variables to define the course of a script? Explain your methods here, I'll start with mine:

    I often use variables as score. Certain actions (missions / progress in the game / Level) increase the value of the variable. That way I never need to worry if the player is going in a certain place before the time, because nothing is going to happen. Nor do I have to worry about manipulating playing time so that progress is neither too fast nor too slow. This template allows the player to make their own time.

    Let's say the player is locked in a puzzle. He just needed to do extra missions, kill monsters and level up to get past that part of the game, right? Wrong, in these situations you can simply lock the value of the variable, preventing the player from mocking this part of the game. For extra missions, secret scenes and the like, it is enough to limit some restrictions. For example, the player will only receive the special weapon if he goes to a certain place while his score is greater than or equal to X or while it is between Y and Z.

    This model allows me not to have to use switches everywhere. As I started with RM 2003, there were no local switches, we needed to save as much as possible. I ended up with the habit until today and still seems reasonable.
     
    #1
    dreamfall887 likes this.
  2. Eurritimia

    Eurritimia Villager Member

    Messages:
    20
    Likes Received:
    20
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I literally use a variable called history to keep track of my game. It makes my game linearish but i know easier how everything is going on.
     
    #2
  3. Milennin

    Milennin "With a bang and a boom!" Veteran

    Messages:
    2,120
    Likes Received:
    1,168
    Location:
    Fiore
    First Language:
    English
    Primarily Uses:
    RMMV
    I like to use a variable to mark progress within a smaller slice of the story, but then use a new variable for the next main step. It lets me still give relevant names variable names and look up easily what part of the game the variable is used for, but at the same doesn't require a switch for every little new thing that happens. It also prevents getting lost in a large number of possible values within a single variable.
     
    #3
    Matseb2611 and TWings like this.
  4. Matseb2611

    Matseb2611 Innovate, don't emulate Veteran

    Messages:
    4,582
    Likes Received:
    6,421
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    I use variables in this manner in several situations:

    - Scene sprite management: Need complex stuff to happen or for a character sprite present in the scene to go to the next page? Just add +1 to a variable assigned to that scene. E.g. Make a variable called Level 1 entry scene. Then as each new things is needed, keep adding +1 to it (or just set the variable to a higher value) as the scene goes on and give conditions to the event pages associated with this variable's values. Saves you up on a lot of switches.
    - Cumulative tasks needed to accomplish for something to unlock. E.g. Speak to all ally NPCs before leaving the area or Find all X number of keys to unlock a door. Every time you do one, add a value to the variable (just remember to have a self switch or a new event page so that consecutive interaction with the same NPC doesn't keep adding to this variable). Lastly, have a conditional branch. Once variable X reaches value Y, do the so and so action.
    - Developing relationships. Need something to keep track of an ally's level of trust in your or maybe even a romance score, well, variables are perfect for it. Later you can use conditional branches for different outcomes depending on someone's trust/romance score with you.
     
    #4
  5. CleanWater

    CleanWater Independent Developer Veteran

    Messages:
    625
    Likes Received:
    730
    Location:
    Brazil
    First Language:
    PT-BR
    Primarily Uses:
    Other
    I divide the main quest into sections and use each section's variable to track the progress of the game.
    Like you do, certain things only are accessible after the "score" is higher than x, or between x and y.
     
    #5
  6. GuanyuMaker

    GuanyuMaker Veteran Veteran

    Messages:
    63
    Likes Received:
    73
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I use vars for everything that needs to be tracked. Same way one would do while programming. Score values, plot progress , evaluations and calculations. Everything and everywhere. In the end the editor is just a visual Tool for programming your game.

    Edits: For the plot progress itself I usually do something like @CleanWater does . An history var that gets a +1 for each cutscene passed and another if needed for each stage in a cutscene. If my game does have multiple storylines I do use one for each endline. If the history is somekind of history tree that we have a couple of forks I just stop using the current var and create new ones for each branch of a fork.

    But Im not afraid of using switches If something can be done easier that way. After all switches are just boolean or logical variables .
     
    Last edited: Apr 24, 2018
    #6
    CleanWater likes this.
  7. M.I.A.

    M.I.A. Goofball Extraordinaire Veteran

    Messages:
    734
    Likes Received:
    526
    Location:
    Seattle
    First Language:
    English
    Bingo!

    I use variable "Score" for Progression in my main project. I also assign that "Score" a dialogue that any of the 'fortune tellers' can iterate, in case a player has taken a break for too long and forgot what they were doing. I'm not a fan of quest logs. :)

    -MIA
     
    #7
    CleanWater likes this.
  8. fallenlorelei

    fallenlorelei Veteran Veteran

    Messages:
    295
    Likes Received:
    333
    First Language:
    English
    I love this conversation! I am taking notes like a fiend.

    I also use a ton of variables in my game for various plot-related mechanics, although I'm concerned about doing a "+1" for every story element passed. What if you wanted to add an important story element mid-game yet post-production? You can try as you might to make the perfect story prior to development (we all have our rough drafts), but when alpha testers get in and notice an incongruency - what do then? All of your events are set to particular numbers that will need to be changed, and depending on how long your game is, that can be a lot of work. All great writers need to edit their work and the same is true of game development.

    Meanwhile Switches don't work incrementally - just by name (well - ID). If you added a new story plot (talking to a new required NPC in between going to the dungeon), you'd only have to change a Switch or two for the proceeding story elements. If you used Variable #s, you'd have to change the # for ALL events afterward. If opening the dungeon needed var 25, defeating the dungeon set it 26, then talking to the mayor for a reward needed 26, receiving the reward setting it to 27, and giving the reward to your mother required a 28..... you'd have to manually go in and change all those numbers up until the end of the game. For a switch, you'd just have to change the switch ID for one or two events, and then everything will work as intended from thereon out.

    But maybe I misunderstood what everyone was saying here! I'm still drinking my morning coffee! :D
     
    #8
    TWings, GuanyuMaker and CleanWater like this.
  9. CleanWater

    CleanWater Independent Developer Veteran

    Messages:
    625
    Likes Received:
    730
    Location:
    Brazil
    First Language:
    PT-BR
    Primarily Uses:
    Other
    @fallenlorelei when you need to change something mid game, you can simply create a extra switch for that part and add a comment to not forget. :wink:

    Actually, there's no easy way in game development. Even when you try to optimize things, you need to do a lot of work to achieve this.
     
    #9
    M.I.A., Eurritimia and GuanyuMaker like this.
  10. GuanyuMaker

    GuanyuMaker Veteran Veteran

    Messages:
    63
    Likes Received:
    73
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    @fallenlorelei . Thats why people sometimes divides the vars in multiple ones for parts of game history or history branches. But it is still good to have one to keep track of the whole history as if it where a index or a summary. When you change something you may only need to change the var tha tracks that small block of history instead of everything. If you do something that needs to change the big index it will be ok as it will recieve a +1 less frequent so it will be checked in a lower frequency too.

    But I wont be too worried about it. I do use alot of switches and the tool( RPG MAKER) is supposed to make things easier for you, not harder. If theres something you can do that works better on switches long or short terms, why not using it?
     
    #10
  11. fallenlorelei

    fallenlorelei Veteran Veteran

    Messages:
    295
    Likes Received:
    333
    First Language:
    English
    @CleanWater and @GuanyuMaker Very good points! I sat back and thought about it, and you could probably get away with using a combination of switches and variables to make life a lot easier when +1'ing story events, or just having different story variables per "chapter" or even per "scene" (or heck, per "map" would work too, and save a lot of headache tracking down events tied to your variable when updating the story).
     
    #11
    GuanyuMaker likes this.
  12. Matseb2611

    Matseb2611 Innovate, don't emulate Veteran

    Messages:
    4,582
    Likes Received:
    6,421
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Yeah, this is why I prefer to keep separate variables for different scenes. Having one variable for the entire game is going to get very messy and hard to keep track of. For organization's sake, it's better, in my opinion, to keep each variable assigned to a much smaller scale in the game.
     
    #12
    Kyuukon likes this.
  13. Neka Music

    Neka Music Veteran Veteran

    Messages:
    261
    Likes Received:
    93
    First Language:
    Empty
    Primarily Uses:
    N/A
    I use a variable called the "Story" variable, which adds +10 for each event,
    and I also have the "additional story" variable, in which I will use it whenever I need to add a new event without modifying / altering the normal story variable amounts.

    For debug testing purposes, I even add the story variable as a view-able currency on the main menu. So, I don't have to search for the latest events through the game editor.

    For Chapter purposes, I use Switches, such as : Chapter 1, Chapter 2, and so on.
     
    #13
    CleanWater likes this.

Share This Page