If you have a lot of objects walking (walk, walk_rand, walk_to and walk_towards) in the same location CPU usage massively increases.
This only occurs if the objects are at the exact same location as they move, if they're all at different locations, there is no issue. So it's likely somehow related to collision checking (these objects are not dense, nor am I making any use of bump/cross/crossed).
Numbered Steps to Reproduce Problem:
Create 100 objects at the same location. Have them all walk in the same direction. Watch as CPU usage sky rockets.
Code Snippet (if applicable) to Reproduce Problem:
mob/verb/movetst()
var/i=100
while(i)
var/obj/O=new(locate(50,50,1))
walk(O,SOUTH)
i--
Expected Results:
CPU usage is not so high.
Actual Results:
Here are the results of tests I did
10 FPS
100 objs using walk (south): 15-16 CPU
100 objs using walk_rand: 2-12 CPU
100 objs using walk_towards: 27-29 CPU
100 objs using walk_to: 85-90 CPU
30 FPS
100 objs using walk (south): 47 CPU
100 objs using walk_rand: 6-36 CPU
100 objs using walk_towards: 86-90 CPU
100 objs using walk_to: ??? CPU (basically resulted in a freeze, saw a spike of 250 CPU usage once)
60 FPS
100 objs using walk (south): 95-96 CPU
100 objs using walk_rand: 12-48 CPU
100 objs using walk_towards: ??? CPU (freeze, saw 180 CPU before it froze)
100 objs using walk_to: ??? CPU (freeze so bad I couldn't see sort of reading)
As you can see, walk_rand has the lowest CPU usage because the mobs walk in different directions and not as many are stacked on top of each other.
Does the problem occur:
Every time? Or how often? Everytime
In other games? N/A
In other user accounts? N/A
On other computers? N/A
When does the problem NOT occur?
If objects aren't stacked in the same location it's not an issue.
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: