cRPG

cRPG => General Discussion => Topic started by: Kafein on October 26, 2012, 12:18:41 am

Title: A mathematical model of the cRPG metagame
Post by: Kafein on October 26, 2012, 12:18:41 am
I just had a course about this and as a rehearsal, I wanted to model the interacting populations of character classes in cRPG, through a variation of evolutionary game theory (please ignore my pompous wording).

So, the idea is to say : we got a number of classes and each class can do more or less good against another class. Those relations exist in cRPG. One of the most obvious examples are polearms. With a vast choice of powerful axes, they are very effective against shielders. More importantly, the more shielders there are, the better polearms will do.

Another obvious observation of cRPG is that the more powerful a class is or seems, the more people will play it. But this change is not linear. It is always more difficult to convince the last, hardcore players of a certain class to change (this is reflected in the model), as witnessed with the last horse throwers (hi Zlisch).

The model aims to take into account that kind of relationship for all classes in relation with all classes (even a class with itself), and the population changes that occur with time. With the right choice of parameters, this model can show what could happen if say, cav became super strong against 2h or if shielders suddenly were able to dispatch mounted ranged with ease. It's also fun because of the chaotic nature of the system. Just like in real cRPG, classes vary in popularity but sometimes we don't really know why (or at least, an explanation would be overly complicated).


At the moment I have 6 classes : "Ranged", "Shield", "2h", "Pole", "Cav" and "HR" (which means horse ranged), the program can easily be extended to include more detailed classes. I have set the payoff matrix in the code based on my ingame experience and also testing the results I got with various settings.

As it is really short, here's a copy pasta of the code (Python 2.7)

(click to show/hide)

After 5 units of time 2h were at 8% then 15 units later they are at 20% of the playerbase, mainly because there are lots of poles. It's a bit like an aquarium. I realize I should do this with matlab and post graphs but heh I did this for fun and I tought it would be nice to post it, if you are into that kind of things, enjoy :)
Title: Re: A mathematical model of the cRPG metagame
Post by: Lt_Anders on October 26, 2012, 12:38:34 am
RIght ok, Code doesn't mean anything. Wut is the results that's wut matter!
Title: Re: A mathematical model of the cRPG metagame
Post by: Andy on October 26, 2012, 12:48:28 am
I speak code, and that is a very nice chunk there. Great idea Kafein, looks amazing.
Title: Re: A mathematical model of the cRPG metagame
Post by: agweber on October 26, 2012, 01:29:55 am
Quote
Time :  164.2
Ranged  0.237641040221
Shield  0.196870774353
2h      0.270445408452
Pole    0.265281825419
Cav     0.0297609434774
HR      8.07676550724e-09

The numbers have pretty much stabilized. Ranged Cav are no longer around. Cav's barely holding on.
Title: Re: A mathematical model of the cRPG metagame
Post by: Casimir on October 26, 2012, 02:41:17 am
Code fails to account for 2h cav, code is invalid.

2h cav will one day absorb the entire population.
Title: Re: A mathematical model of the cRPG metagame
Post by: bilwit on October 26, 2012, 02:48:46 am
-1 for terrible documentation and presentation
Title: Re: A mathematical model of the cRPG metagame
Post by: Spanish on October 26, 2012, 02:56:53 am
This is pretty cool but you fail to account for my awesome 2h cav abilities or lordarks shield pole cav archer powers. Throw hybrid and dedicated as two major categories with everything else in those categories or idk how to explain my head hurts
Title: Re: A mathematical model of the cRPG metagame
Post by: Rhekimos on October 26, 2012, 07:30:46 am
An interesting model, but it supposes that everyone is GTX, or that they can only have fun when they win.

And that's why people play games, to have fun.

Haven't you ever had fun also when losing to a good player after a good fight? Haven't you had fun when just blocking someone as a peasant long enough for a teammate to kill him? Also some people might find more fun from playing with others, from teamwork and winning rounds, instead of having the best k/d ratio.

It's things like those that are completely ignored by this model. The human element.
Title: Re: A mathematical model of the cRPG metagame
Post by: Kafein on October 26, 2012, 09:49:02 am
RIght ok, Code doesn't mean anything. Wut is the results that's wut matter!

