A downloadable game

Tokusatsu Panic! is my main portfolio piece for the Mastered Game Development course, as a result its a labour of love made over several months compared to my one day challenges. 

Tokusatsu Panic! is a soulslike action game, however with a level based approach with specific objectives instead of a wide open world. Use stealth to avoid enemies or take them head on with your array of attacks and dodge roll, the choice is yours. You can read more about the design in my design documentation here. Design Folder Drive Link


You can download the game here: Game Google Drive Link

And find the Git repo here: https://github.com/Woeger/Tokusatsu-Panic

CONTROLS:

WASD: Movement

Space: Jump (Press again while in the air for a double jump)

Mouse: Look around

Left Click: Attack (Must have weapon equipped)

E: Equip/Unequip Weapon

Left Shift: Roll

CODE:

While I'd like to talk about all the cool bits of code that are happening with this project, there is a lot! So I'm going to keep it down to a few highlights. 

One of the features I'm most proud of in this project is the directional hit reactions. These not only look cool when a player or enemy is hit, but they have real game design repercussions as you can be interrupted while in an attack or knocked back into a strategic location (such as into another enemies attack!). I accomplish this with the below code in CharacterBase.cpp

I've commented this code quite a bit for my own sake, but I'll still run through what's happening. This code is based on some simple trigonometry (excuse the pun.). When a character is hit, the box sweep we use will generate a hit at the location the weapon collides with the container used for hit detection. However that isn't enough to work out where a character has been hit (which is needed to play the right hit reaction) as we need to know the angle relative to the characters forward vector to know what direction to stumble in. 

As such, the first thing we do is get the forward vector and store it as a local vector. We already have a vector for our impact, but we change the Z component of this to be the same as our actor getting hit as this makes our calculations a bit easier. Next we normalise that same vector as the following operations wont work otherwise. 

We then use our first trig operation, the dot product, inputting our forward vector and hit vector. This allows us to find out what the angle is from where the character is facing to where the location of the hit is. (After finding the Cos-1 of our dot product result, of course.) We convert this into degrees which are a bit easier to deal with and we're done, right?

Not right. We have the angle between these two vectors, but without the magnitude we still don't have our intended result. Without the magnitude we can't tell left from right. To fix this issue, we use our other trig operation, the cross product. This will let us know if the angle is positive or negative, with that information we adjust the angle accordingly.

Now we have our angle, the rest is simple. Thinking of a circle around our character, we use a big else if block with inequalities equating to the angle range of each direction and set our SectionName for the animation montage we're about to play accordingly. 

Once this is done, all we have to do is play that montage. I have a helper function to help me accomplish this. The function is already quite long and it helps with readability as a result.

Leave a comment

Log in with itch.io to leave a comment.