Oct 9, 2015

Suzy Cube Update: Friday Octobre 9, 2015

#suzycube #gamedev #indiedev #madewithunity 

Oooh! This is going to be a meaty one! Lots of work done on the boss this week. It's pretty much done except for polish items.
It's all about making the boss interactive this week. So, let's look at things in order, starting with the new stuff I had to build in order to support all the different things I want the bosses to be able to throw at Suzy (like the devastating wave attack at the top of the post) and then finish off with an explanation of just how the boss works.

Show Me What You Can Do


Dropper cannons and lava puddles

First we have lava puddles. These are persistent hazards which are generated here from lava balls dropping in from above. They will also be useful for other enemies and as the foundation for other types of persistent hazards. Oooh the possibilities!

Lava columns!

These are another hazard that will serve me well on lava themed levels. They are pretty directly "inspired" by similar hazards found in Super Mario 3D Land, but c'mon, how cool do these look? I'm sure you've noticed the scrolling texture effect. I used Shader Forge to create two variations of a scrolling texture shader, one with alpha and one without. The columns are composed of two objects, an inner one which scrolls a gradient and an outer one which scrolls the drippy looking effect with transparency. You can see these shaders in use in various ways throughout this post.

Dropping in for a visit

Here we have an example of a simple system for dropping objects onto the play field. You can see the boss summon four Rock Skulls and the Ground Pound power up needed to crush them. Or you could just wait for the boss' next wave attack that will make short work of them!

Shockwaves

And, finally, we have shockwaves! Notice the fiery coloured squares that grow out from the rock impacts. Suzy must jump over them in order to avoid getting hurt. These shockwaves are another example of reusable foundation work. I wrote a system which allows me to create highly configurable variations on these shockwaves by tweaking parameters such as distance, speed and size among others.

The inner workings of the shockwave

Internally, the shockwave is composed of four capsule colliders. The visible part of the effect is actually a skinned mesh with a joint at each corner. These joints are moved out along with the colliders (represented by the spheres in the example above) causing the shockwave to expand without scaling up.

Show Me How You Do It


Until this morning, I was manually setting off all these cool boss attacks to test them. Then, along came the sequencer system and that's when the fight got real!

Driving the boss' behaviour is a three tiered system. At the top we have the Boss Master Script, then the Sequencer Scripts and finally the individual Action Scripts.

Diagram of the boss' brain

The Master Script handles those things which are true for all of the game's bosses. Things like detecting when the boss is hit, triggering hit reaction animations and tracking hit points. This script also handles other functionality like setting off the death sequence when the boss runs out of hit points and whether or not the boss should currently be tracking the player, which is useful for several of the attacks. This script's other important job is to manage which sequence should currently be active based on the boss' hit points as well as sending ActionDone messages to the currently active Sequencer Script.

The boss has one Sequencer Script assigned per hit point. Each time the boss is hit, the Master Script switches off the current active Sequencer Script and activates the next one. While the Master Script handles which sequence is currently active, it's the Sequencer Scripts which activate the boss' various attacks. When the Master Script tells a Sequencer Script to activate, this causes an initial start action to happen. This is a one time action which can be used, for instance, to allow the boss to perform a particularly large attack that won't be repeated again during the sequence. The Sequencer Script simply activates the next Action in its list then waits to get an ActionDone message back from the Master Script in order to move on to the next Action. If the Sequencer runs out of Actions, it just loops through the list again.

Finally, we have the Action Scripts themselves. Each script handles firing off one type of action such as spitting fire down at the player, or roaring to summon minions onto the play field. Each Action Script also contains all the configurable parameters for each particular action. These could be how long to wait while idle, or how many fireballs to spit out in a volley. This also means that different versions of the same Action Script can be attached to the boss in order to allow it to, say, spit volleys of three fireballs when at full health or spit volleys of five fireballs when down to one hit point, all managed by the Sequencer Scripts, of course.

Well, there you have it! The boss functionality is done. I still have some stuff to polish up before moving on but, at least, I can go into this long weekend with a huge weight off my shoulders!

I wonder what I'll talk about next week... Time to check my todo list!

















No comments:

Post a Comment