-1 for terrible documentation and presentation

I know, but I really couldn't post results, without some easy-and-quick way to draw graphs. This is essentially for python-literate people that want to mess around with numbers and see what happens. Not many people I guess.

An interesting model, but it supposes that everyone is GTX, or that they can only have fun when they win.

And that's why people play games, to have fun.

Haven't you ever had fun also when losing to a good player after a good fight? Haven't you had fun when just blocking someone as a peasant long enough for a teammate to kill him? Also some people might find more fun from playing with others, from teamwork and winning rounds, instead of having the best k/d ratio.

It's things like those that are completely ignored by this model. The human element.

Actually this is taken into account, this line :

fitness[myClass] = fitness[myClass] * (1-pow(pop[myClass],2))

means that the closer the current pop of the class is to 0, the higher it's fitness will remain, simulating the fact that the last players of a class will not move so easily.

Also, you are not forced to interpret the fitness matrix as a measure of battlefield effectivity of a class against a certain class. It can represent how funny playing a class is.
Title: Re: A mathematical model of the cRPG metagame
Post by: Vibe on October 26, 2012, 09:52:31 am
it's friday and I'm too fucking tired to read any advanced posts so here's a carrot

visitors can't see pics , please register or login
Title: Re: A mathematical model of the cRPG metagame
Post by: Adamar on October 26, 2012, 10:09:46 am
Bah, code... is this a concealed anti-ranged thread or not?
Title: Re: A mathematical model of the cRPG metagame
Post by: Bjord on October 26, 2012, 10:28:19 am
Shit, man. This is what STF alts are for. Did you account them, BTW?
Title: Re: A mathematical model of the cRPG metagame
Post by: Teeth on October 26, 2012, 11:00:07 am
I think to succesfully predict anything, you are going to need about 20 subclasses beneath the 6 base classes.
Title: Re: A mathematical model of the cRPG metagame
Post by: Kafein on October 26, 2012, 01:41:59 pm
Spends 1 hour writing a quality renown-whoring post, gets +5

Vibe posts an image of a carrot in the same thread, gets +8




I think to succesfully predict anything, you are going to need about 20 subclasses beneath the 6 base classes.

Well honestly, the harder is setting the payoff parameters, not creating more classes. It's already very complicated with 36 values. Better yet, we could add different values for each class in each gamemode in the same matrix and see how population transfers in one gamemode affect other gamemodes.

Bah, code... is this a concealed anti-ranged thread or not?

Kinda, but these values are arbitrary.
Title: Re: A mathematical model of the cRPG metagame
Post by: dodnet on October 26, 2012, 01:48:06 pm
Spends 1 hour writing a quality renown-whoring post, gets +5

Vibe posts an image of a carrot in the same thread, gets +8

Ahahahahaha  :mrgreen:

cute carrots > boring formulas
Title: Re: A mathematical model of the cRPG metagame
Post by: Rhekimos on October 26, 2012, 02:49:28 pm
Actually this is taken into account, this line :

fitness[myClass] = fitness[myClass] * (1-pow(pop[myClass],2))

means that the closer the current pop of the class is to 0, the higher it's fitness will remain, simulating the fact that the last players of a class will not move so easily.

I'm sorry, but that's not taking the human sitting in front of the computer into account. That's adding a parameter to your function that makes it look less flawed, while making the exact same assumption about the average player. Science wise, a cosmetic change.

Now there's a few nutjobs who are acting against their best interest in the population. Most of the population is still only after kills, and will switch over to anything that killed them. That's not how you play, is it?

Quote
Also, you are not forced to interpret the fitness matrix as a measure of battlefield effectivity of a class against a certain class. It can represent how funny playing a class is.

I won't have fun as a polearmer if I end up against a 2h player? That's what your matrix would say, isn't? Can you model different actors with different payouts? Not everyone likes the same things after all, and some have a principle of their own against going ranged for example. Can you factor culture into it?
I think it would be a little naive to claim that how a player acts can be represented with a single number for each class.

