Random Programs

For builders to discuss and ask building questions.
Post Reply
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Random Programs

Post by Harroghty » Tue Sep 08, 2009 10:08 pm

Kregor wrote:While we would obviously not want to bog down the server with a ton of random progs triggering, I feel in some cases, that a 1% rand prog or two here and there in an area ...
Is this a valid concern? Dalvyn does not seem to mention it here.

Will too many random programs be an issue for the game's stability?
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Re: Random Programs

Post by Dalvyn » Wed Sep 09, 2009 12:28 pm

Note that there's a difference between rand progs and rand checks.

Rand progs (>rand_prog X~) triggers constantly once every few ticks, which means that they run all the time (*). They can take a heavy toll on the server resource. Basically (and I know this is not 100% precise), a rand_prog 20 means that, every tick, the game rolls a d100 and, if the result is under 20, it runs that program. Whether the program is run or not, the roll is made. One roll is not a big problem, but 50 mobs with a rand prog means 50 rolls each tick, plus running 20% of those programs.

Rand checks inside a non-rand prog (e.g., rand checks inside a greet_prog like the one presented in the link you give) do not run constantly: they are triggered and checked only when someone goes into a room where the mob is (since it's a greet_prog).

Hope that clears things?

-----

(*) Though I'm not entirely sure how they are coded - it is possible that rand_progs only run when there is a character in the area or something like that. I know I have been surprised by their behaviour in the past.
Image
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: Random Programs

Post by Harroghty » Wed Sep 09, 2009 9:12 pm

I have tried to use primarily >greet_progs with a lot of random checks in order to add some color to the area, but I have also included some random programs. Based on this guidance, I will reduce the amount of programs.

So, yes, it clears things up. Thanks!
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Post Reply