Some adventure games are not linear and take place in a single environment. This opens up the question of flow/sequence management.
A simple example is a walk-through trigger. When you walk into a trigger, a monkey could jump out of a box.
But I don't want that happen all the time, so I check a global variable - which sees which phase of the game the player is.
Now when I walk into the trigger, the monkey jumps out only if the global variable playerPhase = 5.
Easy enough. But what if I have 50 triggers scattered throughout the level? And each of those has to check 20 playerPhase values to determine what they should do and how they should react if the player walks into them during various phases?
Is the way to manage them really to go into each ActionList for each trigger and look at each branch for if playerPhase = 1, 2, 3, etc.?
Its difficult to manage because I don't get a high level view of the game. I'd like a way to see the branching flow of the entire game - what triggers, events, etc. are available to the player when their playerPhase = 8? That could mean the player found a special sword or talked to the right NPC, so now they are in the 8th phase of the game. No longer will that monkey jump out of the box, but a different trigger, that did nothing before, plays music. Right now, it seems like I have to go one by one through all ActionLists and dig in to find out what each one does at Phase = 8.
I hope this makes sense.
Would my solution be to have a "master" ActionList, which acts as the tree for the entire game, and trigger sub actionlists based on it? Or should I just use something like PlayMaker to handle the overall logic as one tree for the entire game? Or maybe even BehaviorDesigner so it follows an actual branching structure? It seems like when you have more than a few places needed for variable checks, its going to get really disorganized and hard to edit.
Just want to make sure I'm not missing something included in Adventure Creator that is straight forward or a best practice I haven't seen before I try to think up alternatives.
Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
PopUp variables, rather than Integers, are better suited to storing a discrete number of values. They can firstly have labels attached to each value (for easier readability), but can also be used by the Variable: PopUp switch Action to allow for all possible output values to be processed in one - rather than needing a separate Variable: Check Action for each outcome. PopUp values can also be assigned from presets, so that you can recycle their values.
It's possible to locate all references made to a particular Variable via the cog menu beside its definition in the Variables Manager / Variables component Inspector. This is useful if you want to find e.g. all ActionLists that depend on it.
A "master" ActionList could indeed be used to set either a "master game state" variable, or enable/disable Triggers etc, based on other things like inventory count, other variables, etc.
You're not limited to the provided Actions to manipulate Variables. You can also rely on custom Actions, and custom scripting, to get and set their values. Global and Component variables can also be linked externally - either PlayMaker or a custom script. Once set up, such a link is automatic - so you can e.g. set a value through PlayMaker, and it'll be reflected in Variable: Check Actions. For more on this, see the Manual's "Variable linking" chapter.
Component variables and ActionList parameters also offer powerful ways of compartmentalising game logic:
Taking your Trigger example, let's say all Triggers in your game can either do nothing, show a monkey, or play some music. This might not be suitable for your actual needs, but here's one avenue you could go down:
Either way, you now have the ability to locally set the state of each Trigger, and have each Trigger behave indepently from one another, by simply changing its own PopUp variable with the Variable: Set Action. This can be done from a "master" ActionList that you described above. Alternatively, as I mentioned above - you could also link these values to e.g. PlayMaker.
Thanks for the feedback, Chris. Very helpful!