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.
487 questions
1
vote
0
answers
126
views
Correctly handling input in case of frame drop
My game loop looks roughly like this:
...
0
votes
0
answers
222
views
Struggling with stuttering in my 2D C++/OpenGL game
I'm building a 2D game from scratch using C++ and OpenGL, but I've run into a frustrating issue: a simple sprite moving from left to right occasionally stutters. Tracking down the cause has been ...
1
vote
1
answer
291
views
Fixed timestep without cloning game state
I'm doing a JS game with hundreds of moving physical particles.
I've read the famous "fix your timestep" article. So far I've implemented basic prototype with janky game loop tied to FPS and ...
0
votes
1
answer
87
views
When does SFML deal with user input
I have an SFML programme using window.setFramerateLimit() to determine the time step of the game.
I have a game loop that looks like this:
...
0
votes
0
answers
71
views
Why do Unity UI toggle groups update *after* the default time in Execution Order settings?
Why is toggle group after default time in the default script execution order in Unity?
1
vote
1
answer
220
views
When should I call the physics simulation within the game loop?
I am thinking about where to call the physics simulation. The current situation is that I first update the entities and then the physics immediately before rendering. As you can see in the following ...
1
vote
1
answer
183
views
How to call every method with a certain name from a set of classes in C#
I have the following case:
I have a class called App.cs and here I have a function called Render, that runs once every frame:
...
17
votes
3
answers
6k
views
Game loop isn't performing well enough, so my frame rate is too low (Windows Form + GDI+)
I decided to learn about building games, so I picked up C# to use it along with Windows Form - I already have C# experience, so that was the main reason I did so. That said, I tasked myself to build a ...
2
votes
1
answer
2k
views
Who 'owns' the components in an ECS?
Currently looking and reading about entity component systems, and just wanted to ask about who 'owns' or where the components are registered.
I would have thought that each entity has a collection of ...
1
vote
1
answer
202
views
How to keep track of 'already happened' in-game events in (event cascade/chain of events)?
Basically title. Let's say, for example, I walk into Room, and Event A happens. Next time I enter Room A, Event B happens, because Event A already happened. I don't actually want to save this ...
0
votes
1
answer
304
views
Accepting user input in continous game loop
I have a game loop that simply iterates through every entity and calls entity.update()
...
1
vote
0
answers
135
views
Variable Timestepping & Unexpected Jerkiness/Stutter in a Simple Test Case Scenario
I have been bashing my head of an extremely simple case in my C++ game and would like some help. I have been researching about game loops, variable & fixed timestepping, rendering interpolation, ...
0
votes
1
answer
228
views
Key presses and game quit sometimes delayed by seconds
U'm currently trying to develop a 2D RPG similar to early Final Fantasy titles for the NES.
Up until now I've been reading C++ tutorials on SDL2 and doing my best to convert the concepts into OCaml. ...
1
vote
0
answers
790
views
Why is processing the Windows message queue so slow?
PeekMessage, TranslateMessage, and DispatchMessage often take a long time (sometimes more ...
3
votes
0
answers
172
views
Backend architecture for multiplayer browser text game with a short gameloop
This is my first foray into game-dev and I only have webapp experience professionally. I'm creating a browser game in nodejs/react. It is mostly text-based, so no intensive graphics (think chess.com ...
2
votes
2
answers
3k
views
How to deal with mismatch between fps and monitor refresh rate?
Say I have a game running at some number of frames per second on a 60 Hz monitor. I would like to display my frames correctly in the sense that the in-game time difference between two consecutive ...
0
votes
0
answers
629
views
How can I render a texture in a specific x/y position on the screen? (OpenGL - glium)
I am in the process of writing a 2D game in Rust, and decided to use glium for the graphics part. So far I'm doing fine, able to render textures and shapes ...
0
votes
0
answers
50
views
Signalling time-expiry to clients in a browser-based multiplayer game
I'm trying to develop my first ever browser-based multiplayer game that utilizes my own websocket server which has no multi-threading capability.
It will be a game where players try to be the fastest ...
0
votes
2
answers
1k
views
Understanding User Input Behind the Scenes?
I am a bit confused on how user input is actually received and processed behind the scenes in a game engine. Let's say I have a simplistic game loop as follows...
...
2
votes
1
answer
1k
views
How to synchronize the main thread (rendering, 60 FPS) with the game logic thread (10 FPS)
I wrote some games years ago, and they were always in sync with the main thread. So, for example if the monitor refresh rate is 60 Hz it would look like below.
...
0
votes
0
answers
105
views
SurfaceView gameloop
Could you suggest an implementation of a game loop with interpolation for SurfaceView and thread?
i have this, but it doesnt work.
...
0
votes
1
answer
325
views
Large Armies fight : Looping through a million elements
I'm currently developing my first game. I had the idea to do something similar to the old browser games like Ogame, Travian, etc (with some differences though), and I'm kind of unsure about how to ...
0
votes
1
answer
703
views
Proper way to handle user input when the game is lagging
I was just learning game programming concepts and was confused on what is the correct way to handle user inputs.
I am used to javascript, so all the below snippets are in js but I assume the concepts ...
0
votes
2
answers
272
views
Naming convention for loop modules
Question about game engine object oriented design.
Let’s say I have an engine with a main loop, and many handlers that will be executed by the main loop every time on next iteration of main loop. So ...
0
votes
2
answers
283
views
When does a "frame" start and end?
Here is the main loop that I currently have (and it does work perfectly):
...