HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Calculating Actions Per Minute APM

11-23-2009, 03:19 AM#1
PsycoMarauder
So, just wondering if you guys knew of any efficient way to calculate a players APM. I have some ideas on how to go about this, but just wondering what you guys thought
11-23-2009, 05:18 AM#2
MysticGeneral
Efficient? Well, I wouldn't see any means of efficiency. There is no way to get the exact amount of APM, however. For example, if a player has hotkeyed a unit/hero/group to "1" and constantly spam the button "1", it will not pick up the action if they are already highlighted or selected. Lots of other things that cannot be calculated.
11-23-2009, 08:46 AM#3
DioD
any order = +1 to APM works well in AOS only.
11-23-2009, 11:39 AM#4
MysticGeneral
Any order is only one type of action. What about when a player selects a unit? What about when a player uses a target-skill but cancels it? How about when a player presses the F# keys? Some of these can be detected, some can't. All of these cannot be added by simply "any order +1" method.
11-23-2009, 12:09 PM#5
DioD
Calculate what you like, order is most effective way.
11-23-2009, 08:21 PM#6
TriggerHappy
I'm not completely sure what APM is but I am guessing it's the number of actions per minute with a unit??

Anyways, you could just hook all that deal with unit actions.
11-23-2009, 08:43 PM#7
MysticGeneral
No, not with a unit. That would be APMU. This is overall actions per minute a player makes. A typical professional gamer would average around 300 APM. And really crazy ones get around 400 APM. If you are to make an APM calculator on WC3, you can never make a perfect one because WC3 lacks the functions to be able to do so. You can get damn near accurate, but not perfect. There are many programs out there that can display your APM while playing any game.

WC3's editor lacks the ability to recognize every keystroke or selection. There are a few other things that cannot be calculated by WC3's editor, but like I said, it can come damn near close to being perfectly correct.
11-24-2009, 09:45 AM#8
fX_
just detect all select and order events by the player, since these are the only 'actions' he can do (but maybe im missing some?).

[F1]/[hotkey[group/non-group]] selection -> selection event
whenever there is a selection/order event mark some flag as 'true' and start a 0.0 timer and mark a +1 to actions. if another selection event occurs during this '0.0 interval', it is a group selection event and do not add (+1) to actions for these selection events. (u should probably add in some stuff to compensate for 'order changes' - since scripts can issue orders during an order event - issued by scripts. also, see below).

only other problem is to distinguish between player and script-issued orders. maybe you can hook all order natives to set a flag to 'true' when an order is issued by the natives (set it to false afterwards); refer to this flag to determine if an order is script-issued.

but maybe im missing some things.

edit:
dont think u can detect selection for destructables and items, but these might not be so relevant.
actually, maybe you should hook selection natives, too.
ull need to have flag (boolean) and timer 'sets' on-per-player.
for 'action packets', which involve one or more action events depending on whether or not the action is a group action, you can prob generalize all of a player's actions and account for them with only 1 boolean for the player since a player can execute only one action at a time. however, script-issued order flags will prob have to be 1 per native/bj.

edit2:
but all this only counts/logs actions. ull need something to 'monitor it through time'. ull prob need to run a timer for 60.000 seconds (1 min) each action that detracts 1 action count from the total APM count on-elapse. there are prob other ways to do this, but they dont seem 'nice'; but this method will use one timer per action, and there might be many actions (just for a single plyaer, consider multiple). the natives/bjs involving selection and ordering are many but they can be reduced to a smaller amount natives (bjs... 'inlined'...).

for selection, there are (inactive) deselection events.
ex: u have a footman selected and u select another footman (or even a group of other footmen). the previously selected footman gets deselected. this will register a deselection event but it is not actively done by the player; it cant be counted to APM. but this is handled by the 'event packet' check (above).
deselection events dont happen when units die (i remember testing this sometime, or maybe im just imagining)

edit3:
i wanted to try making it and this is what i have so far (read 'current build info' comment):
note: the 0.00 duration timer works for 'action packets' but it seems to 'lag' coz not all action events are being registered.
Expand JASS:
test:
to test, just load a map with units you can play with, import these triggers and requirements (timerutils), and run the map.
Expand JASS:
11-24-2009, 01:37 PM#9
fX_
seems that selection events are 'laggy'. they dont get registered if followed quickly enough by another selection event (even if the units in the first event respond by saying something).

EDIT: actually, this is wrong. problem's with the 0.0 duration timer. it seems that a 0.0 duration timer neither really 0.0 nor very short. it is possible for a player order an order within the 0.00 interval...