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
1 vote
1 answer
83 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 ...
Fen1kz's user avatar
  • 185
1 vote
2 answers
111 views

Making a game loop to run multiple threads

I'm having a really hard time understanding Threads and their contents. What I'd like to have is a main game object (which I have) and a loop, where I can measure the time it takes for two threads to ...
Valtsuh's user avatar
  • 99
0 votes
1 answer
29 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: ...
Momus's user avatar
  • 1
1 vote
2 answers
152 views

How to implement C# methods that automatically get called in the game loop, like Unity's Update() etc.?

I've been working on my own game engine for some time, I ideally need a way to create global function implementations to make it easy to do things within the game loop. Heres an example: ...
Pow's user avatar
  • 404
0 votes
0 answers
33 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?
ina's user avatar
  • 294
1 vote
0 answers
72 views

How do I create a build from a custom Game Engine?

I have an custom Game Engine, made in C++ and made in Microsoft Visual Studio 2019. Currently, this Game Engine has a .sln with the following projects: TheGameEditor, which is the current entry point ...
JonathanCacay's user avatar
1 vote
1 answer
80 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 ...
Andy's user avatar
  • 13
0 votes
0 answers
21 views

Why is my NavMeshAgent Waypoint system not looping

I have a character moving along 5 waypoints and it should be looping, but for some reason the Update method stops after the character reaches the last waypoint. The output for currWaypoint is 0, 1, 2, ...
Audrey Chung's user avatar
5 votes
1 answer
678 views

What causes some web game engines work in "slow mo" mode instead of reducing FPS but continuing to show the true time/tick state of things?

I used game engines that are capable of cross-platform export: Cocos Creator, Godot, Unity, others. Some game engines have this thing, called "physics update" or "fixed update". ...
idchlife's user avatar
  • 229
1 vote
1 answer
67 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: ...
Bogdan's user avatar
  • 111
0 votes
1 answer
139 views

Simulated light for a 2D tile-map with just SDL2?

I'm working on a 2D tile-map RPG with C++17 and SDL2 + SDL_Image. There are daily cycles, weekly cycles and seasons. Even a kind of weather engine provides atmosphere. The moods and times of day are ...
El_Codepone's user avatar
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 ...
curiousguy_08's user avatar
1 vote
1 answer
840 views

How to make an actual idle game fun?

I'm making an Idle RPG with a roguelite element. I want this game to be a true idle game and not like most other idle games where you have to click an upgrade every 10 seconds to keep progressing. It'...
Pascal Claes's user avatar
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 ...
Juzzbott's user avatar
  • 123
1 vote
0 answers
93 views

What is deltaTime calculated between?

I watched a recent YouTube video about deltaTime and at around 3:50 the author talks about how it is calculated. He goes on to claim that it is NOT The time elapsed between the frame currently being ...
Vilx-'s user avatar
  • 167
1 vote
1 answer
133 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 ...
YoshGJ's user avatar
  • 505
0 votes
1 answer
263 views

How would i make two loops for a game engine

I want to structure my program as shown in the first two images, but I don't know how to get make two game loops happening simultaneously. The arrows show the flow of data. ** I figured that having ...
IcedSalad's user avatar
0 votes
1 answer
162 views

Accepting user input in continous game loop

I have a game loop that simply iterates through every entity and calls entity.update() ...
Michael Moreno's user avatar
0 votes
1 answer
145 views

How can I make a reliable time-based object updating system?

So an object has a position, velocity, and is affected by gravity. ...
CPlus's user avatar
  • 143
1 vote
0 answers
100 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, ...
desade's user avatar
  • 19
0 votes
1 answer
123 views

Input processing on the server-side

The problem: Let's say we want to create top down MMORPG in browser, and we started with implementing movement of your character. Okay, so how it works? Character gets inputs and compares if they are ...
saqirmdev's user avatar
0 votes
1 answer
155 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. ...
Nameless King's user avatar
0 votes
0 answers
164 views

Explaination of Extrapolation from Game Programming Patterns

I'm looking for help because there is one thing from the game loop which I don't clearly understand. I'm in some way of doing implementation of my own 2D game engine based on book „Build Your Own 2D ...
Jakub Kowalski's user avatar
1 vote
0 answers
453 views

Why is processing the Windows message queue so slow?

PeekMessage, TranslateMessage, and DispatchMessage often take a long time (sometimes more ...
KTC's user avatar
  • 470
0 votes
1 answer
600 views

Why process physics before the variable framerate update in a game loop?

As far as I know, most game loops are executed in the following order: Process user input Update (once per frame) Physics (also known as fixedUpdate, 0 to N times ...
BlackGlory's user avatar
3 votes
0 answers
130 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 ...
WaveRunner's user avatar
0 votes
0 answers
124 views

How to implement an attack with a real-world duration like in Clash of Clans?

I wanted to understand how a strategy game like Clash of Clans would implement the attack. Clash of clans is just an example I am taking but I am interested in understadning logic of attack in any ...
rsp's user avatar
  • 101
2 votes
2 answers
1k 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 ...
bananab0y's user avatar
0 votes
1 answer
128 views

Pygame, jump counter resetting on first button press

Been learning my first platformer game based on this tutorial. I decided I wanted to go off book and make it so the player could jump a second time before hitting the ground. I used the blit function ...
jacko_123's user avatar
0 votes
0 answers
490 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 ...
AndroGR's user avatar
0 votes
1 answer
2k views

How to measure deltaTime? [duplicate]

I'm trying to make a simple console application and don't want to use Unity, but I want to implement a timer, so I would want to use Time.deltaTime.
Astronautical's user avatar
0 votes
0 answers
34 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 ...
Decent Dabbler's user avatar
0 votes
2 answers
663 views

Game loop c++ implementation

I'm starting to develop some simple 3D game. The basic topic for a start is the game loop. There is a solution: ...
 darro911's user avatar
0 votes
2 answers
694 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... ...
4Matt's user avatar
  • 101
1 vote
0 answers
613 views

How to make an update loop in a Node.js game server

I'm making a multiplayer game with a Node.js server, and I'm searching for how to write the game loop. I'm currently using a setinterval every 15ms, but someone ...
Wild Royal's user avatar
2 votes
1 answer
841 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. ...
Jarno's user avatar
  • 21
1 vote
2 answers
648 views

SurfaceView shows black screen

My code does not work correctly. SurfaceView shows a black screen instead of Bitmaps. I make a game loop that doesn't depend on CPU, like Fix Your Timestep!, but I can't get it to work. ...
Limpan's user avatar
  • 11
0 votes
0 answers
87 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. ...
Limpan's user avatar
  • 11
0 votes
2 answers
532 views

How to reconcile collision detection with delta time?

In my simulation, if an object is inside another object, it imparts a force proportional to the distance inside the object (basically a separation force). I am having an issue though where the ...
Ryan Peschel's user avatar
0 votes
1 answer
237 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 ...
Alta's user avatar
  • 1
1 vote
3 answers
719 views

What can help make my Resource-Management game into a FUN game?

I am working on a "life simulator" resource-management game where the player has to go to work, go studying, pay rent,... and basically increase his resources and use them to unlock perks, ...
OC_RaizW's user avatar
  • 1,450
0 votes
1 answer
500 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 ...
Rahul R Badenkal's user avatar
0 votes
1 answer
98 views

SFML: Object's shape not rendered on the window [closed]

I want to be able to render sf::CircleShape (representing pointwise charges) when pressing mouse buttons on the window. The problem is easy enough, however the ...
user avatar
0 votes
2 answers
180 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 ...
Dmytro Brazhnyk's user avatar
1 vote
1 answer
158 views

One global game loop vs multiple local game loops

What are the advantages of using multiple game loops instead of one? Assume Level1, Level2, Level3. These levels may bring totally different problems and needs and they may also be completely separate,...
user avatar
0 votes
2 answers
225 views

When does a "frame" start and end?

Here is the main loop that I currently have (and it does work perfectly): ...
HeatSync's user avatar
1 vote
1 answer
529 views

Multithreading vs Asynchronous game loop for multiplayer online game?

I'm trying to create a turn based multiplayer online game where players can be grouped in a room/lobby and play (similar to Ludo but number of players can be more than 4). There can be multiple such ...
Kaushal28's user avatar
  • 111
0 votes
1 answer
290 views

Structuring a game in Java

I am currently programming my first game in Java and I'm having trouble structuring it. My biggest concern is regarding the game loop. Currently I have implemented a class with only a main function ...
gina16's user avatar
  • 1
0 votes
0 answers
173 views

Game loop design

I'm developing a simple Win game. Here is my 2 similar implementations of the game loop (in c++): approach #1: ...
Daros911's user avatar
  • 101
1 vote
1 answer
317 views

Where should I handle player movements in a Java Game?

I had an old pure Java 2D top-down game that I'm trying to reformat a bit. Before, I had a bit of a messy game loop that didn't use delta timing for any movements or animations. Now, I'm trying to ...
ElliottV4's user avatar

1
2 3 4 5
10