Skip to main content

Questions tagged [game-loop]

The central code loop responsible for handling the running gameplay. At its most basic state, it accepts input, resolves the actions of entities, and renders the scene.

Filter by
Sorted by
Tagged with
4 votes
1 answer
1k views

Online card games: game loop or event based?

The only games I've made have been the game loop variety. I'm just starting to think about building an online poker game where people could meet up in a lobby, etc. Cards seem event based... is the ...
Keith Myers's user avatar
4 votes
2 answers
114 views

Exchanging data between custom-built hardware and games

I have a built my own steering wheel and motion platform that I would like to connect to popular car racing games (e.g. iRacing, Dirt Rally). I need to read data such as the car's acceleration (to ...
user129365's user avatar
4 votes
1 answer
191 views

Dealing with interpolation and object creation/destruction

I've implemented a game loop similar to that in Glenn Fiedler's Fix Your Timestep! article. I have an update step running at 50Hz and a render step running at 60Hz (monitor refresh rate). To keep ...
jmegaffin's user avatar
  • 4,923
4 votes
2 answers
280 views

How do I consolidate the differences between iOS and Android update loops?

I'm currently working on moving some Android-ndk code to the iPhone. From looking at some samples it seems that the main loop is handled for you and all you've got to do is override the render ...
kkan's user avatar
  • 55
4 votes
2 answers
330 views

How to store the state of the world for a fixed time step?

Most of the posts on fixed time steps say something like this: ...
Lisa Anne's user avatar
4 votes
3 answers
576 views

Synchronise graphics and logic code

I have a procedural approach to the game loop that runs various classes. it looks like this: continue any in progress animations check for used input apply AI move things resolve events such as ...
Skeith's user avatar
  • 1,287
4 votes
5 answers
718 views

Flash Game not working on Android

I am not sure if I will be able to provide enough information for someone to answer this question, but any ideas might help. I am creating a tower defense game in Flash and I eventually want to make ...
Sean's user avatar
  • 267
4 votes
2 answers
600 views

Laggy empty project at 60FPS

...
Redugsix's user avatar
4 votes
1 answer
2k views

Does libgdx implement the game loop for you?

Initially, I assumed that the developer has to implement the game loop because libgdx is a library - not an engine. But then I found out that Graphics has ...
Nathan N. Gonzalez's user avatar
4 votes
1 answer
289 views

Correct order of entity updates and collision detection

I'm trying to simulate a number of units walking in a single file. My update loop looks like this: ...
Can's user avatar
  • 141
3 votes
2 answers
758 views

Should I redraw every pixel?

For my first game I implemented a tetris clone in javascript. My "canvas" and an HTML <table> with every <td> ...
PBG's user avatar
  • 173
3 votes
2 answers
842 views

Designing the Update system (read very basic game engine) for an XNA game

I am trying to determine the best way to implement the "update" system or engine for a simple XNA game. Description of situation I have a few classes, lets call them: Player [will be an array/list/...
Nate's user avatar
  • 5,064
3 votes
2 answers
4k views

Can I always assume that fixed time step in Unity is reliable?

I was thinking about games on low end machines or phones where the CPU would be limited. If I were to move all of my game logic into FixedUpdate() can I assume that ...
user3797758's user avatar
  • 3,641
3 votes
2 answers
2k views

Why does my game loop speed vary on different platforms with the same hardware?

I've got a serious issue with my game loop. This loop varies in time with the platform and with the same hardware. This is a list of FPS achieved: ...
Sri Harsha Chilakapati's user avatar
3 votes
2 answers
3k views

Using an interpolated game loop (such as Gaffer's final game loop), will the frame be rendered out of sync?

A highly recommended game loop is one from an article called Fix Your Timestep. It presents a method to update using a semi-fixed time step with interpolated rendering. The problem with this is that, ...
Dan Grower's user avatar
3 votes
3 answers
2k views

Frameskipping in Android gameloop causing choppy sprites (Open GL ES 2.0)

I have written a simple 2d platform game for Android and am wondering how one deals with frame-skipping? Are there any alternatives? Let me explain further. So, my game loop allows for the ...
BungleBonce's user avatar
  • 1,927
3 votes
3 answers
2k views

How precise should timers in update loops be?

What is the suggestion of "enough precision" in a timer for a fixed game update loop? Currently I'm testing with this code, but it sometimes misses 1-2 updates @ 50hz. While at 30hz it seems to work ...
hayer's user avatar
  • 596
3 votes
2 answers
8k views

Turn-based Strategy Loop

I'm working on a strategy game. It's turn-based and card-based (think Dominion-style), done in a client, with eventual AI in the works. I've already implemented almost all of the game logic (methods ...
Djentleman's user avatar
3 votes
1 answer
5k views

Why is the framerate (fps) capped at 60?

ISSUE I recently moved a project from my laptop to my desktop(machine info below). On my laptop the exact same code displays the fps(and ms/f) correctly. On my desktop it does not. What I mean by ...
dennmat's user avatar
  • 155
3 votes
2 answers
1k views

Explaining Asteroids Movement code

I'm writing an Asteroids Atari clone, and I want to figure out how the AI for the asteroids is done. I have came across that piece of code, but I can't get what it does 100% ...
Ahmed Saleh's user avatar
3 votes
1 answer
1k views

Varying framerate (FPS) [closed]

In my game-loop, I am using fixed time step for physics and interpolation for rendering as suggested on Gaffer on Games | Fix Your Timestep! However, when the framerate is varying between 30-60fps ...
Buddy's user avatar
  • 131
3 votes
3 answers
5k views

Delta times and frame lag in the game loop

Let's say we have a standard gameloop like this, in pseudocode: while (true) { dt = GetDeltaTime(); Update(dt); Render(); } Here ...
cfh's user avatar
  • 151
3 votes
1 answer
266 views

iPhone 3GS - can't ever seem to hold 60fps with CADisplayLink

So I've switched from NSTimer to CADisplayLink and I'm still seeing unexpected variation in my frame counter - it fluctuates ...
Justicle's user avatar
  • 712
3 votes
1 answer
1k views

SDL2 mouse motion event keeps occurring

The code I'm using is like so: ...
LASER BEAR ASSAULT UNIT's user avatar
3 votes
2 answers
3k views

Game Loop getting 58-62 FPS. Why not exactly 60FPS? (SDL/C++/OSX)

Here's my game loop: ...
Phildo's user avatar
  • 292
3 votes
3 answers
3k views

Should FPS exceed ticks/second?

I was once told that you should never re-draw a frame if the game logic has not changed since the last draw. Assuming game logic is updated once every tick, and assuming a game runs at 40 FPS @ 20 ...
mario_sunny's user avatar
3 votes
2 answers
945 views

Behavior Tree Iteration Rate

How is a Behavior Tree iterated in a game? For example, let's assume you have an extremely large Behavior Tree with about a hundred Actions/Conditions. If we were to run one action or condition ...
Free Lancer's user avatar
  • 1,283
3 votes
2 answers
1k views

WinAPI window taking 50% of CPU when idle

I'm currently working on a game that creates a window using WindowsAPI. However, at the moment the process is taking up 50% of my CPU. All I am doing is creating the window and looping using the ...
henryprescott's user avatar
3 votes
2 answers
640 views

Is single/double frame allocator suitable only for POD datas?

Let´s say I have a single frame stack allocator, so I´m using it for allocating memories for my temporary data. ...
Pins's user avatar
  • 569
3 votes
2 answers
3k views

Why game loop should be running on a separate thread?

I am struggling to fully understand the responsiveness argument suggesting to run the game loop on a separate thread other than main thread. When OS sends a user event (touch, mouse move, etc.) it ...
Kimi's user avatar
  • 643
3 votes
2 answers
9k views

Android: Improving surfaceView?

I'm using Surfaceview in my Android app. I have two threads, one for UI and another for rendering and updading the UI. I am limiting my frames per second to 30 fps and have employed frame-skipping ...
BungleBonce's user avatar
  • 1,927
3 votes
3 answers
2k views

My rhythm game runs choppy even with high frame rate

EDIT: [SOLUTION] I posted a possibly explanation for my issue below to anyone who has a similar problem. Hope it helps. I'm coding a rhythm game and the game runs smoothly with uncapped fps. But when ...
Felipe Lira's user avatar
3 votes
1 answer
782 views

How to structure tic tac toe game loop (or equivalent simple turn based game)?

I'm developing the simple Tic Tac Toe game in Java and got stuck on the game loop architecture. The game must support local, remote and automatic players. The graphical interface is based on JavaFX. ...
Sebastiano Verdolini's user avatar
3 votes
2 answers
1k views

How can I fix my velocity damping to work with any delta/frame time?

I am decreasing my velocity by 50% every second using a guide I found online. I am using the code here and it gives the right result but only for very small values for dt: ...
user avatar
3 votes
2 answers
146 views

When to stop taking items from ever-growing queue and start processing them?

I am developing a fast-paced multiplayer shooting game and following instructions from this source http://www.gabrielgambetta.com/entity-interpolation.html. In the article it says that: several ...
anekix's user avatar
  • 145
3 votes
1 answer
327 views

Endless Running Game - Changing Lane Function in JAVA

I am developing a kind of vertical endless running game, where the character has 4 possible lanes to be in. I am using libGDX and want the character to change lanes by adding a horizontal velocity to ...
Herbert Souza Silva's user avatar
3 votes
1 answer
333 views

Game loop in Javascript

I've been into javascript game programming with html5 and canvas lately. So far I've only been able to implement a game loop with setInterval, but I'm aware this means using fixed timestep. I've ...
Setzer22's user avatar
  • 480
3 votes
1 answer
10k views

Game Loop: Best way to limit the fps? [duplicate]

My game-loop looks like this: ...
user3146246's user avatar
3 votes
1 answer
273 views

How can I organize code for views efficiently?

I'm making a video game for the Android platform and I need advice on the overall set up of the activities and views in the code. I don't need actual code, psuedocode will do, but actual code always ...
kdavis8's user avatar
  • 395
3 votes
1 answer
215 views

Game loops using Hard realtime systems vs Soft realtime systems

I have read the article here about realtime systems and am looking for examples specific to game loops. Am I correct in saying: Hard realtime systems will lag and slow down gameplay causing slow ...
David's user avatar
  • 141
3 votes
3 answers
327 views

Should I use select() for networking in my gameloop?

I'm writing a simple networked game in C/C++. To keep things simple I'm using TCP. In my server's game loop I'm using a POSIX select() with a zero second timeout ...
Rasmus Rønn Nielsen's user avatar
3 votes
1 answer
274 views

Framerate control and physics engines?

I am reading this article on how to control the framerate and physics calculations. But in the game I am writing, I use a third party physics library and the only thing I do to update my physics is ...
Ashika Umanga Umagiliya's user avatar
3 votes
1 answer
568 views

How to wisely update body trajectories in a 3D space simulation game?

Suppose I have a Spacecraft object in 3D space, controllable by the player. I want it to update its own trajectory, so I give it a function for that (actually it might be inside a controller component ...
IGRSR's user avatar
  • 457
3 votes
1 answer
2k views

Handling game states for Android

Currently developing a game for Android. I went through a tutorial to get sprites, loop, etc. up and running, and it all works fine. The way it is currently set up is that Main creates a canvas, the ...
Chris's user avatar
  • 141
3 votes
2 answers
2k views

Implementing "Fix Your Time Step"

So far I have this implementation of "FYTS". However I am facing several problems. ...
Thomas Hartmann's user avatar
3 votes
2 answers
291 views

Unity Animation Tracking

Background I've recently reached a bottle neck in my game's code that forced me to completely decouple the logic/networking from the graphics. Thanks to the nature of my board game, I was able to ...
Mazyod's user avatar
  • 197
3 votes
1 answer
130 views

Informing objects within a particular state of the world state

Following the State pattern, every state in my game is a derived object that reflects a particular segment of the game (MenuState, PlayingState, GameOverState, etc.) Each of those state objects holds ...
roymcclure's user avatar
3 votes
1 answer
748 views

Best practice for organizing the physics of objects?

Apologies because this is a long post and I am inexperienced. I would really appreciate the input from some experienced developers. These are my two goals for this project: To learn the best method ...
Klik's user avatar
  • 133
3 votes
1 answer
1k views

Weird stuttering with fixed-timestep, variable-framerate game loop

I've been trying to set up fixed-timestep loop for my game, using the technique from here. I have no need for the interpolation step as I intend to run the logic at or above vsync speed. Here is a ...
Thew's user avatar
  • 31
3 votes
2 answers
2k views

HTML5/JS - Choppy Game Loop

I have been experimenting with HTML5/JS, trying to create a simple game when I hit a wall. My choice of game loop is too choppy to be actually of any use in a game. I'm trying for a fixed time step ...
Rikonator's user avatar
  • 131

1 2
3
4 5
10