ensingm2 / SteamMonsterGameScript

A Javascript automator for the 2015 Summer Steam Monster Minigame
78 stars 29 forks source link

Element Choice (Might not be an issue) #93

Closed cdmichaelb closed 9 years ago

cdmichaelb commented 9 years ago

So far I've always been assigned to Water Element. Is that chance or are we all getting assigned to water? Seems that the whole idea of focusing on an element isn't good if we're all doing the same one :P

DrGirlfriend commented 9 years ago

Same here, logged an issue against it but looks like it's closes as designed with supporting link https://github.com/ensingm2/SteamMonsterGameScript/issues/82

benji2290 commented 9 years ago

It assigned me air yesterday and fire today. I think its working as intended.

ensingm2 commented 9 years ago

Not sure, you'll have to check with @meishuu

JimRaynor56 commented 9 years ago

Ideally this script should use the method that wchill and steamdb use. parseInt(g_steamID) % 4

If your SteamID64 mod 4 is 0 pick Fire If your SteamID64 mod 4 is 1 pick Water If your SteamID64 mod 4 is 2 pick Earth If your SteamID64 mod 4 is 3 pick Air

ensingm2 commented 9 years ago

See https://github.com/ensingm2/SteamMonsterGameScript/issues/94 for why this doesn't work.

steamID > the max double value of javascript, so it gets rounded, leading to errors.

wchill/steamDB implemented a string hash function to get around this, but it has errors in the implementation that result in an uneven distribution, so it's actually less efficient than our solution.

That is a separate issue than people apparently getting set to water though.

DannyDaemonic commented 9 years ago

There's a problem with it, but this works:

g_steamID.slice(-2) % 4

It takes the last 2 digits, which give a range from 0-99, which is splits up evenly into 25 groups of 4.

ensingm2 commented 9 years ago

'g_steamID.slice(-2)%4' solution won't work either, as the range [0-99] is not divisible by 4, resulting in a non-uniform distribution

EDIT: I'm dumb.

JimRaynor56 commented 9 years ago

I didn't realize there was a rounding problem. Doesn't really matter at this point though. We should mostly be pushing for crit builds at this point. With elemental damage only really worth it up to level 10 or so, and then focusing on Crit after for the veteran players.

Maybe a check to see how many crit items you start with and if it's over a threshold like 30-40 it would cap elemental upgrades to 10?

meishuu commented 9 years ago

the range [0-99] is not divisible by 4

[0, 99] encompasses 100 numbers.

The main issue is that as was also discussed in #94,

you can think of the set of steamIDs as its' own PRNG

In other words, if the underlying distribution of Steam IDs is not uniformly distributed over the ring Z_4, then neither will this.

On the other hand, if it is, then it's... functionally equivalent to our current method.

Edit: I guess it gets bonus points for being deterministic. This may be enough to warrant a change.

Maybe a check to see how many crit items you start with and if it's over a threshold like 30-40 it would cap elemental upgrades to 10?

Right now we factor in the current crit_percentage in all click damage per gold comparisons. It doesn't predict the future yet but if you have a high starting number I would assume it would start to favor Lucky Shot more.

I wouldn't know because I haven't gotten into one of the main rooms the past couple of days.

DannyDaemonic commented 9 years ago

I was somehow thinking base 0 fixed that. Edit: I guess it does. Thanks @meishuu

Although it does seem more likely to me that the uneven distributions we're seeing are coming from the more flawed approach of other scripts. Perhaps combined they are just hugely more popular than this one.

ensingm2 commented 9 years ago

Edit: I guess it gets bonus points for being deterministic. This may be enough to warrant a change.

Being deterministiic doesn't functionally do anything in this case though.

And we're really only guessing with anecdotal evidence that steamID is evenly distributed (I think it is, but still not great to rely on assumptions), so we stand to lose more than we gain.

Assuming steamID is normally distributed, the only functional difference here is that at the beginning of a round, you'll either always get assigned the same element or get a random one. It doesn't change the distribution, or actually improve anything.

I guess you COULD make the case that after n days you know what is going to be autolevelled so you can buy a level or two before the script loads? idk, doesn't seem significant in any way to me.

Gonna close this for now, unless people are convinced deterministic is better.