How would I save and evaluate player choices to influence game end cutscene?

Basically, I want the player to be faced with three or four simple questions for which they’ll push either a ‘yes’ or ‘no’ button.

I want to be able to save those choices (yes or no for each question) and show one of several game end cut-scenes depending on which choices they make. Think something like a simplified Stanley Parable.

I think this should be possible to do using logic bricks but I’m unsure how to save data during the game and how to get the game engine to evaluate the results.

Can anyone point me in the right direction?

Due to its dynamic nature you need Python to permanently save something. Search for save/load/highscore there are plenty of threads dealing with this topic.

If you do not need it permanently you can use a single object to store some data. If it is not much as in your example, you do not need Python. If you want to switch scenes you can rescue the data in an overlay scene. You can communicate between scenes via messages.

example:
Choice 1: responses A, B, C
send the response via message to the game status storing object e.g. subject “choice 1 response B”. The object knows what it means when receiving such a message and could for example, store this information in a property: status = “choice 1 response B” or something like that. You can even use multiple properties: Choice1: “B”, Choice 2: “A” etc.

If you want to do this effectively, you should learn python.

Python can be used to save the choices, and to appropriately evaluate them.

Personally, I’d keep it simple and use a point system. For example, let’s say there are three types of endings, the “good” ending, the “bad” ending, and the “neutral” ending. I’d have a property on the player called “goodness”, which holds an integer and would start at 0, which is automatically the neutral ending. If the player makes bad choices, some value is subtracted from the goodness property; if the player makes a good choice, some value is added. This is helpful because certain decisions carry more weight in either the bad category or the good category. For instance, committing murder, I think, is generally worse than pick pocketing someone’s money. At the end of the game you could check the goodness property and accurately make a decision on the ending. i.e. less than -50 is bad, over 50 is good, in between is neutral.

But what if the endings aren’t good or bad? What if they are just different? In that case, you could keep track of the separate choices in different properties, again, using a point system. Some decisions may hold weight for two endings, and influence two different endings separately. i.e. Maybe if you kill someone in the game, it doesn’t just increase your “bad” property, but also decreases your “popularity” property. If you end up doing something like this, at the end of the game you could compare the different decision properties and show the correct ending.

There’s also a case where the endings just depend one which door you opened or which path you went through (much like Stanley Parable).
This is the only case in which I’d use the method Monster describes above, which is very useful for simple games.

Good luck!

Thankyou both very much for taking the time to answer. I’ll see what I can put together from your suggestions and post back here with progress.

I appreciate that I’ll need to get to grips with Python eventually. :slight_smile:

What I’ve come up with as a non-python solution (for now) is to use cut-scenes. Each time the player makes a decision they are sent to a cut-scene and then back into the game environment.

Luckily the game environment is simple enough that I have one for each player decision result (a separate scene for each) so the player gets the appropriate ending for their choices.

This solution only works for the short proof of concept I’m working on since the player decisions branch out exponentially for each yes/no choice. I have three in-game questions which results in approx 28 separate scenes.

Anyway - thanks guys for your help and I’ll get into python as soon as I’m done with this short project.

[EDIT] One mistake I made (which I will rectify if I have time) is that when I re-created the original scene I chose to make a ‘full copy’. This means that I now have separate unconnected versions of all materials across all scenes. This of course is very wasteful and increases both scene size and individual loading times. What I SHOULD have done is choose to make ‘link object data’ copies, since I want to make changes to certain elements of the scene but the materials don’t change. Oh, well. Live and learn I guess. :slight_smile:

Linkxgl’s example could, mostly, be implemented with logic bricks (but, it would still be in your best interests to learn some Python). Logic bricks provide a means of manipulating properties (game properties, property sensor, property actuator, etc). You could also use message sensors/actuators to send a messages to the player object to modify it’s point values. This works out fine enough if you go with the one-dimensional good/bad/neutral thing, but doesn’t scale to well for more ending types. Your end-game cutscene can be decided by evaluating the players points via a property sensor. Really, the only thing you’re missing is saving the data out (you could write a quick Python script for this one part).