19 Dec, 2009, Skol wrote in the 1st comment:
Votes: 0
I'm looking at 'mob generator' items that can be placed in areas.
What I'll do is make quite a few tables with the strings I need, then the mobs created will be set at a level appropriate to the area, strings/stats set up, moved out into the area (up to the generator's limit). New mob structure would have a pointer back to that specific object so if the mob is killed it decrements the amount 'out there' of mobs. Most likely update the generator (create say 10 mobs at a time) once per round or so until the max is met.

Question is: (thinking from a Rom memory use standpoint) would it be best to simply leave those mobs out there, or clear them out if the area is empty?

I'll most likely code in a max of say 50-100 mobs per generator to keep people from going nuts. The generators will be OLC created, set type of town/city/etc, who's in charge all that.
ie. goblin, size village, levelrange 1-20, mobs 50.
ie. mixed good, size town, levelrange 5-40, mobs 100.
ie. evil army camp, size town, levelrange 5-30, mobs 100.

Anyway, that gives you the idea. From a cpu usage and memory use (ps ux in bash), would it be best to purge them if the area is vacant and then make later? Or leave them alone.
19 Dec, 2009, David Haley wrote in the 2nd comment:
Votes: 0
Skol said:
From a cpu usage and memory use (ps ux in bash), would it be best to purge them if the area is vacant and then make later? Or leave them alone.

IMO the real question is: do you actually care?

Note that obviously purging them will reduce memory usage. Its effects on CPU are hard to tell because you need to process the purging but you also need to process mobs that exist. It's possible that you'd save on CPU by purging them, too.

My advice: see what happens if you don't bother purging. If you find yourself running out of memory or using too much CPU, worry about purging. Mobs are relatively cheap. "Premature optimization is the root of all evils", after all.
19 Dec, 2009, Skol wrote in the 3rd comment:
Votes: 0
Heh, I hear you. My only real concern would be that I'm using too much cpu and the server gets grumpy.
My thoughts are to try it both ways, monitor, change setting, try again etc. Some call it hack, some call it scientific process of elimination heh.

I totally hear you about 'premature optimization' lol, great phrase to hang onto!

As for 'how many at once' I'm thinking I might do iterations of 10, see if that spikes too much. Just trying to think when all the players are in all the areas, if it's going off 10 times in 20 areas etc. While I don't have a massive pbase (see also, golden years gone, WoW sucks, and every other MUD admins lament ;p), we still do have 15-25 or so on.

Speaking of premature optimization… I wonder if it'd be better to save 'blanks' of the prototypes, so there isn't as much 'random' to determine… blah//ing out lout, nm.
19 Dec, 2009, Runter wrote in the 4th comment:
Votes: 0
DH said:
IMO the real question is: do you actually care?

Perhaps a corollary to that is: Does it actually matter?

The answer is probably no. You're developing in C/C++ from what I've gathered. I can't imagine it actually making that much of an impact to require designing based around saving a few CPU cycles. Design the way is most natural and clean to develop in with the future in mind. I know you can't know your future needs—we never really do—but usually this type of premature optimization can complicate future development. Yes, yes, I said it again. :)