Meaning of stat number

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Meaning of stat number

Post by Apeirogon »

I did not fully understand what change stat numbers on thinker.
Wiki only says
The engine utilizes stat numbers on thinkers to organize thinkers and whether to call their Tick() functions or not.
Yes, I see that some stat numbers allow thinker to tick and some not, but I dont find on github what is the difference between, say, STAT_DEFAULT, STAT_DLIGHT and STAT_USER_MAX.
Is it call same tick function or no? Or I must define new tick for STAT_USER_MAX thinker?
Or they use one, global, common, communist tick, and stat numbers only tell gzdoom that first it must handle with thinker which have stat number 1, then with stat number 2, 3, 4...inf, -1/12?
User avatar
AFADoomer
Posts: 1341
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Meaning of stat number

Post by AFADoomer »

The STAT_* number determines the order in which actors "think". Basically, it sets the order in which each type of thinker's tick actions are performed during each game tick...

So, anything with STAT_DLIGHT (the dynamic lights) ticks before thinkers with STAT_DEFAULT (most normal in-game thinkers and actors), while ACS scripts (STAT_SCRIPTS), tick *after* most other thinkers.

You shouldn't have to change the stat number unless you require some sort of special handling for your thinker. If you do change it, then it's best to use something in the range between STAT_USER and STAT_USER_MAX (70-90).
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Meaning of stat number

Post by Apeirogon »

Then, there are no difference, how much CPU think for, between STAT_DEFAULT and STAT_USER_MAX?!
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Meaning of stat number

Post by Graf Zahl »

No. CPU usage will be the same. This is all about ordering thinkers, because some stuff needs to be done before other. In a few places thinkers also get a special statnum for faster lookup but that shouldn't be abused too much because if you get the order wrong, bad things can happen if you do not think about dependencies.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Meaning of stat number

Post by Apeirogon »

Okay, and whot about thinkers that dont actualy think? They dont tick at all?
Can I use stat_static to make some decoration, like blood pool or bullet mark on wall, which dont consume much of CPU time?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Meaning of stat number

Post by Graf Zahl »

No. Do not use non-ticking thinkers for map objects. That may cause some unforeseen problems. A non-moving object won't consume much time anyway.
Post Reply

Return to “Scripting”