Author Topic: Statistics  (Read 924 times)

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Statistics
« on: November 09, 2009, 06:21:11 PM »
There are like 5 buildings, players can have 0-500 building of each kind, but 100 and above is rare.

I wanted to make some tool that would give me an overview of what players have. Something that would let me observe patterns and unbalances. What exactly I'm looking for?

The obvious things to look for are:
- maximum value of each building
- average value of each building
- number of players that have a building above 100 (per building, so x5)
Then, run this several times dividing players in 3 groups by score (what good players choose and what choose bad ones).

What else? Maybe some "group by" of certain ranges of building numbers (athough not sure how exactly)?

I would like a general solution, so I could use it not only for this, but also for other parameters within similar range.

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Statistics
« Reply #1 on: November 09, 2009, 06:40:08 PM »
give me table info and I can give you solution :) in the morning coz now I am going to bed

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Statistics
« Reply #2 on: November 09, 2009, 06:44:27 PM »
Well, I wanted to use for multiple things, so I can not give the table structure. But it would be several INT fields, their names would differ.

For the sake of discussion let's say "stat1 INT NOT NULL, stat2 INT NOT NULL, stat3 INT NOT NULL, stat4 INT NOT NULL, stat5 INT NOT NULL,  score INT NOT NULL, active BOOL NOT NULL".

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Statistics
« Reply #3 on: November 10, 2009, 04:49:18 AM »
so I guess you would need 2 sql queries.

1st:
Code: [Select]
SELECT COUNT(`id`),SUM(`score`),MAX(`score`) FROM `table`
this query will produce you number of players, sum of score and maximum of score, you said you need 3 groups by score so I guess MAX/3 are 3 groups?
$group1 = MAX/3;
$group2 = 2*MAX/3;

2nd:
Code: [Select]
SELECT stat1,stat2,stat3,stat4,stat5,score FROM `table`
while ($query) {
if ($score<=$group1) {
  $grp = 1;
  $player_group[1] += 1;
} else if ($score>$group1 AND $score<=$group2){
  $grp = 2;
  $player_group[2] += 1;
} else {
  $grp = 3;
  $player_group[3] += 1;
}
for ($i=1 TO 5) {
$totalstat[$grp][$i] += stat.$i; //you choose such for loop that it uses all your stat1 to stat5
if (stat:$i>$maxium[$grp][$i]) { $maxium[$grp][$i] = stat.$i; }
if (stat.$i>100) { $above_hundred[$i] += 1; }
}
}

explanation:
$player_group[GROUP]
$totalstat[GROUP][BUILDINGTYPE]
GROUP is one of those 3 groups (low, med, high score)
BUILDINGTYPE is one of those 5 building

so you can get average of each group by (example group 1, building 3):
$average_gr1_building3 = totalstat[1][3] / $player_group[1];

for example you can also get average of all buildings not "using" groups
$average_b5 = (totalstat[1][5]+totalstat[2][5]+totalstat[3][5]) / ($player_group[1]+$player_group[2]+$player_group[3]);
this example you could also test by using some query:
Code: [Select]
SELECT COUNT(`id`),SUM(`stat5`) FROM `table`and then dividing that SUM/COUNT and you should get the same number or the above query2 does nor work properly :)

$maxium[GROUP][BUILDING] - what is maximum value of building in one group
$above_hundred[BUILDING] - how many players have their building above 100 (>100)

hope it helps

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Statistics
« Reply #4 on: November 10, 2009, 05:44:04 AM »
First I was looking for theoretical solution, what kind of data I look for, I mean how the data should be presented to me (but code is nice too, less work for me :D).

What is needed for me to evaluate the trends and imbalances? I think I need a statistic that shows an oddity of one building (like all users purchasing mostly one building). This could be done by SUM. But then I still won't see things like two buildings being always bought by good users (combination of buildings). Some kind of graph, or group by, combined sum, I don't know?

The foremost question is, what kind of data would you need if you were to analyse it and wanted to rebalance your game?


