Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs or learn how to Submit Your Own Blog Post
This week is less code-y and more theory; I've written an overview of how my interactive object system works
Just like in all point and click adventure games our game’s world is populated with many objects which can be interacted with in many ways. The actions themselves vary from game to game; sometimes you can pick from many different actions, sometimes only a few, sometimes they change with context and sometimes you’re left to try anything you like. In Arrival in Hell we’ve gone for a contextual system whereby the action is picked automatically based on what it is you’re interacting with.
Interaction systems vary between games
I created an ‘InteractiveObject’ script which I attached to every object the user could interact with in any way (click on). At first it was simple, you could just set the phrase for the main character to say when he interacts with it. I then added the ability for the character to walk to it, look at it, pick it up, interact with it, trigger a cutscene, trigger a puzzle… the list goes on. As it stands now there is a huge amount of configurable options on the single ‘InteractiveObject’ script, which, in hindsight, I would not recommend. If I redid this with what I know now, I’d opt for a few different interactive object scripts with different specialities.
All of the interactive objects in the first room
Here is a list of the configuration I can give to each interactive object, note that most of the parameters are optional:
Id: The id of the object used to select what the character says when it’s interacted with
Walk to: The transform the character should walk to when interacting (for example walking over to an item to pick it up)
Look at: The transform the character should look at when interacting (for example looking at the window)
Item: The item the player receives after interacting with this object
Pick up: Whether the character should physically pick the object up (most objects which give an item have this set)
If flag: This object can only be interacted with if a certain flag is set to true or false (configurable as well)
Set flag: Sets a flag once this object has been interacted with
Kill: Delete the object once it has been interacted with
Conversation: A conversation to trigger
Puzzle: A puzzle mini-game to trigger
Cutscene: A cutscene to trigger
The interactive objects can also specify the cursor to use and how the user interacts with them:
Click: The user simply clicks the object to interact, the cursor can be a hand (pick up), and eye (inspect) or a door (walk to)
Use item: The user must use an item from their inventory on this object to trigger it.
The last thing worth noting with the design of this system is that a single game object can have multiple InteractiveObject scripts attached. This is for when one object can be interacted with in many ways. An example of this is the lock on the cell door. The player can look at it, try and cut through it with a knife, or use something to burn through it. Each interaction has a different phrase and action.
Visualisation of the click-able area around an interactive object
That covers the logic behind the interactive objects, the final thing worth mentioning is that when you hover over an interactive object, it glows. I achieved this using the excellent Highlighting System from the Unity asset store. I highly recommend this asset, it’s a great effect and their customer support has been excellent.
Objects highlight when you roll over them
Sorry for the relatively short article this week, I wanted to go over the theory behind my interaction system since really everything in the game stems off of them. Next week I will explain how the character is animated to pick up any object from any location (the floor, a table, a shelf etc) without the need for any manual animation work.
Read more about:
Featured BlogsYou May Also Like