Forums » Community Projects

Balance Algorithm funness

12»
Aug 27, 2009 Shapenaji link
Hey everyone, so I started working on this out of Genka's "Stop adding new features" post. But, I felt it needed to be in its own thread in order to merit any attention.

go read here for the lead-up: (just skip past to mine, Impavid's and Genka's posts later on, people started some strange conversation about marketting) http://www.vendetta-online.com/x/msgboard/3/7873?page=2

So I did some legwork on this problem,
I trimmed the dataset of weapons by just looking at small port weapons,

I further trimmed it by including only the weapons that, in my experience, people typically use. I call this subset balanced,
(I included some weapons which are a little inferior, but none of the weapons which are downright unuseable in combat, such as the plasma weapons, or any of the lower ions)

The dataset, and the variables that I'm balancing over are here:

Name Port Damage Velocity Energy Delay Mass Targetting Grid Quality
5 Raven 0 500 195 10.0 0.160 280 1 8 1
6 Neutron1 0 600 190 12.0 0.150 600 2 4 2
7 Neutron2 0 600 195 11.0 0.140 600 2 4 1
8 Neutron3 0 600 205 14.0 0.140 400 2 4 1
9 LENeutron 0 635 208 14.0 0.130 400 2 4 1
10 Widowmaker 0 800 215 16.0 0.140 400 2 18 2
11 Phase1 0 350 170 8.0 0.200 100 1 4 2
12 Phase2 0 380 175 7.5 0.200 100 1 4 2
13 XGX 0 400 180 7.2 0.200 150 1 4 1
14 Sparrow 0 420 172 7.3 0.200 150 1 4 1
15 Positron 0 800 190 18.0 0.250 500 1 4 2
16 AAP 0 800 210 17.0 0.210 500 2 4 1
17 HivePosi 0 800 210 16.0 0.210 400 2 4 1
18 Flechette1 0 250 190 6.5 0.090 600 0 4 2
19 Flechette2 0 280 200 6.0 0.088 600 0 4 1
20 Gauss1 0 1200 180 40.0 0.500 1000 3 4 2
21 Gauss2 0 1100 190 30.0 0.400 1000 3 4 2
22 Gauss3 0 1200 195 30.0 0.400 1000 3 8 1

More to come, I suspect I need to trim the data set more though,
Since I found something a little funny when I started fitting (just linear models, comparing Damage, DPS, EPS, Velocity, Mass)
is that the data actually suggests that there's a negative relationship between mass and velocity, such that when mass goes down, on average, velocity goes up. Which certainly seems odd, but not when you consider the license levels, which I know I have to include now.

However, this is a bit frustrating as a player, since I realize that essentially, the devs have put enough of the balance inside the license levels as to throw the whole trend off.
Aug 27, 2009 Snax_28 link
Sucks that [table] isn't supported on these forums... I was going to give you shit for poor presentation!
Aug 27, 2009 PaKettle link
spaces work in all cases....

Mega posi is missing?

Note the complete absence of any large port weapons...
Aug 27, 2009 Shapenaji link
Re: Megaposi
yeah, I'm just looking at the balance of small port weapons.

Best to start with something straightforward, rather than immediately jumping to the problem of how to represent the difference between small and large port weapons.

I don't think it's that much harder, but I wanted something that I could get results with first.
Aug 27, 2009 Shapenaji link
Re: Table

yeah, I'd like a better way to represent it, maybe I'll just take a screencap.
Aug 28, 2009 Shapenaji link
AND on that note, where's a good place to host things? I have a really cool MCMC algorithm for balancing, and it's giving interesting results.
Aug 28, 2009 Shapenaji link
So I'll present the nuts and bolts of what I did so far, since it's the process that's interesting.

Upon realizing that the license levels were, imo unjustly, being a major balance parameter, I started asking myself how to bring the weapons into balance without undermining their interesting differences (essentially dropping the balancing effects of licenses altogether).

So my algorithm was as follows:

Trim the Dataset down to just "Quality 1" weapons,

I assumed that an ideal linear model would be along the lines of:

A*Damage + B*DPS + C*EPS + D*Velocity**2 + E*Mass + F*Targetting = Constant

(I've stated it earlier, but I just wanted to remind people, DPS and Damage are 2 separate issues, by the "First Shot is free"-principle, and this is what makes gauss so strong)

step 1:

Take the nested model A*Damage = B*DPS + C*EPS + D*Mass + E*Mass +F*Targetting + Const, and do a least-squares fit over the data.

Then take the predicted values of Damage and do a weighted average with the original damage values.

So Damage = 0.99*Damage + 0.01*prediction

then run this again, for the next parameter:

B*DPS = A*Damage + C*EPS + D*Mass + E*Mass +F*Targetting + Const

and we perform the same weighted average:

DPS = 0.99*DPS + 0.01*Prediction

(Note that each time a least squares fit is done the parameters A-F change as a result of the adjustment)

we continue to run this over all parameters, and then repeat the process roughly 1000 times (I did it 10000 times just for fun)

What is this doing? well, each time it runs the least squares fit, it gets a general idea for the balance, and then adjusts one parameter very slightly closer to the balance point. It spreads this around over all the parameters so that each weapon gets to keep the bulk of it's character (it's strengths and weaknesses more or less are the same).

Here's some interesting adjustments that the algorithm suggests:

Old Ones:



Here are the new ones:
Aug 28, 2009 Shapenaji link
Hmm, the N3 has a few strange artifacts, I'll fix that in the next run through

But essentially, the idea is that we can randomly generate statistics for each of the weapons, and then use the algorithm to bring them in line with the other weapons.

Note that most of the changes here were quite small, which is to be expected given that these are the weapons people use.

