Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are as many ways of building main loops as there are stars in the sky! Yours is perfectly valid and will probably work fine. Here are some things you might try:</p> <ul> <li><p>Where do you read the controls? If you're doing it in your "ui.update" and then responding in your "stage.update," then you're adding a frame of lag. Make sure you do "read controls -> apply controls -> update gameworld -> render" in that order in your loop.</p></li> <li><p>Are you rendering using a 3D API? A lot of books tell you to do something like this when you render (using OpenGL-ish pseudocode):</p> <pre><code>glClear() // clear the buffer glBlahBlahDraw() // issue commands glSwapBuffers() // wait for commands to finish and display </code></pre> <p>It's better to do</p> <pre><code>glSwapBuffers() // wait for commands from last time to finish glClear() // clear the buffer glBlahBlahDraw() // issue commands glFlush() // start the GPU working </code></pre> <p>If you do it that way, the GPU can work on drawing the screen at the same time the CPU is updating the stage for the next frame.</p></li> <li><p>Some game engines continue to render frames and accept some UI (for example, camera controls) even when the game is "paused." This allows you to fly around a paused game world and see what's going on offscreen when you're trying to debug. (Sometimes this is called "debug pause" as opposed to "real pause.")</p></li> <li><p>Also, lots of game engines can "single-step" (run one frame, then immediately pause.) That's very handy if you're trying to catch a bug that happens on a particular event.</p></li> </ul> <p>Hope some of that is helpful - it's just the random thoughts I had looking at your code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload