flick() is really unoptimized or has something wrong with it.
To make built in functions appear in the cpu profiler (.debug profile) so that I can measure their impact on my game I placed them all in wrapper functions. See the code example.
And I will use those wrapper functions everywhere in my code in place of the built in function name
And this reveals that flick() uses the most CPU time in my game by far, even though all it is used for is when a player uses the punch command. So you have 100 players with about 20% of them fighting at any time, each able to attack about 2 times a second at the most, so flick() is being used AT MOST 40 times per second in the game. These are high estimates.
And here is what it looks like in the profiler:
You can see it is closely followed by sleep()'s wrapper function which is called Sleep(). And then every function I have written myself uses far less than flick() which is pretty ridiculous
Numbered Steps to Reproduce Problem:
I would guess you just call flick() like 50 times a second and watch it use way more cpu than it should, maybe it depends how many players are on.
Code Snippet (if applicable) to Reproduce Problem:
proc/Flick(i,atom/a)
flick(i,a)
Expected Results:
flick() uses a reasonable amount of cpu
Actual Results:
flick() uses more cpu than ANYTHING in my game (Dragon Universe) which is a huge game with a lot of code so the fact that flick() is at the top of the profiler is pretty insane when it is so conservatively used (It is only when a player punches)
Does the problem occur:
Every time? Or how often?
In other games?
In other user accounts?
On other computers?
When does the problem NOT occur?
When you don't use flick()
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Workarounds:
Maybe if I code my own version of flick()