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.

55 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
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
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
3 votes
0 answers
2k views

Framerate independent realtime input

I am currently working on a fighting game (with 3d graphics, gameplay like a 2d fighter) and encountered a pretty big hurdle I currently don't know how to deal with. For fighting games, input ...
FM Productions's user avatar
3 votes
0 answers
922 views

Tick frame: update order problems

Sorry, it's a bit long story but I hope you can help me. First of all: I have an entity class called SceneObject. The SceneObject has components (eg. RenderableMesh, Camera) and transformation data (...
csisy's user avatar
  • 365
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
2 votes
0 answers
821 views

What's the best way to set up an OpenGL draw loop in windows?

On mac os x, there's a way to pass the system a function pointer that is triggered at an ideal time to start your drawing code. These are the CVDisplayLink tools. ...
Tyler's user avatar
  • 333
1 vote
2 answers
114 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
  • 109
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
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
1 vote
0 answers
95 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
0 answers
101 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
1 vote
0 answers
464 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
1 vote
0 answers
620 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
1 vote
0 answers
31 views

Unity problem with instantiated objects when destroyed

So this is my problem, I have a square that when destroyed spawn 4 smaller squares when shooting on it, but when I shoot one of the 4 smaller squares sometimes a different square that are not even ...
galbe-droid's user avatar
1 vote
0 answers
113 views

Game loop stutters

I have the following game loop: ...
Gavriil's user avatar
  • 183
1 vote
0 answers
92 views

How can I solve the jerky images when camera positions were calculated and sent from another computer?

I'm working on a simulator project. Computer A which uses a stick as a controller to produce operation data and calculate simulate data which will be sent to computer B as camera positions to render ...
Sheldon Wang's user avatar
1 vote
1 answer
302 views

NodeJS client gameloop running slightly faster than server gameloop

So I'm working on a real time multiplayer game in NodeJs (Client and Server). Both loops handle the same "physics" (movement at a constant rate) and both are running at 40hz or 40 times per second. I ...
DanteVentura's user avatar
1 vote
0 answers
547 views

Help designing Board game using LibGDX

Hi i'd just like to preface this by saying i'm new to game development and currently learning the ins and outs of libGDX. I want to create the board game scrabble however i'm having trouble figuring ...
sleepingOnion's user avatar
1 vote
0 answers
952 views

How to properly multi-thread my game loop?

