Tag Info

New answers tagged

1

The game loop looks to see if the current time is after (greater than) the time the next update should have happened. A basic example with easier to understand timings (SKIP_TICKS is set to 2 seconds): 0 Seconds - Set nextGameTick to 2 seconds and Update Game (takes 3 seconds) 3 Seconds - If current time (3 seconds) > nextGameTick (2 seconds) update again. ...


4

Each time the loop executes, nextGameTick is incremented by 1000 / TICKS_PER_SECOND. This puts an upper limit on the framerate. In this case, it caps the framerate at a maximum of 60fps, because if a frame takes less than 16.67ms (1000 / 60) to execute, it waits until 16.67ms has passed from when the last frame started. By combining it with the loops ...


0

Just have one message loop with a state or stack of modal dialogs that override your usual control flow: handle message(): if is input message: if has modal dialog: handle modal input message else: handle main input message If you have a window stack, this might be made a bit simple: handle message(): get top of window stack ...


4

Music Unsurprisingly, slowing down the music currently playing will immediately let the player know the game has slowed down. Alternatively, you can play completely different music to indicate a change in the game's pace, or even play no music at all. A common way to complement changes in music is to play a transition sound to ease into it rather than ...


0

The server loop depends on the functionality required by the game. Generally the server is going to be responsible for maintaining an accurate game state because it is usually the authoritative party. So what does this mean for our server loop? The server loop handles new connections from clients, client transmissions, and automated functionality. Let's ...


0

Just to add to some others' answers here, something that no-one has explicitly mentioned: If you do take the risk of running your game loop in a second thread and it becomes unresponsive, you risk the OS terminating your application. That's why it's recommended to use a separate thread. Hence (for example) the NDK's native_app_glue.c/.h spawns a separate ...


5

Temporal Aliasing As Andon M. Coleman is stating out in the comments what you describe is called temporal aliasing. Temporal aliasing is due to a too low sampling rate of the scene compared to the the transformation speed of one or more objects within the same scene. In other words if an Object of the scene is more often updated (transformation speed to ...


0

A guess here, but logging on the same thread as your rendering work, before you send gpu instructions, can add synchronous disk latency? Possibly in a sporadic fashion if it's buffered and dumping. @Override public void create() { batch = new SpriteBatch(); img = new Texture("badlogic.jpg"); } @Override public void render() { ...



Top 50 recent answers are included