Welcome back to the Little Squid Dev Blog!
Another week, another update. Not much was worked on as our attention was diverted elsewhere for most of this week. But don't fret, there's still some tasty morsels of things to look at and we'll dive back in to a few more technicalities of how B-Side works.
Expand the knowledge
Since there isn't much to else to talk about this week, it might be fun to expand just a little bit on what we talked about last week and how it relates to this new behavior with the other characters following you between levels. If you haven't read that update, here's the link again, it'll help to have the context of how Unity works as a baseline. And again, to prevent losing everyone's attention, we won't go into excruciating detail about anything here.
So we talked about how Unity revolves around the use of GameObjects within Scenes and how GameObjects essentially are players, props, scenery, anything within the game and Scenes can be easily thought of as "levels". But how does an event happen within the game like a new element being introduced, or player death, or even just the level switching like in the video above?
That's where something called "trigger volumes" come in.
Trigger volumes are widely used across all kinds of games to...well..."trigger" events within the game. "Volumes" refers to a shape like a cube, sphere, or rectangle that is usually invisible in the game world that determines where the trigger is...triggered. Within Unity, these trigger volumes are represented as GameObjects.
It's most often used in regards to the player and their position. It can be something simple like "when the player moves into this trigger at the end of the level, end the level" or something more complex like "when the player moves into this trigger at the top of a hill, increase the progress tracker and start saving the game and spawn the main enemy off-screen and deactivate all other enemies and" -- you get it.
The point is that trigger volumes are specifically focused on locations within a game and don't do anything unless some object within the game "hits" the trigger volume. Once something hits that volume, a Script (remember from last week?) takes care of the "what happens" part.
This is different than purely code-based triggers that don't rely on locations within the game and could be something like "when player shoots, decrease number of available shots." Does that make sense? I'm not sure...
Someone's following you
How does any of that trigger volume nonsense relate to B-Side? And specifically the way levels are loaded/the characters following you? Turns out, trigger volumes are used all over the place.
This picture is showing a trigger near the beginning of a level, and this one is for loading the next level in the background. Essentially when the player hits this particular trigger, the next level in the game starts to load in the background and after a couple seconds, the level is fully loaded. Pretty simple.
This picture is meant to show that there are triggers at the end of every level/puzzle. These particular triggers are for moving the camera to the next level. When the player hits the trigger, the camera moves down to the next level. Also pretty simple.
By proxy, this trigger is also what starts moving the other characters in the level (if there are any). Once the trigger is hit and the camera moves to the next level, the other character moves to a position just slightly above the new camera position, then moves into the level. If you look closely at the video above, you might be able to see the moment the yellow character moves into the new level!
We hope that little explanation of trigger volumes wasn't too boring and you learned something interesting! It can be fun to talk about the technicalities of how the game is made, but we obviously don't want to give everything away ;) If you want us to keep going into topics like this though, let us know in the comments and we'd be happy to give some more inside looks!