• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Program a Choice Based game.

T

TonyZh

Guest
My goal is to create a complex version of a text adventure in which choices will lead to different consequences in a story. :)

I would like to a program a game In Game Maker Studio 2 in which a players choice affects the story. So there are various possibilities. For example, if a player gives a plant too much water. It will die or if you are nice a person may become your friend and he/she will give you benefits.

The requirements for the game:
* The player must be able to walk around and he/she must be able to pick up certain things A text box appears. Such as, for example, (Nothing) or (an old photo of me and Sara).
* If the player talks with normal people. He/she will only get to see a text box with a story. For example: (Hello I am Sara Pleased to meet with you).
* If the player talks with important people that have an impact on the story of the game. A scene will appear(no animation, but only a simple Sprite with a picture.).
* The player can then choose from a simple text box with options.
* Based on the choice there will be alternative room, since the choice of the player will have an impact on the future.

I don't know how I program the code in a way where the choices will impact the game. How will I tell the code that a different room has to show up, a character which will act different based on your actions or different items depending on your decision? Maybe everyone choice has a value which will impact the room and items and personality of a person in that room.

I would like to thank everyone for helping me out!
 

The-any-Key

Member
This may become a time consuming project.
You need to save each choice.
Create a scene what will happen of each choice and any combination of each choice.
Program the game to follow the turnout.
This is nothing that comes easy.
 

NightFrost

Member
Yeah for each choice that impacts narrative, the game must remember what player selected. If the game is not meant to be completed in one sitting, you must save these to file to be retrieved for next session. For each scene where choices impact narrative, you must check what those choices were and play out the correct scene branch. You may want to plan out the whole thing first so you know what choices affect which scene. You also should devise a single format to save all the choice information. A simple true/false flag per choice might be enough. Or you may need to save results of multibranching, in which case you'd need to number them.

In a simpe choice system I've made before, I created an enumerator with each decision listed, and an array to save the player choices. So something like:
Code:
enum Flags {
    Helped_Merchant_Jack,
    Cleared_Mountain_Path,
    Donated_To_City_Orphanage,
    ....
    Length
}
enum Selected {
    No = 1,
    Yes  = 2
}
Player_Choices = array_create(Flags.Length, 0);

// If player doesn't help the merchant
Player_Choices[Flags.Helped_Merchant_Jack] = Selected.No
// If player helps the merchant
Player_Choices[Flags.Helped_Merchant_Jack] = Selected.Yes

// Did player help the merchant?
if(Player_Choices[Flags.Helped_Merchant_Jack] == Selected.Yes){
    ...
}
If there are multiple choices, I'd probably write an enum for each so I wouldn't need to fiddle with numbers and wonder what they stand for:
Code:
enum Helped_Merchant_Jack {
    Not,
    A_Little,
    Moderately,
    A_Lot
}
// If player helped the merchant a little
Player_Choices[Flags.Helped_Merchant_Jack] = Helped_Merchant_Jack.A_Little;

// Did player help the merchant a lot?
if(Player_Choices[Flags.Helped_Merchant_Jack] == Helped_Merchant_Jack.A_Lot){
    ....
}
 
T

TonyZh

Guest
Yeah for each choice that impacts narrative, the game must remember what player selected. If the game is not meant to be completed in one sitting, you must save these to file to be retrieved for next session. For each scene where choices impact narrative, you must check what those choices were and play out the correct scene branch. You may want to plan out the whole thing first so you know what choices affect which scene. You also should devise a single format to save all the choice information. A simple true/false flag per choice might be enough. Or you may need to save results of multibranching, in which case you'd need to number them.

In a simpe choice system I've made before, I created an enumerator with each decision listed, and an array to save the player choices. So something like:
Code:
enum Flags {
    Helped_Merchant_Jack,
    Cleared_Mountain_Path,
    Donated_To_City_Orphanage,
    ....
    Length
}
enum Selected {
    No = 1,
    Yes  = 2
}
Player_Choices = array_create(Flags.Length, 0);

// If player doesn't help the merchant
Player_Choices[Flags.Helped_Merchant_Jack] = Selected.No
// If player helps the merchant
Player_Choices[Flags.Helped_Merchant_Jack] = Selected.Yes

// Did player help the merchant?
if(Player_Choices[Flags.Helped_Merchant_Jack] == Selected.Yes){
    ...
}
If there are multiple choices, I'd probably write an enum for each so I wouldn't need to fiddle with numbers and wonder what they stand for:
Code:
enum Helped_Merchant_Jack {
    Not,
    A_Little,
    Moderately,
    A_Lot
}
// If player helped the merchant a little
Player_Choices[Flags.Helped_Merchant_Jack] = Helped_Merchant_Jack.A_Little;

// Did player help the merchant a lot?
if(Player_Choices[Flags.Helped_Merchant_Jack] == Helped_Merchant_Jack.A_Lot){
    ....
}
Yes, but how do I store the value and use it for example to give a player a benefit if he helps that person?
 
Top