This is a bad idea. Don’t do it.

Updated: New syntax was introduced in a recent commit. Specifically, semicolons were removed and arguments must now be specified in a C-like style (though if there are no arguments, you don’t have to use parenthesis).

While playing around with Dive’s new scripting system, I decided to do some self-multiplying timers…

alias(repeater, "timer(\"1\",\"repeater() repeater()\")")

Don’t do this. If you have the debug overlay enabled, you will watch the task count increase exponentially until the engine freezes, trying to create more and more infinitely respawning tasks.

Actually, this should show why a better scheduler is needed within Dive. Right now, the scheduler tries to execute all tasks that have expired, no matter how long it takes. Instead, it should take into account how long tasks take, order them by when they expire, and execute them until it runs out of time in the current tick (pushing off other tasks for next tick). This wouldn’t solve this specific set of commands completely, as you are still going to hit memory limitations and a backlog of expired tasks, but it should hold off the freezes for a bit longer.

Oh look! I recently pushed a commit that changes how the scheduler handles execution time! The changes I talked about in the above paragraph have been implemented!

Leave a Reply