The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
0
votes
0answers
15 views

Boost.Asio as job system [closed]

What are in your opinion pros and cons of using io_context from Boost.Asio as job system to create multithreaded game engine?
0
votes
2answers
45 views

How to repeat scene in Unity 3D?

When my game ends I want it to automatically restart from the beginning so that the whole scene repeats itself. How do I do that in Unity 3D? Please refer this link for clarification.
1
vote
0answers
41 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. ...
0
votes
1answer
374 views

Competing keyboard events

When I was looking on how to handle key inputs in a game loop I came across the following pattern: All native key events (up or down) get queued in an event queue that is later processed. The outcome ...
1
vote
1answer
145 views

Game object appears to accelerate too slowly

thank you for checking out my issue! I am trying to develop a game in java, but I have run into a problem. I would like to keep the physics as realistic as possible, so I am using a fixed time-step ...
0
votes
1answer
65 views

Pause updating but keep rendering

I am creating an implementation of Snakes and ladders and I run into some issues.The game is updating too fast and I want to limit the framerate kinda,or make a pause so that the move is actually ...
0
votes
1answer
31 views

Moving an Enemy Toward the Player but only in cardinal+diagonal directions

I am working on a "quick project" to get my feet wet and to put something finished in my projects. I want to make an enemy that constantly tries to be aligned with the player object, but doesn't ...
3
votes
2answers
128 views

C++ Object management/deletion

I am working on a game with a lot of bullets, currently every second it loops through a vector of bullet objects and checks if its marked for erasure or not. ...
1
vote
1answer
64 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 ...
0
votes
1answer
34 views

Game server simulation loop updates to fast even if the fixed steps are implemented

Today I wanted to ask you about the server world simulation loop that I have implemented and it acts weird. I am using Java, LibGDX and KryoNet to create 2d rpg co-op game based on server-clients ...
0
votes
1answer
20 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 ...
0
votes
2answers
239 views
4
votes
1answer
627 views

Render Stutter - OpenGL or loop timing?

For some time now i have no been able to pinpoint the nature of the rendering stutter shown above(by not clearing the screen, not using SwapBuffers and drawing only to the front buffer). See the big ...
0
votes
0answers
20 views

How can I make my animation switch frames automatically without pressing any keys?

So I have been trying to figure out for so long how I can loop the frames on my animation automatically without entering user input to prompt movement of my object. I have four different frames for a ...
0
votes
0answers
115 views

Jittery / stuttering motion when using SDL2

I've been using C++ and SDL2, but can't seem to get smooth motion when I have objects moving in the window. I was originally using SDL_GetTicks() and SDL_Delay() in my game loop, but one of the posts ...
1
vote
1answer
169 views

Box2D simulation running slower on lower FPS(even when the desired FPS is lower than the actual)

I´m playing around and trying to make myself an easy platformer using the Box2D physics, before that I was not using it and was using my own physics implementation(just simple movements with timestep)....
0
votes
2answers
115 views

Implementing a main loop with rendering in a Windows Desktop Application

I'm writing the beginnings of a small game engine in Visual C++. What I have so far doesn't seem to be updating the rendering each frame, but I don't understand where I'm going wrong with it. The ...
1
vote
2answers
103 views

How to handle player input with fixed rate variable fps time step?

I've made a system which uses the ideas from "Fix your Time Step" in order update physics. I'm having trouble finding standard methods for dealing with this when user input affects player movement ...
0
votes
1answer
674 views

Is this paint method okay?

I dont know why i need to call super.paintComponent() and super.repaint() to make the player's movements update, if i just put paintComponent the game seems like to always be stopped. However I think ...
0
votes
1answer
94 views

Instantiate prefabs at particular vectors using text file (Unity3D game)

