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
0answers
20 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 ...
1
vote
1answer
60 views

My HTML Canvas went blank

I tried to draw Mario Sprites in my HTML Canvas, but it always went blank. Anybody knows why? ...
0
votes
1answer
19 views

I can't clear the paint image in my Canvas

I'm trying to make the Mario move, but somehow it leaves traces behind, can anybody help??? ...
0
votes
0answers
57 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 ...
0
votes
0answers
54 views

How does Quake II 'sleep'?

I'm looking through the Quake II source code and I cannot understand how the game implements sleeping. Here's how I understand the Windows main loop: Inside the loop it sleeps if the game is ...
0
votes
0answers
36 views

Slick-2D Side scrolling problem

For the last couple of days I have been stuck on a a problem with side scrolling (trying to create a parallex effect) in my game. Here is the following code for my update and render methods: Render: ...
0
votes
0answers
21 views

Animating Game Objects at Different Speeds

I want to animate multiple game objects at different speeds in the context of Python Turtle Graphics, and I'm confused about my options. One approach is to use separate timers for each object, as in ...
0
votes
0answers
32 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 ...
0
votes
0answers
20 views

Confusion about updating and rendering camera in different threads

So basically my problem is that the camera is stuttering and seems to just completely stop updating when moving. It's not exactly a stutter because the camera slows and and also stops for split ...
3
votes
1answer
161 views

How do open world game engines allocate memory?

My troubles I've been trying to create a game engine but since I am not well experienced in C++ I am having trouble deciding on how to load new scenes efficiently level by level or just an open world. ...
0
votes
1answer
144 views

How often should I check for collisions in a Miinecraft-like game?

I'm trying to build a game from scratch in Dart, similar to Minecraft. As far as I understood, there are two main functions in a general game loop: tick: a function that gets executed a fixed ...
0
votes
1answer
81 views

How to slow down my Variable Timestep Loop in Java

I am currently developing a game in Java and I ran into a problem At first, I thought my game loop was working well as it was giving a similar amount of FPS as the tutorial I was following Then I ...
0
votes
0answers
37 views

Does it make sense to combine both Fixed TimeStep and Semi-fixed TimeStep for different update methods in a game loop?

Recently, I have started developing my game engine and I have been reading about game loops and the differences between Fixed TimeStep and Semi-Fixed Timestep. Both of them can be found around the web,...
1
vote
0answers
71 views

Game loop stutters

I have the following game loop: ...
0
votes
1answer
583 views

Need help with an 'Exception thrown:write access violation:this was nullptr' in a c++ - SFML project

I'm currently learning how to program a 2d game with SFML using a tutorial series by Suraj Sharma.This's his channel: https://www.youtube.com/channel/UC2i39AOpDSlO1Mrn1jQ8Xkg The tutorial series: ...
0
votes
2answers
190 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.
3
votes
1answer
193 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
152 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 ...
4
votes
2answers
188 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. ...
0
votes
1answer
43 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
43 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
220 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 ...
0
votes
2answers
389 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
231 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
215 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
111 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 ...
2
votes
2answers
78 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 ...
4
votes
1answer
202 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 ...
1
vote
1answer
84 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 ...
0
votes
1answer
188 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 ...
0
votes
0answers
47 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 ...
0
votes
1answer
87 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
262 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
276 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: ...
0
votes
1answer
80 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 ...
3
votes
2answers
102 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
265 views

C++ create array of multiple types

I tried to create an array Entity[] with elements Human and Zomby. ...
0
votes
1answer
68 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: ...
0
votes
2answers
210 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
153 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
0answers
62 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 ...
1
vote
0answers
81 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 ...
0
votes
1answer
45 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 ...
1
vote
1answer
108 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 ...
3
votes
1answer
425 views

SDL2 mouse motion event keeps occuring

The code I'm using is like so: ...
0
votes
1answer
436 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 ...
0
votes
1answer
99 views

Time loop/ticking architecture

Say I build a snooker game, where balls need to jitter around. Balls belong to a class (ball class), where all the ball functions are defined. In the animation, time evolves by a clock ticking ...
0
votes
2answers
177 views

While loop running in thread, but not doing anything [C++]

I am trying to multi-thread my game so that one thread updates and renders the player, while the other listens for inputs. I used a while loop to keep my detached thread running in the background, ...
1
vote
1answer
232 views

My Java Game's movement looks awfull. Maybe Problem with Thread.sleep

I have a big problem with my Java games. In every game I make the movement of the player and objects just looks awfull. The framerate is 60 fps without any problems. But the movement looks extremly ...

1
2 3 4 5
9