This is a good one, Jack – The Circus of Illusion is the third game made by Emperium, produced in 2 months and displayed in June 2016. It is an adventure game with third person combat, arena bosses, and plenty of mechanics. The main character is Jack, a magician robot with electric powers. He can attack his enemies by both melee and lightning attacks. If you want to know more about story and design, check the game designer’s post. This project has proven to be a little more challenging than the previous one, Kitsune, because it would have 3 different enemies, a boss, ingame cinematics and advanced character mechanics like third-person combat. You can check the gameplay footage we recorded here. While working on it, I decided to replace using colliders for everything by raycasts, and it really improved the overall quality of the game.
This robot is the main character, and he can perform a melee combo to attack his enemies as well as shoot lightning on them! Isn’t that awesome?
It is awesome, but it is limited, this blue light on his back indicates how much energy he has to shoot lightnings, and when it turns red, means no lightning. To make this lightning work properly 2 Raycasts happen: one starting on the camera, and another one, starting on Jack’s hand, and then it traces where the target hits. If the camera can see a target, but his hand does not have a clear shot, he will shoot the right direction, but the lightning will not hit the target, it will stop on the first obstacle (for example a wall).
The visual behavior of the lightning is a set of LineRenderers getting its points’ positions randomized controlled by a Coroutine. Next, we have his third-person combat where no Colliders are used. “Wait, you said no Colliders?” Yes, that’s correct, three things happen here to make this third person combat possible: a Physics.OverlapBox to check the nearby colliders, an Interface to sucessfully apply damage to those who were hit, and finally the use of Animation Events which has proven to be a very useful functionality for this system to work properly. That was a lot of learning in just one character. Again, different from Kitsune, I have not used Rigidbody here.
Ah, well, this blue light I’ve mentioned before is a simple Light attached to one of his bones, which I control intensity and color by code. There is also another Light that gets attached before the last point of the lightning. As the interface of this game was full diegetic, the low health feedbacks are done by a series of Particle Systems that gets triggered by code too.
We have two types of minions: the mechanic, and the crafter. The mechanic is a simple enemy, he chases the player whenever he gets in range, and if close enough to attack, he attacks. His attacks have a small chance to stun the player, and these attacks have a Particle System feedback.
The crafter has a rocket on his back, and deploys bombs whenever he spots the player. These bombs will follow the player and arm themselves to destroy after a short time if they get in range. If the player approaches the crafter too close or if he damages him with lightning, he will light up the rocket, fly towards the player and then explode dealing damage. Here we have a lot of Particle System uses as well.
As you can see, I couldn’t use more Particle Systems on a single project, but hey, there’s still much more! The Clown is a ranged enemy that shoots the player whenever he gets in range, and guess what? The projectile has its own Particle System too, and it deals damage via OnParticleCollision(GameObject other) (I was impressed too when I first figured this out). The whole system works very well, and he always will aim in the player direction.
Saving the best for last! The boss was the best part of developing the enemies. There is a few things to comment about him. First of all, he spawns 3 types of ballons: red, green and blue. The red only deals damage, while the blue stuns and the green one drops one item (can be a life or energy item). They are simple objects with a SphereCollider as Trigger, and they explode some time after the player entered the trigger. Oh yes, to make them work properly and to have a better organized code, they all have their classes inherit from a base Balloon class, which would contain all base logic, and their individual classes would only have to deal with the trigger event.
Next we have the boss attacks: a mid range hand attack (that can be either the right or the left hand, based on a 50-50 chance), a close range nose explosion attack, and a long range water shower. The hand attack is pretty simple, remember when I said “NO COLLIDERS” back on Jack’s description? It’s basically the same thing here, exact same system, also because it uses the same Interface as every melee attacker (IMeleeAttackable).
Now for the nose explosion attack, if you watched the video you can see that Jack is knocked far from the boss, but hey, I said “NO RIGIDBODY” as well didn’t I? Yeah, right, this was a little tricky to do without one, but we made it. As we were already using a custom gravity simulation to Jack’s jumps, it was just the same logic as the Rigidbody would use, to apply a force in a direction and see the magic happen. Finally we have his water shower attack. I’ll give you one shot to figure how I did it. Yes, right, Particle Systems (oh that again). It also works very close to the Clown’s projectile, it’s a Particle System with collisions that triggers the OnParticleCollision event. When he dies, he triggers an animation and our demo goes straight to the credits.
What I have learned
Wow, we covered a lot already. As you can see, this was a short and kind of simple project, featured a few enemies, a very short level design and yet, I learned so many things. Starting with the uses of the Particle System (it’s the last time, I promise), I have discovered a lot of new uses and possibilities for it, and the highest point is the collision events, which I didn’t know that could be driven by particles.
I finally managed to create a working third person camera, that avoids every obstacle and behaves like it should. Most of its code was developed in Kitsune and upgraded here. Then, the third person combat without colliders. A lot of references helped me with this one, I can’t count how many times I watched Dark Souls gameplay footages to understand the system.
Last but not least, we have the Lightning, which was to me the greatest thing I’ve done on this project. The use of LineRenderers and double-Raycasting via camera and lightning origin was some of the most complex systems I made, and the result was extremely satisfying.
And here we finish this post (sadly). If you want to know more, let me know, I will soon post my next projects!