From our very own Katie Hallahan:
Every game needs logic–and that doesn’t just mean the story and puzzles making sense! Logic, or logic scripting, is a part of the programming in the game engine that tells the game what to do. Logic is how the game knows what interactions are available to the player, and what should happen when they activate those interactions.
For Cognition, Moebius, and TSL Episode 5, we use a visual logic scripting tool in Unity that looks more or less like a flowchart. This is great for people like me, who know nothing about programming, as it’s much easier to follow, work with, and even put together. So no longer does a scripter need intimate knowledge of a programming language to help put the game together!
So, how does it all work? Let’s take an example from Episode 1. Now, as you can clearly see here….
Just kidding. :) That’s a little look at how complicated the logic can get, however, and this is tiny peek at all the things the game looks for when you walk into the FBI Main Station every time!
For real this time, let’s look at something a little simpler. :) Clicking on the image below will make it easier to read and follow along.
These are the interactions for the gate in the opening scene of Episode 1. What we first do is identify for the game what object we’re referring to–the gate–which is done in the scene itself. That purple lozenge labeled “GateDoor_InteractionMesh” is tied to the gate itself. From there, we tell the game to build an action wheel for available actions with the gate. In this case, Erica can Look at the gate, try to Open the gate, and Use her Gun on the gate. When a player clicks on one of these interactions, the game then checks for variables, also called Booleans, with the “Compare Bool” box. In this case, it’s checking whether or not Erica has already shot the padlock on the gate.
If she hasn’t shot it off, then the game gives specific reactions that are defined in the cinematic sequences. If she tries to open the gate, she struggles with the lock and has a conversation with John about it. If she looks at it, she’ll notice that the lock is still there. If she uses her gun, she’ll pull it out and fire a round into the padlock to break it. This action will change the variable, so that the game now knows the lock has been broken and the interactions change. These variables are also called “Booleans”, so “SetBool” is the logic that switches that setting.
At this point, if the player tries to open the gate, Erica will do something different–she’ll remove the chain and padlock, push the gate open, and enter the cemetery. This also changes the scene, something else that is set in the cinematic sequence.
Other actions that are defined here are the hints in Erica’s phone. After Erica tries to open the gate once, she can text her dad for a hint about how to get inside. Once she shoots the lock, that hint is removed (regardless or whether the player has looked at it or not), as she no longer needs it.
These variables are constantly being checked in a game–anytime something changes, like the topics you can talk to someone about, whether a particular location is available yet or not, whether a character is in a scene or if they walk out and leave that scene. This is the logic of the game–and like many things, without logic, it just wouldn’t work!
Social Media Intern, Phoenix Online read