Forum rules - please read before posting.

Tutorial to script the overall game flow - Start 2 Finish?

Hi,
I have been watching all the tutorials for AC, as well as many Unity tutorials.

All these tutorials have been terrific, but I started to notice that none of them show how to manage or script the start 2 finish flow of an entire game. They are mostly certain aspects of a game, but not a whole game.
The tutorials that show start to finish are usually for very simple survival games. But what about an adventure game like Syberia (just to name one) where the player has to advance through several scenes, perform required actions and collect items?
How is a complex game flow like this managed / scripted?
Are there any tutorials that will shed some light on this aspect of game development?

The closest thing to such tutorial that I could find is probably the 6 part Unity 2016 Adventure Game tutorial. And while it is really well done, it also shows just how complex (and difficult) it can be to script an adventure game.

Seems to me that without being able to create or script the flow of the game from start 2 finish - that there won't be much of a game.

Any advise on how to go about that with AC?

Thanks, and excuse my long rambling.
- Kay

Comments

  • edited September 2017
    Welcome to the community, @KaySievert.

    I'm not sure what you mean by them being for "survival" games, but the video tutorials are designed to cover the fundamentals of interactions, characters, movement, UI and so on.  As AC can be used in many different ways, so too do the different videos show different approaches.  The text tutorials then cover more specific features and operations, while the Manual details each of AC's features.

    The demo games are designed as self-contained mini-projects that can be played to end.  Admittedly they each take place in a single room, but moving between scenes in a game just a matter of using the Scene: Switch Action.

    Key to managing your game's overall flow is your use of Variables.  Variables are used to keep track of a player's progress and choices, and are saved automatically at runtime.

    For example, the 3D Demo features a "Tried lifting canvas" boolean variable - whose value is read when the player tries to use the Canvas Hotspot (the "Canvas: Lift" object, using Variable: Check).  The game then runs one of two chains of Actions accordingly - and sets the value to True when run for the first time (using Variable: Set).

    A basic example, but larger and more complex logic-procressing still follows this general workflow.  Variables can be stored in two locations: Local (per-scene) and Global (scene-independent), according to when you need access to a stored value.

    This system is similar to the "Conditions" system used by Unity's Adventure Game tutorial.  However, since these Actions are all chained together in ActionLists, they can be used to create more complex interactions.  For example, if one condition is met, but not another, a new chain of Actions can be run to produce a different reaction.

    To test out later sections of a game, when you want to make certain assumptions about game progress (e.g. what "act" you're now in) you can use Variable Presets to bulk-assign variable values at once.

    Similar "check" Actions can also be used to process game logic - it doesn't have to be all Variables.  For example, the Inventory: Check Action can be used to determine if the player is carrying an item or not.  If a puzzle requires the player to possess three items, you could then use three Actions of this type in succession to determine if they have solved it.

    There are many approaches a designer can make so far as building such logic processes goes - particularly since each game involves different scenarious with different needs.  What AC tries to do is empower the designer to make such choices, without restricting them to "one set way".

    Are there any specific problems you'd like help with, or puzzles/logic you'd like advice on implementing?
  • Thanks for the quick reply Chris!
    The "survival game" I was referring to was a tutorial on creating a simple FPS with enemies spawning and just counting the score. Another tutorial was a simple 2D runner, same concept.
    With fully detailed scene building description and all the required scripting, but still nothing like a Syberia style adventure game for example.

    What I took away from the Unity Adventure Game tutorial was that there is a lot of scripting going on to check for performed (or not) actions, item in inventory and such.
    And since this needs to function scene independent (variables and inventory status has to be accessible regardless of the current scene the player is in), I was wondering if there are any tutorials that show this in more detail.
    Most of the tutorials have only a single scene in them and don't show the start 2 finish management of going through multiple scenes, collecting items and performing actions.

    Is a "master script" needed that works in the background and loads the appropriate scenes and keeps track of the score, loads the cut scenes when going from one scene to another?
    I feel like I'm stuck at the scene design level, and are missing the overarching game logic management.

    Thanks for your hints on storing variables local or globally. I would think that globally is the most appropriate method if they need to get accessed from within different scenes.

    Anyway - I'm rambling again.
    What I would really like to see is a tutorial with 3 simple scenes. As in a single room per scene (open box type) with an item to pick up and the ability to move to the next scene to pick up a second item. The third and final scene finishes the game by picking up a third item.
    The player is then being told that he/she has collected all items and the game is over.
    Maybe a cut scene at the and and in between scene changes.
    Nothing fancy - just super simple environments to illustrate the concept of start 2 finish an entire game.

    I'll dig into AC and see if I can figure out how to create that overarching game flow.
    And I also wanted to thank you for your fantastic tutorials Chris. Really well done!
    (What's with all the sirens in the background though..? You live near a hospital?)

    Regards and have a good weekend,
    Kay
  • There's not too much missing apart from switching scenes... Are you sure you're not confusing Unity's Adventure Game tutorials with Chris's Adventure Creator tutorials?

    Variables will take care of themselves, you've got your save scripts for hotspots, triggers, conversations & general game logic, and your inventory will be saved between scenes without any additional scripting. Cut-scene's will be triggered depending on whether you're checking a variable of whether it should be played or not in your particular Action List, for example.

  • Thanks for your feedback Deckard_89.

    The complexity of the Unity tutorial was what made me look into AC in the first place.
    I'm no stranger to coding, but what those guys were doing towards the end in the Unity series made me zone out.
    So, I'm hoping that AC will make this less painful. I'll just give it a shot.

    I guess I'm just surprised that 99% of the tutorials I've seen deal with bits and pieces of game development. Particles, mecanim, GUI buttons, NPC AI's. It's all there. And very well done.
    But a full game flow from "New Game" to "Finished" - not so much. Just seems strange to me.

    Thanks,
    Kay

  • edited September 2017
    In answer to your question: no "master script" is needed on the designer's part.  AC handles all the scene-management, variable-tracking, and cutscene-playing in the background - leaving you free to focus on design.

    When custom scripting is necessary, it's generally to add on some non-adventure-game element or do something very specific to your own game's needs.  For most cases, however, all of the overall game management is automatic.

    Regarding local vs global variables: yes, global should be used whenever one must be accessed in another scene.  It's good practice to leave variables as local when possible, though, as it keeps the Global Variables list less cluttered.

    Certainly, the video tutorials do try to encapsulate a (albeit small) game from start to finish in that they take you through how to get an item, and use it on somewhere else.  The 3D tutorial, for example, has the player pick up an instruction manual and use it on a control panel to free an NPC.  To make that the "end" of your game, you need only finish up the Cutscene with an Engine: End game Action to actually have the game quit or restart.

    Here's a summary of how you might achieve your "three room" scenario below:

    1) Use the New Game Wizard to create your own set of Managers (Section 1.3.1 of the Manual)
    2) Use the Character Wizard to create a Player, (Section 3.1)
    3) Create three inventory items in the Inventory Manager named "Item A", "Item B" and "Item C".
    4) Create the first scene, which has graphics for a floor, walls, and a door.  For info on how to set up a scene with navigation etc, see the other tutorials and Sections 1.4 to 1.6
    5) Place a graphic in the scene to represent item A
    6) Use the Scene Manager to create a Hotspot over this new graphic, and create a new Use Interaction for it
    7) In the Interaction's ActionList, give it a Hotspot: Enable or disable Action (to disable the Hotspot), an Inventory: Add or remove Action (to add Item A to the player's inventory), and an Object: Set visibility Action (to hide the graphic)
    8) To ensure the changes to the Hotspot and graphic in the scene get saved, give them the RememberHotspot and RememberVisibility Actions respectively.  More on saving scene objects can be found in Section 9.1.1.
    9) Create an ActionList asset (Section 5.9), which we'll run whenever an item is picked up.  We'll use this same ActionList for all three items, so by making it an asset we can call it from any scene
    10) Give this asset three Inventory: Check Actions to check if the player is carrying all three items.  This can be done by having each check for a different item, and each only linking to the next if the condition is met.  I can provide screenshots on this if you need
    11) If the third Inventory: Check Action's condition is met (and therefore all three), wire up a Dialogue: Play speech to have the player say something along the lines of "I now have all three items", followed by an Engine: End game Action to end the game.
    12) Back to the scene graphic's "Use Interaction", create a new ActionList: Run Action to run this ActionList asset.
    13) Create a new Hotspot over the door graphic, and give it its own "Use Interaction".  In this Interaction's ActionList, make a Scene: Switch Action, and enter in the name of a new scene which you'll create later (e.g. "Scene 2").
    14) Save the scene (as e.g. "Scene 1") and duplicate it twice, naming them Scene 2 and Scene 3 respectively
    15) Open up Scene 2, and amend the item's graphic so that it represents Item B, and change it's ActionList so that it adds "Item B" instead if "Item A".
    16) Amend the door Hotspot's Interaction ActionList so that it switches to Scene 3 instead.
    17) Open up Scene 3, and remove the Door and Door Hotspots
    18) Make the same change to the item's graphic so that it represents / adds Item 3
    *EDIT* 19) Add all three scenes to Unity's Build settings

    By using the ActionList asset to work out what the player is carrying, this can be run from any scene.  We could also use Variables to keep track of how many items the player has picked up (increasing a "Score" integer by one each time), but again it's really up to the designer how they want to approach it.
  • Great - thanks so much Chris!

    This should be more than enough to get me going.
    And well explained, as always.

    Regards,
    Kay
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.