I am trying to implementing multi-threaded game loop in iOS. (Actually, two thread - Render and Update) This is my structure. Update Loop Has logic and at the end of loop, save update state. (...
PowerDDang's user avatar
1 vote
0 answers
358 views

Delay command execution over sockets

I've been trying to fix the game loop in a real time (tick delay) MUD. I realized using Thread.Sleep would seem clunky when the user spammed commands through their ...
David Fox's user avatar
  • 123
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
0 votes
0 answers
35 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
0 votes
0 answers
22 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
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
0 answers
166 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
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
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
491 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
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
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
1 answer
291 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
0 votes
0 answers
30 views

Organising gameobjects into multiple lists

I have a very simple little game that consists of a player, zombies, food, and treasure. It's all automated. The player will walk towards a zombie and shoot within a certain distance, which costs ...
BBQSquirrel's user avatar
0 votes
0 answers
347 views

Game loop implementation

I'm implementing simple Windows game. Here is my game loop, which I've written based on some tutorials found on the Web: ...
Daros911's user avatar
  • 101
0 votes
0 answers
259 views

Are you supposed to be looping through all PhysicsObjects at every step in a physics engine?

I am currently making a small 2D game and I am trying to implement some basic 2D physics. I currently have a list of around 100 PhysicsObjects which I loop through every frame in order to update and ...
James L's user avatar
0 votes
0 answers
264 views

How to implement jumping on the left and right?

I am trying to make a platform game in C++ and SDL2. I tried to add a jump in the update() function of the main code below , but it does not work as expected, as you can see in the video: Note: I did ...
The Thinker's user avatar
0 votes
0 answers
170 views

Texas hold'em game logic loop

Ok, so I was thinking of making a Texas Hold'em game, and I wanted to write down the game logic loop before starting. Here's what I have. Tell me if I missed anything or if anything is wrong. Game ...
Sayaman's user avatar
  • 200
0 votes
0 answers
162 views

The Command pattern and multiple inputs per frame?

I'm reading Game Programming Patterns by Robert Nystrom. As a test I've implemented the command pattern, but a little farther in he changes it to return commands, rather than instantly executing them. ...
Chris's user avatar
  • 1
0 votes
0 answers
546 views

Game server multiplayer architecture

I'm planning to build a big browser multiplayer game with gameplay very similar to agar.io but rpg. Game will be containing rooms as It's done in agar.io. 50-100 players max per room. Realtime. 10ms ...
artem baltser's user avatar
0 votes
1 answer
77 views

How to disable pause() in game_loop() once game_over() function is called?

How can I disable pause() in game_loop() once game_over() function is called? game loop ...
Gayatri Rout's user avatar
0 votes
0 answers
306 views

Java game loops with high tick times?

Take for example the first game loop from this question. A similar code is used in Minecraft (at least in older versions). I understand the concept and how this loop works in principle. But there is ...
stonar96's user avatar
  • 101
0 votes
0 answers
235 views

Game Rooms Server Architecture - ENet CSharp

My team and I are working on an upcoming online fighting game using ENet-CSharp (A C# ENet implementation created by nxrighthere), and we're currently designing the architecture of the server. We ...
Ido Sofi's user avatar
0 votes
0 answers
685 views

Best game loop architecture

So I understand how a game loop works (listenInputs/updateData/redrawInterface) but what I'm struggling with is how am I supposed to equalize rendering? I initially thought I had to make the thread ...
Axel Carré's user avatar
0 votes
0 answers
42 views

My server simulation is getting locked up between receiving movement input from players and updating projectile position

I'm currently developing a 2D game in the browser with Nodejs and Canvas. Im simulating the world state in the server side with a timestep of 60 frames per second. Im only sending a snapshot of the ...
Paco S's user avatar
  • 1
0 votes
0 answers
144 views

How Best to Implement Fixed Time Step for Gsync/Freesync Monitors?

I currently implement my game loop using a variable fixed timestep, i.e. dt = 1 / monitor_refresh_rate with vsync (or pseudo vysnc with delays where vsync is ...
Edward Chamberlain's user avatar
0 votes
0 answers
124 views

Is creating a separate thread for each game session a bad idea?

I'm currently working on iocp game server. My game is just like diablo3 basically. 1~4 players join a separate session. I did basic iocp preparations and now I'm working on game session class. The ...
Jeongmin Heo's user avatar
0 votes
1 answer
46 views

Moving object with preset timelapse

I am a newbie game developer. I have one problem. Consider the following case. I have a simple game with only one object - a ball. A ball can move only up and down from one side to another. A User ...
solderingiron's user avatar
0 votes
1 answer
344 views

Reference sf::RenderWindow from another source file in SFML

In SFML, How would you be able to reference a window in your main.cpp file to another source file? I want to be able to reference the window made in ...
Gman0064's user avatar
0 votes
0 answers
548 views

Cocos2d pause game freezes the screen

I am trying to create pause screen for my game. The game is developed upon continuous scrolling background (top to bottom) with obstacles which are moving independently (left to right). Below is the ...
Paresh Thakor's user avatar
0 votes
0 answers
410 views

Limiting Rendering in my game loop (Not Game Updates)

My Gameloop (code below), limits the game updates to 60 ticks per second. However, it renders as fast as the device on which it is being run can handle. I'm using a fixed time step in my game and I ...
BungleBonce's user avatar
  • 1,927