Also I applaud your efforts, but I feel I must point out that this doesn't prove much. Our interactions with the game and each other are much more complex than this, and most importantly not everyone plays only to win. Models are necessarily simpler than reality, but if they are based on an incorrect assumption, no amount of tweaking will help it make correct predictions.

Title: Re: A mathematical model of the cRPG metagame
Post by: Vibe on October 26, 2012, 03:06:29 pm
Spends 1 hour writing a quality renown-whoring post, gets +5
Vibe posts an image of a carrot in the same thread, gets +8

learn the way of renown you must, young padawan
Title: Re: A mathematical model of the cRPG metagame
Post by: Armpit_Sweat on October 26, 2012, 03:10:56 pm
I found some math too:

visitors can't see pics , please register or login


EDIT:

Spends 1 hour writing a quality renown-whoring post, gets +5

Vibe posts an image of a carrot in the same thread, gets +8

:) :) +1 for you both
Title: Re: A mathematical model of the cRPG metagame
Post by: Moncho on October 26, 2012, 03:22:50 pm
This is a model. A quite thought through model, but as with any model, it cannot take into account every single element of the metagame. It still does a good job imo, from the numbers I saw in agweber post. And of course it can be improved, but even in the current state, it gives an overall idea.

These seem reasonable with the biggest amounts being 2h/pole, then ranged, shield, but with cav I think there is something pretty wrong, due to the fact that cav is not the best on 1v1 with aware people, but it shines in backstabbing and group fighting. You could represent this by adding a random factor to cav (representing the awareness of the target), or just take the average and increase its effectivity against other classes by a bit. I would suggest increasing cav v cav to 3, see what this does, as after all cav fights other cav at the beginning of the round often.

Unfortunately, I cannot run the script now to check what my changes do, might do it later though
Title: Re: A mathematical model of the cRPG metagame
Post by: Kafein on October 26, 2012, 03:53:15 pm
I'm sorry, but that's not taking the human sitting in front of the computer into account. That's adding a parameter to your function that makes it look less flawed, while making the exact same assumption about the average player. Science wise, a cosmetic change.

Now there's a few nutjobs who are acting against their best interest in the population. Most of the population is still only after kills, and will switch over to anything that killed them. That's not how you play, is it?

Actually, this tweak makes low pop classes inherently "attractive". This means if this class is getting more players, it will grow faster, but it will also lose fewer players in the opposite situation. Players do not switch classes linearly. The very hardcore single-class players will only leave if their class becomes unplayable. The most volatile, min-maxing players will switch as soon as they see an opportunity to do "better", and this represented more or less accurately. If a class is very popular, only a few players of that class are the super hardcore type, and it is therefore easy for that class to lose players. If a class is very unpopular, only the most determined will stay, and those guys are hard to convince to switch. If you discretise the population and think of each class as a stack of players, with the most volatile on top, it is easy to understand.

I won't have fun as a polearmer if I end up against a 2h player? That's what your matrix would say, isn't? Can you model different actors with different payouts? Not everyone likes the same things after all, and some have a principle of their own against going ranged for example. Can you factor culture into it?
I think it would be a little naive to claim that how a player acts can be represented with a single number for each class.

The model does not represent the behavior of an isolated player, but rather that of the whole population. Things like taste can be averaged and included in the payoff matrix.

Also I applaud your efforts, but I feel I must point out that this doesn't prove much. Our interactions with the game and each other are much more complex than this, and most importantly not everyone plays only to win. Models are necessarily simpler than reality, but if they are based on an incorrect assumption, no amount of tweaking will help it make correct predictions.

It gives an idea of how the metagame can evolve, and how things that seem unrelated (shields becoming stronger against 2h and the amount of mounted ranged for example) are connected. We lack the base data to establish correct parameters for the model, but doing simulations with values that seem "close enough" already displays interesting non-linear behavior. It also questions how do we think about the metagame, maybe helping people to formulate their ideas and suggestions better.


Valid remarks nonetheless.
Title: Re: A mathematical model of the cRPG metagame
Post by: Polobow on October 26, 2012, 04:50:34 pm
Where's WaltF4 when you need him?
Title: Re: A mathematical model of the cRPG metagame
Post by: CrazyCracka420 on October 26, 2012, 05:17:17 pm
I was told there would be no maths

visitors can't see pics , please register or login
Title: Re: A mathematical model of the cRPG metagame
Post by: Lt_Anders on October 26, 2012, 05:19:23 pm
The numbers have pretty much stabilized. Ranged Cav are no longer around. Cav's barely holding on.

Time :  164.2
Ranged  0.24
Shield  0.20
2h      0.27
Pole    0.27
Cav     0.03
HR      8.07676550724e-09

(rounded the numbers)

Interesting. 2h=pole followed just behind by range.

Wut do we have now...Shiedless heavy servers, with a lot of range. Sheilders are there, but not as much as 2h, pole, range.

Also, you should probably break up ranged a little more, Something like archers and then xbow/throwing. Becasue xbow is bad dedicated, but a lot carry so it should be somehow weighted separately.

Also, BUFF HA, they clearly suck and this model shows it too!

@Crazy:
WUT?
Title: Re: A mathematical model of the cRPG metagame
Post by: Rikthor on October 26, 2012, 05:32:15 pm
I feel this is an appropriate response to this thread

Title: Re: A mathematical model of the cRPG metagame
Post by: Leshma on October 26, 2012, 05:56:47 pm
Quote
I realize I should do this with matlab and post graphs but heh I did this for fun and I tought it would be nice to post it, if you are into that kind of things, enjoy

Do it with matlab and also on paper (using real math).
Title: Re: A mathematical model of the cRPG metagame
Post by: bilwit on October 26, 2012, 07:42:38 pm
Do it with matlab

Yeah, not sure why he would just post source code and not even have any comments explaining his reasoning on top of not showing any results or analysis either. Why do it in python and not matlab anyway where you can readily pull graphs and shit out of it if the purpose was truly to show it to the community?

No flowchart, no results, not even a detailed description outside of the vague OP. The OP is basically, "here is a wall of source code I came up with, compile and analyse it yourself if you can even though I can easily make the assumption that most people here aren't coders or mathematicians." If I was a peer reviewer and this was a presentation I would throw 0's at you.
Title: Re: A mathematical model of the cRPG metagame
Post by: PhigNewtenz on October 26, 2012, 08:26:43 pm
I think it's an interesting concept. I do modeling like this for a living, and I'm going to give the approach some more thought. First blush: it's a good model. I'm not sure if the 'Payoff' matrix is set up correctly, but without real data that's difficult to know.

For people who don't speak code, here're the results of Kafein's simluation in graphical form (only plotted to time = 50, because nothing interesting happens after that):

visitors can't see pics , please register or login



For those who speak MATLAB:
(click to show/hide)

I understand that the fitness = fitness * (1-pop^2) is trying to model the resistance of 'the last, hardcore players of a certain class to change'. The relationships are definitely non-linear, and this shows some of that. Can any other math people comment on whether they think this is the right way to do it?
Title: Re: A mathematical model of the cRPG metagame
Post by: PhigNewtenz on October 26, 2012, 08:40:04 pm
So I made one minor change to the 'Payoff' matrix and ran it again. I changed all the diagonal elements to '3', because I think every class is break even against itself. The results were amusing, but also convinced me that this model (or my assumption that classes are equal against each other) needs some tweaking.

Are you ready for an eerie (but clearly not realistic) prediction of the future of cRPG?

(click to show/hide)



If people have their own cases they want to see plots for (a case being some combination of initial conditions and 'Payoff' matrix), post them here. I'll run them if I'm on, or maybe some else can grab the code and run with it.
Title: Re: A mathematical model of the cRPG metagame
Post by: genric on October 26, 2012, 08:44:05 pm
This is cool. I like it.
Not enough pure positive comments so this is mine to you :)
Title: Re: A mathematical model of the cRPG metagame
Post by: Kafein on October 26, 2012, 09:11:56 pm
Do it with matlab and also on paper (using real math).

