I added some more functionality to the queue processor. I ran into a bug that would add a process, and reorder the queue – but it was called inside another running process. This caused and infinite loop. Now, I added a process manager at the end of the queue. You push a process request on the process manager queue, and it’ll perform the actions needed, outside the queue itself.
For instance, in-game (player) controls is a process in the queue. It runs when in game engine is running (there are other control/input processes for different ‘windows’ or other parts of the game). The process reads the input of the buttons. For certain button action, a new process might be pushed onto the queue. Processes can remove themselves, and they do. If the player pushes a certain direction, and a screen edge, or stairs, etc is encountered – it’ll call a scroll or warp process as needed.
I do the same for action events. I’m implementing the basic attack process this week. The button detection logic ran inside the game control process. It would push the attack process into the queue, but I did this with a priority level request (rather than just anywhere in the queue). This just happened to be above the current process (game controls). Causing the game controls process to be re-run on the exit of that process. No good. Instead, and much better design, I implemented at request system that happens outside the queue. Much safer.
Now back to working on attack code..