🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to design balanced unit recruitment cost?

Started by
3 comments, last by Logende 4 years, 10 months ago

Hey guys,

I am Felix (computer science student, 21 years old) and completely new here. I will try to not ask any trivial questions that could be quickly answered via Google, yet if I should behave inappropriately in any way, please let me know.

 

About the project

I am not a professional game developer, however, I really love designing and creating my own games. In my free time, I am working on a 2d mobile game. I have completed a sidescroller action game many months ago and am now working on a "castle defense game" similar to the games "Age of War" or the mobile games "Legendary Wars" and "Monster Wars". The player and his enemy both own a castle, which they use to build units, which then fight against the units of the opposing player. The goal is to reach the enemy castle and to destroy it. 

 

Screenshot of old prototype:

cd_1.thumb.png.6bcc64987106234d0fab14c182be7ec2.png

 

Note: Please don't be too harsh. I know that most of your projects have a higher quality and are more polished than my game and I am fine with that. My goal is not revolutionizing the gaming industry, but creating a simple game that satisfies myself and is fun to play. Me (ideas, programming) and my brother (artwork) have put a lot of passion and time into this project. 

 

 

About units and skills

One major thing with which I am struggling since quite some time is balanced unit recruitment cost.

I have already read different articles (like this one) about balancing economies and item cost, yet I still struggle with a few concrete things. Before we get to the problem, I'll describe a few essential aspects of the game (simplified to make it easier to talk about them).

Skills (consist of)

  • Movement
    • Initial position relative to owner
    • Initial velocity
    • Constant acceleration
  • Damage

Examples for skills: axe (thrown, parabola-like movement), arrow (shot straight, small acceleration down due to gravity), boomerang (flies forward and after some time turns around and flies back to owner).

 

Units (consist of)

  • Health
  • One Skill
  • Skill cooldown (time until they can re-use skill after using it)

Examples for units: warrior with a lot of health and low range axe as skill, ranger with low health and long range arrows as skill.

 

The recruitment cost issue

It is really hard for me to find balanced and good unit prices. Just listening to my gut instinct (obviously) leads to random and unbalanced prices, therefore I am trying to go with logical formulas now.

The difficulties start with the movement of skills: Skills with the same damage can differ a lot in their effectiveness due to different kinds of movement. Fast long range skills are better than slow low range skills. My approach to deal with skill movement is simulating the skill movement and then generating a few metrics via the simulation results:

  • rangeMin, rangeMax
  • collisionPercentage (which part of the movement is the skill at the height of potential enemies? If the skill is in the air, above units, for a long time, the collisionPercentage is lower than for example a straight arrow)
  • Maybe I should additionally consider speed

 

Using those metrics I try to calculate unit cost. The main difficulty for me is combining the cost of unit health with the cost of unit damage. A ranger with low health and long range might cost 20 Gold and a warrior with high health and low range might cost 20 Gold too. Now, what should the price for a unit with both long range and high health be? The cost of a unit should consider:

  • Health
  • Range
  • tacticalDamage (= skill damage / skill cooldown)
  • other metrics from the movement, like collisionPercentage or skill speed
  • actually, some more attributes (like shields) which we ignore here for the sake of simplicity

 

My first approach was just adding the different values together, each with a different factor. For example "unit cost = health + 2*tacticalDamage + rangeCost". However, the results were rather random and units which were good everywhere were not expensive enough. The different attributes work together, kind of multiplying the effectiveness of the unit, while the cost was just an addition. Next, I tried some way of multiplying the different prices, however, the results were even worse, with the prices of the units having a huge difference.

I just seem to not get the prices right. When I try to keep the formulas simple, important properties are just ignored, however, when the formulas become too complex, it becomes hard to understand them and to work with them. One alternative approach I am considering is to introduce fix unit prices: My game will have three leagues, each with different tribes and units. All units within a league should be balanced. I am considering manually defining the cost of units in a league (for example every long range unit costs 20 Gold, every short range unit 15 gold, every boss 100 gold) and then trying to adapt the units (health, skill cooldown, etc.) to that fix cost. The fix prices might make the game less complex and easier for players to get into, however, I doubt I can really balance the game that way. 

 

Do you have any ideas or tips? Any help is greatly appreciated.

 

 

Best regards

Felix

 

 

 

 

Advertisement

I think you overcomplicate this. Finding a formula is very hard since there is SO many parameters in even a simple game like this. You will work very hard and in the end the formula will probably not magically give you good balanced costs for your game anyway.

