Staredit Network

Staredit Network -> UMS Assistance -> Defense formula (Pure math)
Report, edit, etc...Posted by Gigins on 2006-11-19 at 16:07:04
I'm making a defense map and I've planned lots of levels(70). I'm pretty good at balancing stuff, (or so I like to think tongue.gif ) but to make it a bit more interesting, I've planned big variation in unit speed, counts and health. That would be more entertaining for the player but makes it pretty much impossible for me to balance it right.

So, I came with an idea of a formula that I could use for balancing. A formula that has all 3 factors (speed, health, count) and make it into a difficulty percentage. This way I could state the necessary difficulty percentage and desired factors like count and speed, and get the required health.

While I will try to develop this formula myself, I though that it would be stupid to not ask for help from the greatest minds around. So here is what I need in short.

a - Health; b - Speed; c - Count; x - Difficulty percentage.

Formula(a, b ,c) /100 = x

As for defense map, speed and health would be the strongest factors. Count on the other hand is less strong but it's significance grows when the first 2 get bigger.

As for armor upgrades, I think I will match them with the x.

Help me. wink.gif

Edit:Forgot the speed table. pinch.gif
QUOTE
* means speed upgrade.

Overlord................1.00x
Reaver..................2.09x
Battlecruiser...........2.95x
Guardian................2.95x
High Templar............3.90x
Observer................3.90x
Carrier.................3.09x
Overlord*...............4.03x
Hydralisk...............4.32x
Defiler.................4.65x
Zealot..................4.65x
Infested Kerrigan.......4.65x
Shuttle.................4.84x
Seige Tank..............4.84x
Marine..................4.84x (7.56x using Stim)
Ghost...................4.84x
Firebat.................4.84x (7.56x using Stim)
Medic...................4.84x
Goliath.................5.50x
Devourer................5.76x
Science Vessel..........5.76x
Dropship................5.76x
Scout...................5.76x
Arbiter.................5.76x
Observer*...............5.76x
Dark Templar............5.76x
Dark Archon.............5.76x
Archon..................5.76x
SCV.....................6.05x
Drone...................6.05x
Probe...................6.05x
Dragoon.................6.05x
Zergling................6.37x
Ultralisk...............6.37x
Hydralisk*..............6.72x
Infested Terran.........7.12x
Broodling...............7.12x
Lurker..................7.12x
Zealot*.................7.12x
Mutalisk................7.56x
Queen...................7.56x
Wraith..................7.56x
Valkyrie................7.56x
Corsair.................7.56x
Shuttle*................7.56x
Scourge.................8.07x
Vulture.................8.07x
Scout*..................8.07x
Ultralisk*..............9.31x
Zergling*...............10.08x
Vulture*................12.10x
Report, edit, etc...Posted by fritfrat(U) on 2006-11-19 at 16:26:51
There's a lot more to balancing it than just speed, health, and count. You won't come up with one formula that would actually fit all maps, and to make it fit to a map, you'd have to keep those other factors constant, which is no fun.

If you want to try anyways, just go ahead and multiply them together, dividing health by a constant (perhaps 100 or something) so it's under 100 and just square root the count value if you don't want it to be as significant.
Report, edit, etc...Posted by spinesheath on 2006-11-19 at 16:43:15
First off:

QUOTE(DEAD @ Nov 19 2006, 05:07 PM)
Formula(a, b ,c) /100 = x
[right][snapback]591633[/snapback][/right]


shouldn't it be f(a,b,c) * 100 = x ?
Normally you get something like 0.65 which then is 65%, so you have to multiply (1% = 1/100)

Well then, I'll just post some thoughts I'll be having right now while I post happy.gif

Variables I'll use: u,v,w; d,e,f

The first thing to work out would probably be this:
Is the function something like this

CODE
f(a,b,c) = (u * a) + (v * b) + (w * c)

Which would mean that a, b, c affect x independently.

As you already mentioned with "number gets more significant the higher speed and health are", I doubt it's that simple.

Ok, I'll try a basic formula... just an idea to discuss on.

CODE
f(a,b,c) = ((u * a) + (v * b))/d + (w * (a/e + b/f) * c)


