Home Creators Posts Import Register Favorites Logout

Content

It's finally happened--I've put together a different underlying time system for Cogmind. The original system was something I borrowed from Rogue Basin when I'd never done one before and need a quick something for Cogmind 7DRL, and I liked it because it was a flexible approach with some pretty interesting characteristic. Of course, fast forward to Cogmind being years old now and I find we don't really need that flexibility, and those characteristics might even have negative side effects in some cases. More specifically, in Cogmind it's technically been possible to guarantee free peeks around corners, and a few people have been using such tactics, which is kind of tedious and also imbalanced and unintended. Earlier attempts to address this couldn't really overcome the inherent behavior of the underlying time system, so the idea was to make some bigger changes...

So I've put together a new release that completely replaces the old system with a straight priority queue which is reordered every time an action is made. Strategically speaking this approach to time is not quite as lenient as it was--while before you could often perform consecutive quick actions without interruption, now it's possible for other actors to take their turns immediately after you do something. But this vagueness has advantages, too, like it should theoretically be more difficult to guarantee free peeks around corners, for those who were using such tactics ;)

If you try out this patron-only build, test out peeking and any other "time cheats," and also just pay attention to regular gameplay, since immediately queue changes might have other effects now that turns are more granular! Be on the lookout for any time-related oddities as well. Or maybe you don't notice any difference at all? :P

You can access this build in one of two ways:

Steam: Open Cogmind's Properties, go to the Betas tab, and enter "newtimesystem"--this will add a new "experimental" branch you can opt in to (you may need to restart Steam for it to appear, it's stupid like that)

DRM-free: Send an email to gridsagegames@gmail.com from the address you purchased with, and I'll hook you up with a special download link

Saves in this release are incompatible with those from all previous releases. Note that anyone with wizard mode access can use it as normal in this build as well.

Leave any comments here, or discuss in the patron channel on Discord.

I'll be writing up a blog post about this later (especially once we have info on the results), but for now I'll leave my related notes below.

As an example of what I do when adding a feature, here's a list I made of all the things I needed to explicitly test or look into after getting the basic implementation down:

update TU debugging view;  add a full turn order list to the left of the map 

time values to make sure they're actually working...

actions properly rotate between turn timer and an Ent doing actions that require 100 tu

removing an event is safe

dead ents aren't somehow remaining in the queue, this seems to crash CMap

player has initiative on new map

turn updates happen normally, also relative to Cogmind

what if player kills themself on their turn? make sure that's okay...

test what if a lone player on a floor (only 1 ent + the clock)

BS unlimitedActions actually works

test autonomous weapons again;  check timer label;  make sure they're properly removed from the queue, too 

do an AI autotest to see if there are any time-related crashes

test on a large map to make sure the queue isn't slowing things down;  may actually want to run a sleepy performance test 

consider using algorithmic search to increase speed

Sure enough the game crashed when I tried to do an AI autotest, but fortunately it was readily repeatable and clearly related to the new changes somehow. Still, it took half an hour to track down the cause because the actual crashes were happening in a completely unrelated part of the code xD

Viewing relative time values for actors:

A new debugging view showing the top of the action queue, shading by how long until their turn. (I also have a yellow color for when actors late in the list have a positive time value, which was happening due to bugs and I needed to spot them, but ideally that should never happen now :P)

The queue in action in the Scrapyard.

The original time system didn't use any special algorithms to speed up the process, nor did my first implementation of the new one, but I did a bit of quick profiling and found that 11.59% of the turn processing was taken up by putting actors where they belong in the queue.

That seemed like a lot, so I did a bit of premature optimization. Sadly this took literally four hours because I'm an idiot when it comes to technical matters, but oh well I guess it was worth it. Got it down to 2.25% :)

Hope this new system works out okay!

Files

Comments

Suslik

i'm honestly just happy to see a bunch of method names in the profiler output :D i think this system might prove useful if you do end up implementing a valid save/load functionality to make it less abusable.

muxecoid

Not sure what changed. Performing action with delay of X still pushes you back X time units in the queue.