Do a "design"-balance first. This is when you think broadly about what you want the feeling of the game units to be. for example:
a cheap unit - 100 gold
two medium units - 250 gold each but have different roles
a luxury "kick-ass" unit - 600 gold (this may be "normally not worth it" but good if you are swimming in cash, for example).

When your testers start testing the game, find out what is used and what isnt (you might be the only tester you have, this may be fine). If one unit is too good (is overly being bought compared to other things) --> either raise the price or lower the stats.

This should be the overall loop of balancing the unit costs. You may want to keep one unit very expensive (if this is what your design needs), so then you need to increase its power rather than decrease its cost if it's not being used (this of course depends of the type of game you make).

Makes sense to you?

Your game looks like it would be an excellent candidate for automated (AI vs AI) playtesting.

For starters, create one AI player for each unit type that only uses that unit type, and let them all play against each other.  If one of these players never loses, then the unit is obviously too powerful for its price.  If one of them never wins, then the unit is too weak for its price.

Then add a totally random player to the mix.  You generally want the random player to be able to win against the single unit strategies.  If it loses against one unit type, nerf that unit.

Finally, try some AIs that use actual strategies.  These can be simple strategies like "vary between units A and B" or complex strategies that look at what the opponent is doing and react to that.  You want to have several viable strategies, each of them with a viable counter-strategy that beats it, and you want all of them to consistently win against both the single-unit strategies and against the random strategy.

5 hours ago, suliman said:

I think you overcomplicate this. Finding a formula is very hard since there is SO many parameters in even a simple game like this. You will work very hard and in the end the formula will probably not magically give you good balanced costs for your game anyway.

Do a "design"-balance first. This is when you think broadly about what you want the feeling of the game units to be. for example:
a cheap unit - 100 gold
two medium units - 250 gold each but have different roles
a luxury "kick-ass" unit - 600 gold (this may be "normally not worth it" but good if you are swimming in cash, for example).

When your testers start testing the game, find out what is used and what isnt (you might be the only tester you have, this may be fine). If one unit is too good (is overly being bought compared to other things) --> either raise the price or lower the stats.

This should be the overall loop of balancing the unit costs. You may want to keep one unit very expensive (if this is what your design needs), so then you need to increase its power rather than decrease its cost if it's not being used (this of course depends of the type of game you make).

Makes sense to you?

 

Thank you very much for this useful reply. I agree that it might be hard to impossible to find the "perfect formula". This approach probably is the best, although I was trying to avoid it because it also requires quite some work. In my case, the game will consist of 3 leagues, each with around 7 tribes, each tribe having 4 units -> 3*7*4 = 84 units. To this point, I have not yet decided, whether every tribe will just have 4 "random units" (different units, but no clear rule for the kind of units) or whether it will have 4 distinct unit types, each tribe having the same types. Thinking about balancing units, and later creating the AI for the enemy player, I now choose to go with the 4 distinct unit types, being something like melee, ranged, mage, boss. Now I have two choices: Either I assign a fix unit recruitment cost for each unit type per league (for example 100 Gold for a boss in the bronze league) and then adapt all units to match their cost, or I define individual prices for every unit. I will probably go with the fix cost per unit type per league, however, I will need to play around with that, before I make a final decision. Creating and testing the three leagues step by step, I think I should be able to execute your approach.

 

4 hours ago, a light breeze said:

Your game looks like it would be an excellent candidate for automated (AI vs AI) playtesting.

For starters, create one AI player for each unit type that only uses that unit type, and let them all play against each other.  If one of these players never loses, then the unit is obviously too powerful for its price.  If one of them never wins, then the unit is too weak for its price.

Then add a totally random player to the mix.  You generally want the random player to be able to win against the single unit strategies.  If it loses against one unit type, nerf that unit.

Finally, try some AIs that use actual strategies.  These can be simple strategies like "vary between units A and B" or complex strategies that look at what the opponent is doing and react to that.  You want to have several viable strategies, each of them with a viable counter-strategy that beats it, and you want all of them to consistently win against both the single-unit strategies and against the random strategy.

 

Sounds interesting and good. Thanks for the hint :) That way I will for sure be able to spot a few unbalanced units and fix their attributes. Actually, besides hardcoding the AI, I already considered using unsupervised machine learning to create the enemy AI, not only because it might lead to really good results, but also because I want to collect experiences with machine learning. After coding the simple strategies you mentioned and later writing actual strategies, one final step might be using the machine learning based model to evaluate whether units are balanced. Additionally, the resulting models (hardcoded or machine learning based) can be used for the actual enemy AI that players will face.

This topic is closed to new replies.

Advertisement