Character system in top down game

by | Apr 4, 2019 | Blog, Show Off, Unreal Engine 4

I slightly mentioned this system previously in my post about my inventory system. It us a complete character system with a lot statistics. I mostly took inspiration from Dota and Diablo. I have played both these games for some time and decided this would be the best place to look for inspiration. It also suits very well with the game I am trying to make, which is top down.

The system contains three main attributes. Strength, dexterity and intelligence. The character can have one of these as their main attribute. They still gain advantages from the other two attributes. Example, main attribute strength also gains attack speed from dexterity, but not as much as a character with dexterity as his main attribute. Depending on what you want and how you want your characters main attributes to effect the gameplay you can say that 1 strength point gives 10 hp to all heroes, but if it is your main attribute, you don’t gain 10 hp per strength point, but 18 hp per strength point. So it’s an advantage to use strength items if your main attribute is strength.

Calculate health, strength heroes gain more health per strength point.

Other advantages for main attributes are :

  • Main attribute strength gives higher health regeneration and higher health.
  • Main attribute dexterity gives higher move speed armor and attack speed.
  • Main intelligence gives higher vision, mana and mana regeneration.

I have yet to balance this system out so changes may occur. It is probably going to be hard yo balance out.

Much like other action rpgs I have a total x of an attribute, base x of an attribute and bonus x of an attribute. The base is what the character start with. Bonus is whatever the character gains from items, level up and potions/spells. Total is everything combined. I have considered making one separate for level up, so I can see the total gain for just level up attribute points.

When you equip an item you get a bonus, and then the total, base and bonus is calculated and added upon each other. Then other attributes that are effected are calculated as well. Example, total strength is calculated and then total health and health regeneration is calculated, because strength effects health and health regeneration.

Character stat system without equipment
Character stat system with equipment

For every attribute there is I have made a function that adds or subtracts x number of points. These are added in the bonus. Then I have a function that calculates the total amount with the main attribute taken into consideration. These are the ones I use to receive and update the attributes.

This system also work on enemies, all except experience points and of course the visual post process effect of light surrounding the character. Other than that they will evade, have strength, armor etc. They do give experience points to the player on death if the player is close enough. I don’t know yet how I will balance it all, I do think I will need some sort of level multiplier. I am toying around with the idea that every enemy is tested on level 1 and then multiply the attributes with a level multiplier then it takes the players level into consideration. It will demand a lot of testing on different levels with different heroes. I think the first true ai test will just be a melee thug with no spells. I have only coded the ai really simple for now.

The damage on a hit is calculated a little differently than the rest. I made two functions. One I called receive damage and the other I called give damage. Receive damage first has to take into consideration if you evaded the hit, then it calculates how many hitpoints your armor protects you from and then subtracts that from the damage received. So if an enemy hits my character it checks with both armor and evade. The give damage function however first needs to check if you give a critical strike then how much your critical strike is in hitpoints, then add the normal damage and then send out the final damage given. This way critical strike, critical damage, evade and armor are all taken into consideration in a battle.

Enemy misses the player character when player character has evasion.

The attack animation had to take into consideration the attack speed. The faster you attack the faster the animation has to move. That’s why I made the attack animation run over 30 frames, 1 second. It makes it easier to calculate and then scale in the animation blueprint.

Last comes the move speed and the vision around the character. This is calculated and updated as any other attribute. Total, base and bonus. But these are special and also needs to be updated on the character. We need to update the movement component, the vision collision and the vision post process effect to make these take effect.

I have considered making other new attributes, I thought it might be fun with a “Luck” skill point that gives small percentage chance for some ekstra damage or a small chance to help you out in situations I in other features of the game that I am planning to add later.

If you want to the items with attributes effect the character I demonstrated this in my inventory video in this blog post.

Currently I am going over to low poly modelling for a little while. I am just now trying to work in Blender. I have a decade of experience in 3d studio max, but have not been satisfied with the workflow and speed of max.

We will see where the road goes … Cheers ..