Statistics Lua

Discuss and unveil current Marathon projects.

Post Aug 18th '10, 02:59

I finally got projectile tracking working correctly. This was very difficult, due to inadequacies in the design of the Lua API. It would be much easier if there were triggers for when projectiles are created and destroyed; as it is, I have to keep a list to check against in various places. Just checking in idle() isn't enough, since if you fire point blank at a wall or alien, projectiles can be created and destroyed in between two idle() calls. You probably don't want to look to see what I did.

I am noticing that firing the AR is going to lower the accuracy score considerably. Say you can kill a monster with a shotgun, and get 1/1 for it. Or you can kill it with an AR, and usually some of those will miss, and others will be fired after the monster is dead--maybe you hit with 40 / 52. Even if you switch to shotguns after one clip of AR, you have to kill more than 60 monsters without missing to regain an accuracy score of 90%.

Should we weight the weapons somehow based on their innate accuracy? Should we just not worry about it, and people striving to finish Aye Mac with 100% accuracy just shouldn't get to use AR?
User avatar

treellama
Pittsburgh

Post Aug 18th '10, 04:38

Well I suggested a form of weighting back with the TOZT. I think that's a fine idea.

The big problem is that you can't reload, and so I find myself spending a lot of ammo (say up to 1/4 of a SMG/AR magazine at a time) to do so.
User avatar

RyokoTK
Saint Paul, MN

Post Aug 18th '10, 09:24

Weight it or cut it. The ar main has a big spread. Perhaps it's not a weapon one aims to be accurate with?
User avatar

goran

Post Aug 18th '10, 13:01

G.S.10 wrote:Weight it

But how?

RyokoTK raises a good point: I will often fire a couple rounds from the .44 to clear the clip, too; or some shots from the fusion pistol to drain the battery.

I can write the script, but I can't come up with a good way to calculate accuracy.
User avatar

treellama
Pittsburgh

Post Aug 18th '10, 13:55

For reloading, here is one idea:

while holding down the action key, accuracy is turned off, and shots doesn't count. (if possible, they don't do damage either)


For weighting the AR:

divide shots by X

divide by 10
40 hits and 12 misses = 4 hits and 1,2 misses

divide by 20
40 hits and 12 misses = 2 hits and 0,6 misses

divide by 52
40 hits and 12 misses = 0,77 hits and 0,23 misses
User avatar

goran

Post Aug 18th '10, 14:39

G.S.10 wrote:For reloading, here is one idea:

while holding down the action key, accuracy is turned off, and shots doesn't count. (if possible, they don't do damage either)

That will be far too annoying for anybody to use, I think. For future reference, scripts can only detect that the action key has been initially pressed, not whether it is still held down.

For weighting the AR:

divide shots by X

divide by 10
40 hits and 12 misses = 4 hits and 1,2 misses

divide by 20
40 hits and 12 misses = 2 hits and 0,6 misses

divide by 52
40 hits and 12 misses = 0,77 hits and 0,23 misses

Well, which one? Should we divide each weapon by its clip size?
User avatar

treellama
Pittsburgh

Post Aug 18th '10, 15:34

Lets use this as a starting point for discussion

How much every hit is worth:

pistol bullet = 1
fusion bolt = 1
loaded fusion bolt = 1
Missile = 1
Grenade = 1
Shotgun = 1 (using the mechanism discussed earlier in this thread)
Alien weapon = 1
Smg = 0,5
Assault rifle (main) = 0,04

Flamethrower = 0,04
fists = 1
Last edited by goran on Aug 18th '10, 15:36, edited 1 time in total.
User avatar

goran

Post Aug 18th '10, 15:40

One AR magazine is worth 1.08 bullets, but one SMG magazine is worth 16 bullets?
User avatar

RyokoTK
Saint Paul, MN

Post Aug 18th '10, 15:44

RyokoTK wrote:One AR magazine is worth 1.08 bullets, but one SMG magazine is worth 16 bullets?



...2,08, but yes that is correct. If you think that is wrong. Suggest something else.
The smg, even though pretty accurate, fires quite rapidly, so perhaps it should have a lower multiplier? E.g 0,25 or 0,125?
Last edited by goran on Aug 18th '10, 15:49, edited 1 time in total.
User avatar

goran

Post Aug 18th '10, 16:04

How about for reloading, if the person can tap the action key along with the bullets being fired, the misses don't count.
User avatar

Wrkncacnter

Post Aug 18th '10, 16:10

W wrote:How about for reloading, if the person can tap the action key along with the bullets being fired, the misses don't count.

taps you the eight foot tall burton
User avatar

treellama
Pittsburgh

Post Aug 18th '10, 16:38

1) If you're shooting away your bullets because you want to reload, you're not using your ammo in the optimal way. You could see poorly dosing your bullets as a type of inaccuracy.
2) The problem with the AR (and similar for shotgun and TOZT) is the following:
If all bullets miss, you're shooting badly (you deserve 0%)
If only 50% miss, you're shooting rather well (you deserve more than 50% anyway)
What you could do is take the Xth root of the proportion of hitting bullets/shot bullets.
E.g. You shoot 40, 10 are a hit. Then 10/40 or 1/4 of the bullets are a hit, but you take, say, the square root, so you get 50%
You shoot 40, 20 are a hit. Percentage = sqrt(20/40) = 71%
Last edited by Drictelt on Aug 18th '10, 16:39, edited 1 time in total.
Eternal - Xmas I - Xmas II - Xmas III - Victory Dance IV - Winter I: The Venom - KTA III - Phoenix - somewhere in the heavens, waiting: The Syndicate
User avatar

Drictelt

Post Aug 18th '10, 17:01

I like that idea.
D?rovací tvá?í.

Fobo: I find it hard to keep a sentence down under two paragraphs.
User avatar

tehWastedJamacan
SuFu, SD

Post Aug 18th '10, 17:22

The problem that poses is that the amount of pellets that hit doesn't always depend on your aiming skill, as was brought up earlier.
Last edited by Dis on Aug 19th '10, 02:32, edited 1 time in total.
Image
function rate() { x = document.getElementsByClassName('current-rating'); for (var i in x) { x[i].style.cssText = "width: 25px"; x[i].innerHTML = "Currently 1/5 Stars."; } }

if (document.URL != "http://www.simplici7y.com/reviews") window.onload = rate;
Dis

Post Aug 18th '10, 17:23

Drictelt wrote:1) If you're shooting away your bullets because you want to reload, you're not using your ammo in the optimal way. You could see poorly dosing your bullets as a type of inaccuracy.
2) The problem with the AR (and similar for shotgun and TOZT) is the following:
If all bullets miss, you're shooting badly (you deserve 0%)
If only 50% miss, you're shooting rather well (you deserve more than 50% anyway)
What you could do is take the Xth root of the proportion of hitting bullets/shot bullets.
E.g. You shoot 40, 10 are a hit. Then 10/40 or 1/4 of the bullets are a hit, but you take, say, the square root, so you get 50%
You shoot 40, 20 are a hit. Percentage = sqrt(20/40) = 71%


I like your sqrt root idea. Makes it possible to be in the 70-90% range with the smg and ar without too much trouble.
User avatar

goran

Post Aug 18th '10, 17:43

Dis wrote:The problem that poses is that how the amount of pellets that hit doesn't always depend on your aiming skill, as was brought up earlier.

My reasoning was that the percentage of hits is partially caused by good aiming, partially random. Assuming that the random factor generally doesn't allow you to go over 50%, we want to stretch the range from 0 to 50% to have maximal influence. I know that this approach still doesn't eliminate the random factor, but I believe it should represent your aiming skills better.
Eternal - Xmas I - Xmas II - Xmas III - Victory Dance IV - Winter I: The Venom - KTA III - Phoenix - somewhere in the heavens, waiting: The Syndicate
User avatar

Drictelt

Post Aug 18th '10, 17:44

So, what is the final math?

Accuracy = sum(all "clips") / num "clips" where each clip is:
.44: hits / fired, per shot
fusion: hits / fired, per shot
AR primary: sqrt(hits / fired), per clip
AR grenades: hits / fired, per grenade
shotgun: 1.0 if any of pellets hit, 0.0 otherwise, per shot
SPNKR: hits / fired, per missile
SMG: sqrt(hits / fired), all or nothing per shot like shotgun, per 1/2 clip
TOZT: sqrt(frames that do damage / frames), per 1/4 tank
AG: hits / shots, all or nothing per shot like shotgun, per shot