I need to read a text file containing two pieces of information on each line, and use that information to instantiate a prefab at the correct location in a Unity3D game (c# script). The locations are ...
0
votes
1answer
135 views

How does a game like Minecraft handle block and entity updates?

I am not asking how Minecraft loads chunks or generates chunks, I am asking about individual blocks and entities and their behaviours. Suppose you have a dirt block: dirt block can be converted to a ...
0
votes
1answer
85 views

Game loop inside libGDX game loop

I have the main game loop in libGDX. On the touch() event I want an animation to be executed. So I will have a variable which will store the value which will be ...
0
votes
1answer
51 views

How to update model transform of components when using physics?

I implemented a high level components system for my renderer and am curious about the right way to update the transforms components of models that have a physics rigidbody attached. I am using ...
2
votes
2answers
64 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 ...
-1
votes
1answer
61 views

Web based poker on Phaser 3

Please can somebody help me as I'm a lil bit new to game dev and user interface designing. I am trying to create a simple Texas holdem poker using phaser3 for multiplayer application. I have a few ...
2
votes
1answer
7k views

Proper use of async, await and task.delay for a game loop

I'm currently in the process of making a game loop in a console application. I'm trying to make the game loop wait at the end of its loop for ...
4
votes
1answer
170 views

Fixed Timestep with Interpolation | Blurry & Choppy

I've been implementing a game loop with a fixed timestep which uses interpolation as described in the (legendary as I have come to find out as it is referenced in almost every post I have read trying ...
0
votes
0answers
42 views

Stuck at Goomba's speed and cancelling animation at game over

I'll try to be as precise as possible. First Issue: If you look in the code, I have a drawObjects function which calls collisionDetection function. Inside collisionDetection if player(mario) touches ...
1
vote
1answer
65 views

Is it always necessary to synchronize rendering in a game loop?

When writing a game loop from scratch in java for an android game applications, it is very common in many tutorials I have read that the keyword synchronized is used to synchronize update and ...
3
votes
1answer
233 views

SDL2 mouse motion event keeps occuring

The code I'm using is like so: ...
0
votes
0answers
28 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 ...
4
votes
1answer
2k views

Java Game Loop Efficiency

I'm quite new to java. I was watching 2 video tutorials on how to make java game and read a couple articles about game loop. However, I'm still confused about how game loop actually works. The ...
13
votes
4answers
5k views

Programming the combat sequence in a role playing game

I'm trying to write a short "game" where a player goes around and fights monsters but I have no idea how to handle the combat. For example, say I have a "Warrior" and a "Troll". How do the two fight ...
0
votes
1answer
124 views

JavaFX AnimationTimer VS Swing Game Loop

After looking at some code sources out there I noticed Java Swing Games usually create a class implementing Runnable, create a new Thread and set up the game loop ...
1
vote
2answers
74 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: ...
19
votes
3answers
5k views

Design of a turn-based game where actions have side-effects

I am writing a computer version of the game Dominion. It is a turn-based card game where action cards, treasure cards, and victory point cards are accumulated into a player's personal deck. I have the ...
0
votes
2answers
109 views

is this approach correct to make my game framerate indipendent in javascript?

this is what i did my game loop is run every REFRESH milliseconds loop = setInterval(tick,REFRESH); in the loop i calculate how much time is passed since last ...
0
votes
1answer
56 views

Make a variable go down as another goes up?

I am making a JavaScript game called "Spoop: The Clicker", and I have a variable shown by text: ...
3
votes
2answers
91 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 ...
2
votes
2answers
128 views

C++ create array of multiple types

I tried to create an array Entity[] with elements Human and Zomby. ...
0
votes
0answers
161 views

writing a game loop for a networked multiplayer game

i am trying to implement a networked multiplaye game. i understand the game loop described here : ...
0
votes
2answers
199 views

How can I benefit when I don't use gpu?

I am trying to make a 3D game with C++, SDL, and OpenGL. My program roughly looks like this: control function has only CPU operations. draw function has CPU and OpenGL functions operations. I just ...
0
votes
1answer
43 views

Canvas Infinite Map: How to have reappearing objects at static X,Y even when looping

I made a html canvas example of an infinite scrolling map with objects in static places. As you can see in the Fiddle below, when you move left with the Arrow Keys, you can see that the map does not ...
3
votes
0answers
498 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 ...
0
votes
0answers
55 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 ...
0
votes
0answers
30 views

Render and Update in Robotlegs Like Archtecture

I'm developing a small Snake game using a custom engine and trying to apply Robotlegs-like MVC-S architecture with Commands, Events as well. Currently I put some commands for collision checks, bounds ...
1
vote
0answers
73 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 ...
1
vote
1answer
243 views

Getting multiple inputs in C++ simultaneously using kbhit() function

I am using Turbo C++ to make a game using the graphics.h library (I know it's a bit old). In this game, the player can move left, right and they can jump using A, D ...
0
votes
1answer
20 views

In random loop button dont work properly

I have this code to add 10 point if someone click the button and change the question. But it returns 10 point every time. I want to make it 10,20,30,40... etc. ...
0
votes
1answer
215 views

Use vsync event instead of a 16ms timer?

I found that in game development, most people set a timer that gets triggered every 16ms to do the rendering. As an Android programmer, I'm familiar with the Choreographer. You set a callback that ...