New Stat Tickers Running

Hey Folks! Hope everyone enjoyed their weekend! Yesterday was a stat holiday here, so no news from Monday. Should be back to normal schedule now, though.

I actually spent most of today in the code, which was a nice change. After testing the ticker system on sleeping successfully, I began switching all remaining stats over to the new ticker system. For reference, this is a prelude to getting the game to limit updates on game objects so only the ones that need it get it, and only when they're ready to do something.

There were a few bumps in getting the tickers converted, as a few of the stat systems had unusual timings or conditional triggers. But just about everything seemed to work once I got them switched over.

The next step was to change the way those tickers kept track of time. Instead of ticking their time left per-frame, it needs to know how long since the last tick. "Live" objects in the scene work fine with per-frame timing, but objects not currently loaded will miss out on updates. Keeping track of their last update time means I can rapidly catch them up to the present when they load into the scene.

It's a small change, but it seems to have introduced some unexpected issues. Chained interactions are not progressing, and things like breathing are too slow. This could just be a matter of wrong units, or some ticker not getting correct deductions, so it might be a simple fix. But I'll have to look into that more tomorrow.

Once this is done, the next step is to finally turn-off the per-frame update code in each game object, and setup some sort of master tracker to handle their updates. This master tracker will be doing to game objects what the ticker system does to game object stats. Namely, it figures out which game object will need the soonest update, and only bother counting down that object's next ticker. When it's ready, it does whatever it needs, everything else in the master tracker list is advanced in time, then it is re-inserted into the master list for a future update. And the new "next update" object starts ticking down.

In theory, it means I just update one object per-frame, and occasionally process an action plus advance a bunch of timers. Instead of thousands of objects updating per-frame.

This sounds sane. So I guess we'll see if it works! The good news is that if it turns out to be a bad idea, I've got the backup checked-into version control.

Tags: Ostranauts