This should be fun to calculate on a continuous basis. If only the sum of square roots were the same as the square root of sums! :(
User avatar

treellama
Pittsburgh

Post Aug 18th '10, 19:18

what do you mean by "per X"? Does this mean the accuracy of 1/4 of a TOZT canister will weigh as much as 1 fusion shot?

Anyway, personally I would store the total amount of shots, as well as the amount of hits, for every weapon for every player and keep recalculating the overall accuracy, taking the square root separately for every weapon.

Also, isn't the SMG fairly accurate? I dont know if a sqrt is necessary there.
Eternal - Xmas I - Xmas II - Xmas III - Victory Dance IV - Winter I: The Venom - KTA III - Phoenix - somewhere in the heavens, waiting: The Syndicate
User avatar

Drictelt

Post Aug 19th '10, 17:50

Treellama wrote:So, what is the final math?

Accuracy = sum(all "clips") / num "clips" where each clip is:
.44: hits / fired, per shot
fusion: hits / fired, per shot
AR primary: sqrt(hits / fired), per clip
AR grenades: hits / fired, per grenade
shotgun: 1.0 if any of pellets hit, 0.0 otherwise, per shot
SPNKR: hits / fired, per missile
SMG: sqrt(hits / fired), all or nothing per shot like shotgun, per 1/2 clip
TOZT: sqrt(frames that do damage / frames), per 1/4 tank
AG: hits / shots, all or nothing per shot like shotgun, per shot

This should be fun to calculate on a continuous basis. If only the sum of square roots were the same as the square root of sums! :(


This looks good to me.
User avatar

goran

Post Aug 28th '10, 21:05

G.S.10 wrote:This looks good to me.

Can you give this script a try, and see if you are happy with the weights? It will only work for player 0, and there are no controls. Once you are happy with the weights I will finish the rest of the script.

You can edit the weight for each type of projectile at the top of the script, and you can control whether the square root is taken by changing the _exp for each projectile type.

It feels like AR bullets may be weighted too lightly; perhaps it should be per 1/2 clip rather than per clip.
Edit (fixes fusion pistol): [attachment=4200:StatisticsTest.zip]
Attachments
StatisticsTest.zip
(1.29 KiB) Downloaded 76 times
Last edited by treellama on Aug 28th '10, 23:55, edited 1 time in total.
User avatar

treellama
Pittsburgh

Post Aug 28th '10, 22:44

I know this is still being worked on, but when I use the Fusion pistol i get an error "attempt to preform arithmetic on field '_exp' (a nil value)."
"My advise: V" - g pack
User avatar

brilliant

Post Aug 29th '10, 13:59

Treellama wrote:Can you give this script a try, and see if you are happy with the weights? It will only work for player 0, and there are no controls. Once you are happy with the weights I will finish the rest of the script.

You can edit the weight for each type of projectile at the top of the script, and you can control whether the square root is taken by changing the _exp for each projectile type.

It feels like AR bullets may be weighted too lightly; perhaps it should be per 1/2 clip rather than per clip.
Edit (fixes fusion pistol): [attachment=4200:StatisticsTest.zip]


Good work with this.

I've done some brief testing and I have to agree with you about the AR. Too light right now. Currently, I say 1/4 of a clip. I'll report back when I've tested the script thuroughly.
User avatar

goran

Post Sep 2nd '10, 17:20

Any more feedback on this? I'll go ahead and adjust the AR weight, and add the square root to the TOZT I forgot, and add controls. I will probably post it to S7 if that's OK.
User avatar

treellama
Pittsburgh

Post Sep 2nd '10, 19:55

Go ahead :)
User avatar

goran

Post Sep 7th '10, 02:42

Finally finished this up. The calculations in the script I posted earlier were totally wrong. The end result is OK I guess:

http://www.simplici7y.com/items/statistics-lua
User avatar

treellama
Pittsburgh

Previous

Return to Projects



Who is online

Users browsing this forum: No registered users

cron