ID:135586
 
Why has Dreamseeker been resently taking over half my CPU Usage PER dreamseeker? It used to take like 10% for 2 put together. Can someone make sense of this?
Metroid wrote:
Can someone make sense of this?

Poor programming.
In response to Goku72
Regular ticker with spawned() stuff. If your ticker event takes longer than your ticker delay, you get a build up.

50%? Bah. I once saw a game eating a full 98% of a CPU. And that was through a Linux shell command, not the odd CPU var.
In response to Hazman
Yeah, Aaiko hates hosting Seika 2 because his CPU Usage jumps to 100% and doesn't wanna move from it. And when someone joins, you can't do anything for about 10 minutes.
In response to Zaole
That's actually painful. If it jumps to 100%, it's probablary because of several infinate loops, several NPCs and an inefficient character generation and world/New().
In response to Hazman
Just wondering, could it possibly because I have loads of NPCs that wander randomly?
In response to Metroid
Yes, just use step_rand().
In response to Hazman
I do.
In response to Metroid
Then, theoretically, there shouldn't be a problem. Just as long as you don't have a while(1) loop or anything like that.
In response to Hazman
well actually I recently changed it to
proc/met_step_rand(atom/movable/a)
step(a,pick(NORTH,SOUTH,WEST,EAST))

mob
monster
proc
RandWalk()
spawn while(1)
met_step_rand(src)
var/B = rand(20,60)
sleep(B)


But that should basically do the same as step_rand without the diagnal walking.
In response to Metroid
Metroid wrote:
well actually I recently changed it to

proc/met_step_rand(atom/movable/a)
step(a,pick(NORTH,SOUTH,WEST,EAST))

mob
monster
proc
RandWalk()
spawn while(1)
met_step_rand(src)
var/B = rand(20,60)
sleep(B)

But that should basically do the same as step_rand without the diagnal walking.

Nope, not quite. step_rand() uses an edge-following system which makes the AI only change direction at semi-random intervals or when the next step would take it into a dense object. This usually produces a more "aimless" random movement system, instead of a "mindless" random movement system, but has a disadvantage that, unless you force the AI to pause and change its direction manually, it can -- possibly -- eventually wind up just walking in a fairly continuous loop around the edges of the map.

Deadron has his own routine, dd_step_rand(), which provides an excellent mix between random mindlessness and deterministic aimlessness -- and offers more parameters than the typical step_rand() proc, allowing you more flexibility. I'm not sure which library it's in, however, so you might have to do some digging.
In response to Spuzzum
Actually, I think its more of a Virus, for the CPU problem, Because recently, ive actually ADDED more monsters that use my rand_walk, and the CPU has gone down 20%. Either way, wehn I get home ill check more...