Implementation: As for players groups, I think these should be done separately. The function would be run like 3 times (all users, high score, low score), it would be enough. The query should be not by ASSOC but by NUM, this way it can be easier reused for other game data.

You can do "$stat.$i" to create variable!? Cuuute!

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Statistics
« Reply #5 on: November 10, 2009, 06:58:47 AM »
"You can do "$stat.$i" to create variable!? Cuuute!" - I dont know if that works i just wrote it down to make it easier and less writing hehe, but I know that for forms it work.... like $_POST['stat'.$i]

but before we can help you with this we need to find out what each building does and/or how it affects that whole game.
maybe use of some "indexes" would be good :)
for example: when I wanted to make some game where user could produce some goods and sell them to NPC, I had such things: number of turns needed, average price of resources needed...so then I had chosen the cheapest product and said...ok that product will have index 1 and then my formula was something like:
(resources_price + X*turns)/Y = 1
X was something for me to decide to give "impact" of turns needed compared to total price of resource needed for that product, so when I had that formula I could apply it to every single product and get index of all those prices...and then I used that index to set pure profit and price that NPC's would buy that product.

what I am trying to say...if all those 5 buildings give attack bonus then you can try and compare it with similar method I did, if they give different bonuses like b1=att, b2=def, etc then i dont think you can compare them....because you dont know how people like to play...some prefer attacking and that some is not necessarily 20% of all players (1/5 buildings :) )

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Statistics
« Reply #6 on: November 10, 2009, 07:11:51 AM »
Buildings are completely different, income, combat, research, storage, etc.

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: Statistics
« Reply #7 on: November 10, 2009, 08:09:32 AM »
I agree, I would too make a separate groups...maybe 2 for high level (and be aware that it's gauss, not linear progress)

But then...still as I said I think it could be tricky connect balance and trend since (as saljutin mentioned) it depends on player's style; depends on appealness, cost, easieness to use, sometimes better way is overlooked for some time etc.

Maybe you can also include comparison of number of buildings vs. ratio of action player performs (aka if he's aggressive of defensive or rather scientist etc.)
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Statistics
« Reply #8 on: November 10, 2009, 08:43:46 AM »
OK, at the moment I do it like this: I click on 10 top players and read their stats, then I click on 10 average ones and read theirs. Based on this I determine if something is overpowered. It works but it is not a very convenient solution nor the most accurate, also I would prefer something more scientific :)

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Statistics
« Reply #9 on: November 10, 2009, 09:05:55 AM »
and what does make some guy TOP?
can I play passive, log in once per day, not attack anyone just research and produce etc....I mean do only economical things and not war...so can I still be on top?

and...if I am on 1st page, wouldn't that make me a target? so maybe some people rather stick on 2nd page and build that things which can later in game make them better then those TOP players?

so many human/player variables :)

maybe you must do something similar to that manual check...write down everything you manual check and how you validate who is good or not or imbalanced etc...then try to use that "variables" on every single player

Offline raestlyn

  • Level 29
  • **
  • Posts: 464
  • Reputation: +9/-5
    • View Profile
Re: Statistics
« Reply #10 on: November 10, 2009, 09:26:15 AM »
Raise the amount of income produced by Factories, they are almost worthless compared to others. My income is population * 42 per tick atm, and I still make more gold from a single attack than in 3 ticks. Peaceful approach to the game is impossible now.


I can send you pics of my cocks if you want reference.


Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Statistics
« Reply #11 on: November 10, 2009, 09:32:14 AM »
Be reasonable, I have a very limited time to spend on balancing :) Yes, there always are "buts", yes it will always be innaccurate and deceiving, yes there are plenty of factors it would not include. But I still need it :D

Raise the amount of income produced by Factories, they are almost worthless compared to others. My income is population * 42 per tick atm, and I still make more gold from a single attack than in 3 ticks. Peaceful approach to the game is impossible now.
The current stats shows that factory is quite favored but several top players (also read on the space inn what they say about annihilate's income). I was thinking rather of limiting it... In 90 days round you could easily get above 20000 solaris/tick using factories alone, which would be equal to 100% efficiency on raids.
By the way, it is cute to have players among fellow developers :)

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal