Phae Project Dev Log 20: Started the dodge ability

Phae Project Dev Log 20: Started the dodge ability

Dev Log 20

I’m finally progressing at a reasonable pace again. And I am really happy with what I was able to achieve this week. I finally fixed the attack rotation and started writing a new ability from scratch. I started with the dodge ability because I thought it would add a lot to the combat and that it would not be too hard to make.

Here is the breakdown of this week:

Tuesday: 0h

Wednesday : 0h

Thursday : 0h

Friday : 8h

I was looking in ways I could change the look of my game a bit because visually it has not changed in a while. While I was searching for a new toon shader to replace Toony Colors Pro 2, while it’s not working with 2019.1, I found these samples from Unity github.

It shows some samples of Render passes for LWRP. It’s pretty cool so even though I won’t be necessarily using it for my game I thought it would be interesting to share.

I might have already shared this link about how to make a toon shader similar to Zelda BTW but just in case I’m adding it again: zelda inspired toon shading

I didn’t want to make such a complex shader right now because there’s 99% I will want to do something else later. So instead I used what I learned to make a very simple toon shaded look.

Note that I am using ASE but I’m pretty sure I could have used shader graph for a simple shader like this. As you can see I take the lighting direction and object world space vertex normals. With that I can deduce which part of the objects needs to be lit and which part should be unlit. I use a threshold for better control. I then multiply the input texture with a color for both the lit and unlit part. Finally I add the light color and intensity so that the object fits in the scene correctly.

And with that I got my own toon shader.

It looks almost like what I had before the update.

After that I decided to stop procrastinating and finally try to fix my attack rotation problem. It was very simple I just had to remove the wrong rotation implementation from the MeleeWeapon script I had previously written. I wrote an ability which restricts the rotation of the character while it is active, and use the weapon script to set the target and activate the rotation restriction. It was very simple, even though it took me a few hours to get it done.

With that out of the way I can finally start to implement some new things. There are so many things to do that I’m not sure which ones I should do first.

I’m thinking that I will start with a dodge ability. And then I’ll work on the enemy character AI. The goal for the next few weeks will be to have a simple yet enjoyable combat.

Things I’ll do will be dodge roll, air dodging, and attack for the character. And then both the character and enemy will have some knockback and death animations. And finally the enemy won’t attack you non-stop. It will attack in combos and then stop while moving around the player. I will also add a repel/block/ignore damage enemy ability so that you cannot just spam the attack button and kill everything.

So that being said I finished the day by importing two animations from maximo for the roll dodge and the arial dodge. This weekend I’ll try to implement the dodge ability and I’ll continue from there.

Saturday : 3h

I started the day by adding damage visualization and die ability to my character. This was super easy. I just had to add the abilities that came with TPC without the need to change anything. From there I decided to add some script that would kill the character if he fell in an abyss. The Character Health component has some logic to damage/kill the character after a long fall, but it only does it once the character hits the ground. So I just looked the the code inside that component and inspired myself from there. Essentially I just damage the character with an infinite amount of damage once the transform y position is lower than a certain amount. I just need to make sure to build my levels always above that amount and everything will work as it should

I thought it would be a good thing to have that logic for both the character and the enemies and since the character and enemies will share a few other behavior/stats I decided to make a base class called RPGCharacter, which I’ll extend to PlayerCharacter for the main character. In the RPGCharacter script I will add stats such as strength, magic, resistance, weaknesses, etc… I won’t use them just yet but i added a few variables which I think will be useful.

Sunday : 2h

From there I started making the dodge ability. The goal is to start an animation and be invincible for a few milliseconds. Of course the dodge direction should be controlled by the input, if there is no input the dodge will go towards the character facing direction. I might replace the non-directional dodge by a block one day but this is how I’ll do it for now. Since there are two dodge animations one for ground-roll and aerial dodge I setup the animator sub-state as shown:

Note that the way Opsive TPC deals with animation is by having substates that get transition to from any state. It controls the animations through the parameters which were very smartly set up. In my case i will transition to the dodge animation when I trigger an ability change + that ability has the ID specified + the ability has the int parameter specified. This allows my to match the ID to my Dodge ability ID and use the int ability parameter to specify if I should do a aerial dodge (1) or a roll dodge (0). I really like this approach to the animator because it removes a lot of the state-machine graph hell where arrows are going in every direction and you can’t figure out how things are structured.

Once the animator was correctly set up I made the Dodge ability which makes the character invincible while the ability is active. The ability stops when the animation event I added on the dodge animation tells it to. And just like that I have my dodge ability working. My only concern is that the aerial dodge always goes on one side. So I’m thinking that I could do something slightly different. Either change the animation so that it dodges forwards instead of on a side, or maybe dodge on place and it could randomly choose to twirl left or right.

I will also need to add special effects to make it more impressive. But that will be for another time.

Here is the result so far:

Monday: 0h

Recap: 13h

  • Created a very simple toon shader to replace the TCP2 which does not work in 2019.1
  • Finally fixed the character rotation when attacking
  • Added death and hurt ability to the main character
  • Added death when falling in an abyss
  • Started the dodge ability (still needs a bit of work)

I am finally done with the character rotation… I can’t believe I kept pushing it for later even though it was so simple. But now that it is done I was able to make some progress! I think the dodge ability turned out great. I still want to tweak a few things for the aerial dodge, for example less gravity and dashing forward a bit. We will see how far I take it next week. Apart from that I would like to make use of character stats to change damage dealt and I would also like to make a damage popUp which has coloration for critical and weakness/resistant/Absorb/heal damage. We’ll see how far I take it. I won’t take it too far because I am guessing that It will most likely replaced by something from the Inventory System I am working on for Opsive.

Until next week!

Author face

Santiago Rubio (Sangemdoko)

A electronics and information engineer who works on game development in his free time. He created Sleeping Penguinz to publish the games he makes with his friends and familly.

Recent post