some reasons: both speed and health have significant effects imo. u and v must be chosen to balance out a against b. As a and b rise, as you said, c becomes more significant. Therefore (a/e + b/f) must become significantly larger than 1 as a and be rise.
Maybe a root or a ² would suit this as well. I actually think that (a/e + b/f)² would give better results (as long as you can't wall on this map!)

Ok so much from me now. I hope this basic ideas will cause others to have better ones wink.gif This is so much out of the blue...
Report, edit, etc...Posted by Rantent on 2006-11-19 at 16:57:38
Forgive me if this is confusing, I'm just writing down thoughts.

speed ranges from 1-12
health ranges from 1-8388607
count ranges from 1-100 (for the safe side of placement errors)

Speed limits the ammount of times a unit can attack the enemy, health determines the ammount of times the units need to attack the enemy, count ranges the number of enemies to attack. You want difficulty.

health (a)
speed (b)
Count ©

lots of enemies + low health + low speed = The units you buy matters most. (a.k.a. fast attacking units pwn) ©

few enemies + low health + fast speed = Your position across the width of the field matters most. (a.k.a. If you can cover the width of the field you can kill them all, block them) (b)

few enemies + high health + slow speed = Your ability to continuously attack the enemy matters most. (a.k.a. If you can move your units to follow the tough units.) (a)

693273(b)+(a)+83886©=x (If we treat each aspect with equal importance.)
Position across the feild becomes the most important, Unit attack speed becomes second important, and Unit mobility becomes least important.

You may wish to scale those numbers down some, if you wish to use health points that max out below 8388607, but if your going to the game limits, then this equation should work.

lol, ( c ) becomes ©
Report, edit, etc...Posted by Zeratul_101 on 2006-11-19 at 17:10:39
err, i think you're forgetting to factor in unit size/damagae tpye
Report, edit, etc...Posted by spinesheath on 2006-11-19 at 17:21:16
Hm, I got another idea how you could find some decent formula, or maybe just levels (the formula alone would never give perfect results anyways, unit AI and size and whatnot do matter as well):

Create a test map, just a long path from top to bottom and some other stuff. You'll use this map to find out some values, maybe even set up some tables. From this you can either directly create levels or just try to find a formula.

On this map, you'd be able to create your own levels: Create a bunch of units with a certain amount of HP (this is the hardest part wink.gif ), and then activate some trigger that uses these units as a "level".
The units will walk the path from top to bottom, just a path straight down, no blocking stuff.
Along this path you build a row of bunkers (next to each other) with say 3 marines (normal damage type) each. The range of the marines has to cover the whole path.

Now if you can kill off the unit wave with exactly one bunker, this is a difficulty of 1%. Exactly 2 bunkers result in a difficulty of 2%, and so on.

Imo this would give you fairly good and standardized values, from which you can work out a good formula. Of course it would still require balancing in the actual map, but you can't get around this.
Report, edit, etc...Posted by fritfrat(U) on 2006-11-19 at 17:44:36
I think guessing and checking will form a much more balanced game than trying to come up with some sort of formula. There are many other factors, such as attack/armor type and how much damage is spent in overkill, and it would just be a lot easier to just make educated guesses and modify them from there through trial and error.

I won't bog up your topic, this'll be my last post on this point. But I really think it's necessary to recognize that any such formula that would truly be accurate would be so utterly and completely complex that it would take up weeks creating it and figuring out the constants, and your map would already be balanced by that point anyway in order to figure it out in the first place. And, because every defense is different in terrain, units you can buy, etc., you wouldn't be able to apply it to anything else.
Report, edit, etc...Posted by Ultramilkman on 2006-11-19 at 19:59:59
What kind of units do the players get? I mean if players can only get ghosts then they are pretty much doomed on Seige Tank level or Ultralisk level.
But on the other hand even if it's super speed Zergling level, ghosts can still own.

I do find HGMA really challenging (from level 2-7, and 11-13 if I remember correctly, and the final level) Maybe you can use it for reference.

Scout with speed is one of the hardest to kill if they come in group.
Report, edit, etc...Posted by Gigins on 2006-11-19 at 23:59:57
QUOTE(spinesheath @ Nov 20 2006, 12:43 AM)
First off:
shouldn't it be f(a,b,c) * 100 = x ?
Normally you get something like 0.65 which then is 65%, so you have to multiply (1% = 1/100)

Well then, I'll just post some thoughts I'll be having right now while I post happy.gif

Variables I'll use: u,v,w; d,e,f

The first thing to work out would probably be this:
Is the function something like this

CODE
f(a,b,c) = (u * a) + (v * b) + (w * c)

Which would mean that a, b, c affect x independently.

As you already mentioned with "number gets more significant the higher speed and health are", I doubt it's that simple.

Ok, I'll try a basic formula... just an idea to discuss on.

CODE
f(a,b,c) = ((u * a) + (v * b))/d + (w * (a/e + b/f) * c)


some reasons: both speed and health have significant effects imo. u and v must be chosen to balance out a against b. As a and b rise, as you said, c becomes more significant. Therefore (a/e + b/f) must become significantly larger than 1 as a and be rise.
Maybe a root or a ² would suit this as well. I actually think that (a/e + b/f)² would give better results (as long as you can't wall on this map!)

Ok so much from me now. I hope this basic ideas will cause others to have better ones wink.gif This is so much out of the blue...
[right][snapback]591648[/snapback][/right]

Interesting, but too much variables. The only actuall variables I need is a, b and c. The rest must either be certain mumbers or growing numbers.

QUOTE(Rantent @ Nov 20 2006, 12:57 AM)
Forgive me if this is confusing, I'm just writing down thoughts.

speed ranges from 1-12
health ranges from 1-8388607
count ranges from 1-100 (for the safe side of placement errors)

Speed limits the ammount of times a unit can attack the enemy, health determines the ammount of times the units need to attack the enemy, count ranges the number of enemies to attack. You want difficulty.

health (a)
speed (b)
Count ©

lots of enemies + low health + low speed = The units you buy matters most. (a.k.a. fast attacking units pwn) ©

few enemies + low health + fast speed = Your position across the width of the field matters most. (a.k.a. If you can cover the width of the field you can kill them all, block them) (b)

few enemies + high health + slow speed = Your ability to continuously attack the enemy matters most. (a.k.a. If you can move your units to follow the tough units.) (a)

693273(b)+(a)+83886©=x (If we treat each aspect with equal importance.)
Position across the feild becomes the most important, Unit attack speed becomes second important, and Unit mobility becomes least important.

You may wish to scale those numbers down some, if you wish to use health points that max out below 8388607, but if your going to the game limits, then this equation should work.

lol, ( c ) becomes ©
[right][snapback]591655[/snapback][/right]

Hmmm, did you mean b*a+a+c*a or b*MAX(a)+a+c*MAX(a)?


Frifrat, I know that there are many factors and there is no universal formula that would work for all D maps. What I'm trying to do is to create a formula that would allow me to create 70 levels that varies in HP, count and speed very much. After I create the levels with formula, I will start balancing it by testing and experience. wink.gif

I once made a map, for Staredit only contest, using a simple "formula". Every next level consisted of stronger, faster and more units. It was quite entertaining actually. tongue.gif


What do you think of this one.

a*c - shows the actual amount of HP that you have to damage, considering that it's more than 1 shot to kill them.

b is the inverse of the time that you have while to unit passes you, lets say 40 tiles. So 1/b would be the actual time or in our case 40/b. Let's cut c by half for the ground units because you can wall in my map.

f(a,b,b) = (a*c)/10+x / (40/b)

Now I need the 1% or the weakest level.

1 = (a*c)/11 / (40/b)

Let's say I want the 1% level to be with reavers(b=2.09). As it's ground unit the speed is divided by 2, b= 2.09/2= 1.05.

1 = (a*c)/11 / 38.1

Lets say I want 20 of them.

1 = (a*20)/11 / 38.1

Now lets calculate how much HP the reaver must have. biggrin.gif

a = {[(10+x)*(40/b)]*x} /c ... a=21 HP uberwoot.gif

Hmm, looks ok so far, lets try a 70% or last level in my map.
I want 50 upgraded Scouts with c=8.07

a = {[(10+70)*(40/8.07)]*70} /50
a = {[80*5]70} /50
a = 560. Hmm kinda small. ermm.gif

Ideas!!
Edit:
I know the count has to much of a influence in this formula, I should divide the count by 5 or something. Let's see.
f(x=1); 20 reavers
a = (((10+x)*(40/b))*x) /(c/5)
a = 105 (hmm, big)

f(x=70); 50 upgrades scouts
a = 2800 (Damn, the increase is still to small) pinch.gif

I guess I need to add more significant meaning to the x, or a new formula. cry.gif




Next Page (1)