I don't think anybody would like to compute each step on paper. A bullet in the head is faster. And afaik there's no easy way to directly derive results at an arbitrary time without doing all the steps with models such as this. But as PhigNewtenz showed, in matlab it's quite awesome (btw I don't have matlab at home, otherwise I would have used it in the first place :s)

Yeah, not sure why he would just post source code and not even have any comments explaining his reasoning on top of not showing any results or analysis either. Why do it in python and not matlab anyway where you can readily pull graphs and shit out of it if the purpose was truly to show it to the community?

No flowchart, no results, not even a detailed description outside of the vague OP. The OP is basically, "here is a wall of source code I came up with, compile and analyse it yourself if you can even though I can easily make the assumption that most people here aren't coders or mathematicians." If I was a peer reviewer and this was a presentation I would throw 0's at you.

I don't want to start an argument (even though this sentence is not a very good idea to acheive that goal), but when I started the thread I wasn't trying to do a presentation. If I wanted to release serious stuff only, I would have spent a lot of time, which I didn't. I only thought it would be interesting to share, and it seems to me I wasn't that far from the truth. Other than that you are right.

I think it's an interesting concept. I do modeling like this for a living, and I'm going to give the approach some more thought. First blush: it's a good model. I'm not sure if the 'Payoff' matrix is set up correctly, but without real data that's difficult to know.

For people who don't speak code, here're the results of Kafein's simluation in graphical form (only plotted to time = 50, because nothing interesting happens after that):

visitors can't see pics , please register or login



For those who speak MATLAB:
(click to show/hide)

I understand that the fitness = fitness * (1-pop^2) is trying to model the resistance of 'the last, hardcore players of a certain class to change'. The relationships are definitely non-linear, and this shows some of that. Can any other math people comment on whether they think this is the right way to do it?

Awesome :)

About that line, I tried a few alternative formulas, but that one seemed to give the closest results to what I wanted (lower pop -> better fitness). A greater exponant leads to reducing the influence of this tweak, but 2 seemed "okay" (see that, I'm being unprofessional again :lol: ).


So I made one minor change to the 'Payoff' matrix and ran it again. I changed all the diagonal elements to '3', because I think every class is break even against itself. The results were amusing, but also convinced me that this model (or my assumption that classes are equal against each other) needs some tweaking.

Are you ready for an eerie (but clearly not realistic) prediction of the future of cRPG?

(click to show/hide)



If people have their own cases they want to see plots for (a case being some combination of initial conditions and 'Payoff' matrix), post them here. I'll run them if I'm on, or maybe some else can grab the code and run with it.

I had set different values to reflect that I think some classes tend to have a better time fighting internally. Fighting other 2h when you are 2h yourself is not really a problem. But for cav or shielders it can be a tedious process. This also reflects the fact that some classes have fewer counters than others. Mounted ranged can only be fully countered by ranged and other mounted ranged. If an enormous part of the playerbase was mounted ranged, the fitness of mounted ranged would stay high because classes like 2h would be "obsolete". Some classea are self-reinforcing and some others are self-regulatory, or at least that's how I see it.




Title: Re: A mathematical model of the cRPG metagame
Post by: bilwit on October 26, 2012, 11:07:17 pm
I think it's an interesting concept. I do modeling like this for a living, and I'm going to give the approach some more thought. First blush: it's a good model. I'm not sure if the 'Payoff' matrix is set up correctly, but without real data that's difficult to know.

For people who don't speak code, here're the results of Kafein's simluation in graphical form (only plotted to time = 50, because nothing interesting happens after that):

visitors can't see pics , please register or login



For those who speak MATLAB:
(click to show/hide)

I understand that the fitness = fitness * (1-pop^2) is trying to model the resistance of 'the last, hardcore players of a certain class to change'. The relationships are definitely non-linear, and this shows some of that. Can any other math people comment on whether they think this is the right way to do it?

Why are you using area instead of a straight up plot? The vertical axis doesn't represent "portion of population" this way.

visitors can't see pics , please register or login


^With plot() we can clearly see that at every point in time the sum of popRec is one and the initial time assumes that there are an equal amount (very close to equal at least) of players for each class. Now it's easier to look at without trying to interpret which space is bigger at what point etc (I removed the "classes" string flip on the legend because it didn't look consistent at all with the area graph). From his model we can say that over time (from steady state to infinity) 27% play 2H, 27% play pole, 24% play ranged, 19% play shielder, 3% play cav, and almost no one plays HR.

