Priority Inversion: NGU
i recently started playing with golang. Go is nice because it removes a lot of the gotchas in parallel programming but not all. Dead lock is still possible and so you are still responsible for all which that entails. Priority inversion is not the same as dead lock, but it can be a cause of it.
The game NGU IDLE sets a trap for the player in a part of the game called Blood Magic. If you do not solve the problem of priority inversion here, well you will not make the Number Go Up. Generating EXP is a goal in the game. With EXP you can control the dials of energy generation (the base resource of the game). We want to maximize how much EXP we get over time (EXP/t) so that we can manipulate this dial (increase energy throughput).
In order to generate EXP, we need to level, and fast. This is a tertiary gameplay loop.
In Blood Magic, we have multiple methods by which to contribute our blood and magic into a multiplier for our NUMBER which determines how much EXP/t we can get in our next life.
- poke with tack
- papercuts
- hickey
- …
Once you unlock Blood Magic, you will likely be at the point where you have enough magic to consume all of your money. Here, papercuts yield 5 Blood Per Second (BPS) and consumes all my money. The hickey yields 20 BPS, but will never trigger because the papercuts trigger earlier and consume all the gold.
If we do not remove our energy from the lower-level faster running task, we will never progress.
Looking at this as in compute terms, if we have tasks which are many and fast they can consume our entire compute resources if we don’t limit them. If these small tasks also depend on the completion of longer running task which never get the opportunity to run then we can end up in deadlock. Go recognizes when no threads are making progress, but in this case, the smaller tasks ARE making progress so it looks like work is being done, even though no work is ever being completed.
Thinking in terms of parallel execution requires a lot of attention. This theme comes up often in NGU. In some cases, you need to put your energy into the biggest task which will complete within this rebirth cycle, however long you decide that should be. If your rebirth cycle is 30 mins, obviously you don’t put energy in something which will never complete. The task which will complete at minute 29 is often worth the wait. In compute terms, be sure to keep your fat threads running.
Before dealing with this issue, i was slowing down and rebirthing with ~ 4 more bosses most of the time. Now I run up the multiplier provided by Blood Magic when the rebirth time gets long enough to do so.