Rolling Pixels: Looping Fiasco

<p>This &lsquo;sprint&rsquo; was a good one! This branch of work was about having a turn-based loop separated from the game&rsquo;s render loop. I could see early on that trying to operate the game&#39;s turn-based rules from the render loop had problems. A quick Google search revealed agreement but no leads on solutions. &nbsp;I might have been lazy about this; I found a solid&nbsp;<a href="https://journal.stuffwithstuff.com/2014/07/15/a-turn-based-game-loop/" rel="noopener ugc nofollow" target="_blank">article by Bob Nystrom</a>&nbsp;late in my search after I made some decisions. I have the player selecting, clicking, and dragging, adding to a turn queue until &ldquo;End Turn&rdquo; is selected. That gets the non-rendering Turn Loop going. Game objects that can act push their turns to the action turn queue (a priority queue), and then the turn loop runs through the queue of commands executing them. Right now, they just make each game object fire off an animation, all at the same time!! LMAO! I needed a &ldquo;finished my turn&rdquo; event to pace the commands. There&rsquo;s still one call dependent on the render update loop, but I feel like I got 95% there. Refactoring may provide another look at why or making it better.</p> <p><a href="https://madjay.medium.com/rolling-pixels-looping-fiasco-ce1d13d88ba1"><strong>Click Here</strong></a></p>
Tags: Rolling pixels