Anyways, I don't agree with the payoff matrix. Shielder has 2 effectiveness against 2H and Pole and only 1 versus Cav? Is there a reason a scale of 1-5 is used? Wouldn't a more simplified 1-3 scale (1=disadvantage, 2=even, 3=advantage) be better (and more objective) representation? Why aren't hybrids accounted for (there are many players who are spec pole/2h but use their crossbow most of the time, also dedicated archers who run away versus archers who 1h/2h melee -- both have different effectiveness versus other classes)? Also not sure what to make out of the characteristic model applied or why it's used.

This is based on way too many assumptions for anything meaningful to be dug out of it. It's fun to fiddle around with I guess, which I guess was the purpose anyway. I'd like to see the devs release data on class population over time (if something like that exists) and maybe someone could highlight what patches were released when and what was nerfed/buffed/etc.
Title: Re: A mathematical model of the cRPG metagame
Post by: Vibe on October 26, 2012, 11:44:26 pm
visitors can't see pics , please register or login
Title: Re: A mathematical model of the cRPG metagame
Post by: PhigNewtenz on October 27, 2012, 02:04:13 am
Why are you using area instead of a straight up plot? The vertical axis doesn't represent "portion of population" this way.

Clearly you're unfamiliar with a stacked area chart. The portion of the population represented by each class is the height of it's color bar. It's actually a really standard way of representing this kind of data. Your other critiques are pretty valid though. I'm sure that as long as people are interested, we'll continue to refine and improve it. For creating something from nothing, I think Kafein did an awesome job. No one else has tried to do anything like this yet...
Title: Re: A mathematical model of the cRPG metagame
Post by: KaMiKaZe_JoE on October 27, 2012, 02:22:54 am
The data suggests cav doesn't need a nerf. This is heresy.

Also, this thread has revived in my the conviction that there are, in fact, wizards afoot.
Title: Re: A mathematical model of the cRPG metagame
Post by: Thomek on October 27, 2012, 05:29:49 am
The most advanced buff cav thread ever. I'm incredibly impressed Kafein.  8-)
Title: Re: A mathematical model of the cRPG metagame
Post by: SixThumbs on October 27, 2012, 05:56:45 am
Even in a nice color coded picture I still don't understand it.
Title: Re: A mathematical model of the cRPG metagame
Post by: Tore on October 27, 2012, 10:12:47 am
math
visitors can't see pics , please register or login
Title: Re: A mathematical model of the cRPG metagame
Post by: Kafein on October 27, 2012, 06:06:42 pm
The most advanced buff cav thread ever. I'm incredibly impressed Kafein.  8-)

You can increment or decrement one number in the matrix and it becomes a 2h buff thread. This works with any class. Literally.
Title: Re: A mathematical model of the cRPG metagame
Post by: genric on October 27, 2012, 06:09:18 pm
I think the fact that cav population decreases is because the graph forumulates duels between the classes so since cav is weak in that regard it's the reason it dies off but as long as you have people not paying attention and couching, it will live. Also being able to bump 20 people in a row.
Title: Re: A mathematical model of the cRPG metagame
Post by: Overdriven on October 27, 2012, 09:58:29 pm
Why are you using area instead of a straight up plot? The vertical axis doesn't represent "portion of population" this way.
(click to show/hide)

Area is prettier.
Title: Re: A mathematical model of the cRPG metagame
Post by: Kafein on October 27, 2012, 10:28:22 pm
Area is prettier.

The lines have the advantage of making more limited obsevations easier. Like comparing only two populations. When two populations have the same amount of people, it's just two lines intersecting.
Title: Re: A mathematical model of the cRPG metagame
Post by: Overdriven on October 27, 2012, 10:37:09 pm
The lines have the advantage of making more limited obsevations easier. Like comparing only two populations. When two populations have the same amount of people, it's just two lines intersecting.

I prefer my explanation  :P