Combat Scripting
Here I’ll talk a bit about the standard (non bossfight) combat encounters in Ray’s the Dead.
Combat in Ray’s the Dead is unusual and therefore has a lot to consider. The avatar the player controls (Ray) can attack on his own, but is not effective in most scenarios. A skilled player will effectively use their different minion types by sending the correct minion to an enemy that is weak against it, at the right time.
Most enemy types can be defeated just by piling on damage, but can be much more efficiently defeated if you attack with the correct type of minion in the correct way. A single enemy can be taken out with one shot by the correct minion, whereas he might require 20 enemies piling on him doing minimal damage if they are not the correct type. So its a bit of a puzzle and asks the player to pay attention and make good choices.
Additionally, the minions can be called back to Ray and form a (in)human shield in front of him, blocking oncoming attacks.
Most encounters are initiated by the player walking into an invisible trigger volume. The script initiating combat usually dislodges the camera from the player, moving it into a fixed location that not only gives the player a better vantage point, but also locks the player to this section of the environment until the encounter is complete. It also fires off some “ready to rumble” music!
While the camera is gliding into position, we begin to spawn enemies. The enemies always spawn either off screen or from behind an on-screen object. The objective is to have the enemies appear in a natural way rather than just materializing out of thin air.
There are usually 2 - 3 enemies at a time. They are chosen based on the abilities and minions the player has at this point in the game / level, and also based on what enemies they have already been introduced to.
As the enemies are spawned we start tracking the status of the combat. In the background I have a script that is constantly checking on the well-being of these enemies. What we do with that information can be used in various ways.
Sometimes we wait until all enemies are reported deceased, then either spawn more or end the combat. Sometimes when say, 2 out of 4 of the enemies are reported deceased, we will spawn another couple of enemies to replace them. Each combat scenario is different but there is always a script tracking enemies, spawning enemies, and then ending combat when the requirements are met.
We are also mindful of the players location. For the most part combat in Ray’s the Dead is most fun / effective when you are at a distance from the enemies. Therefore, we have a variety of spots the enemies can spawn from and will usually (but not always) choose a spot that is as far from the player as possible.
When the requirements are met, the camera dislodges from its fixed location and interpolates back to its position behind the player. The music returns to normal and the player carries on their way.
The combat in Ray’s the Dead ended up being a bit of a mixed bag. It asks a lot of the player. It can be very easy for those paying attention and can go to hell very quickly for those that don’t. It has moments where it feels really good and others where it doesn’t feel good at all.
There are definitely things we could have done better but ultimately I’m proud that we took a chance coming up with something that is very uncommon, and I like the end result.