Here's a larger sample (I also tweaked the convergence a bit):



Next step I'll see if I can't balance rockets and blasters!

(Note: Devs, if you have a larger dataset I can play with, I'd love to see it)
Aug 28, 2009 vIsitor link
That last pic isnt showing up, Shape.

Anyway, I get where you're coming from. I think this is more or less a good idea; you just might want to round off the hanging decimals a bit to clean things up. (I don't think a discrepancy that small would affect balance very much).

Also: Stat changes for the XGX are kind strange too. Higher DPS than a sparrow *and* a mass of 36kg? =^p
Aug 28, 2009 peytros link
heh its funny to note that your algorithm has bassicly switched the stats of the LENB and the neut 2
Aug 28, 2009 Shapenaji link
I know it requires tweaking, the stat switch between the LENB and the neut2 was a consequence of the convergence rate. Likewise, the freakishly small mass for the XGX.

In the last pic, which is now not showing up, those artifacts disappeared.

As far as the hanging decimals, I was just tossing out raw data, but I can clean up the decimals if you like...
Aug 28, 2009 Roda Slane link
Cost and availability are not accounted for. I can buy a n2 anywhere. Laws are hard to get. N3 are dirt cheap. I don't want every weapon balanced in stats alone. I want good weapons that are hard to get and a special reward for you when your target drops one. If I kill someone and they drop a hive posi, I take it and say thank you. I don't want a aap balanced with a hive posi, unless you consider how much harder it is to get a hp. same with laws.

The raven is currently one of the most unbalanced weapons in the game.

Also, you are presenting a linear scaling. Decreasing one parameter by %5 and increasing another by %5 may sound like good logic, but if I could have an weapon that fired 800ms for a mass of 2000, I would. Think in terms of exponential and logarithmic scales.
Aug 28, 2009 Shapenaji link
no, it's not decreasing one by 5% and increasing another by 5%, read what I wrote. It's establishing a common balance and then moving weapons closer to the balance point. IT IS a linear model:

The following is ALSO a linear model,

A*X^3 + B*Y*X^2 + C*X/Y = Const

The logarithmic and exponential functions are needlessly computationally intensive when I can just square the velocity and get enough feedback that any weapon that went over about 250 m/s would be a useless weapon.

And the equation is not first order in Damage or in Velocity, and so you could never have a weapon that was 2000 kg and fired 800 m/s. The algorithm currently MIGHT produce a weapon that was 800 m/s, but the Damage would be almost 0, the rate of fire would be maybe twice a second, the mass would be enormous AND the Energy required of it would be huge.

I'll run it through with an 800 m/s 2000kg weapon, I'll show you the kind of weapon you'd end up with.

And I can add other factors to the balance equation. It's incredibly easy for me to add limited availability as a term.
Aug 28, 2009 Lord~spidey link
is it just me or are the LENB and hive posi nerfed a shit ton in the second table...
Aug 28, 2009 Roda Slane link
cost and availability (unless you consider cost as a parameter of availability). And yes spidy, the hposi is currently better than the aap, but won't be by the limited parameter set shown here. What I am also trying to understand, is how the widowmaker kept most of it's stats. You might include the calculated dpe just so I don't have to do any math. Math is hard. Don't make me.
Aug 28, 2009 Shapenaji link
The hposi IS better than the AAP, and the algorithm understand that, I'm just still tweaking convergence rates, since weapons that are very close to one another can occasionally get swapped.

Roda: You're right that the equation needs more tweaking, the result I got for your weapon was:

TESTUBERWEP
Mass= 9000 kg
Velocity = 800 m/s
delay = 0.5
Damage = 300
energy = 20

However, in the process, I realized that Velocity**3 is a better measure (otherwise it can come up with a weapon with reasonable stats with around 300 m/s, too high imo). And switching A*Mass to A/Mass, likewise with EPS (the things we know SHOULD be inversely related to the velocity and DPS), keeps the algorithm from being confused by weird trends in the data.

If someone would like to give me availability data, I can add that.
Aug 28, 2009 LeberMac link
Shape, regarding your presentation, you could use google docs to host the spreadsheet and give public viewing rights to it, I think that works. PLUS that way you could make it a form that we could all fill out and experiment with.
Aug 28, 2009 Impavid link
Be a good idea to chart the originals side by side with the adjustments too, easier to compare.

So if you can reverse compare this for new weapons and they're all balanced by comparative factors, availability and faction standing availability, as well as license level have to be loaded in there. Or, lets just assume we're doing away with license levels and ignore that :D
Aug 31, 2009 Shapenaji link
Leber,

I'll try that out, just playing with the code when I get a chance.

To everybody,

So what it looks like I've got right now, is a system which rates weapons... seems to work pretty well too.

it currently rates the Hiveposi as the best blaster in the game,

top 6 blasters:

1. HivePosi
2. AAP
3. LE Neutron
4. Flechette mk II
5. Neutron mk III
6. Gauss mk II

interestingly, the flechette mk II (The EPS, the mass, the DPS, and the speed are all up there, so if we consider the top group (the best) of weapons as balanced against one another, then the flechette mk II is a vastly undervalued weapon.



Edit: Note, that the grid effect is exerting undue influence right now, because of the widowmaker, I need to fix that. It's what currently puts the gauss 3 below the gauss 2,

It makes sense that the algorithm gives the grid a lot of weight, because otherwise, the widowmaker would be profoundly unbalanced. But I think I need to state it in more black and white terms.

Aug 31, 2009 Shapenaji link
P.S. Sorry if anyone entered this thread in progress, I made a LOT of edits :) mostly cuz it's 4 AM and I can't see straight