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
1answer
84 views

How do I deal with closely coupled systems in a game engine?

Let's say a game engine had a central game class as well as multiple systems (as objects) that are stored within it. These systems (such as input, rendering, sound, etc) would also be updated by this ...
0
votes
2answers
111 views

How to set up a key press to start the game

I've tried to create a simple start menu for my game which informs the player to press a key to start the game but the problem is that it works only if the key is pressed all the time...i'm not sure ...
1
vote
1answer
280 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 ...
5
votes
1answer
170 views

How do games implement client/server frame rate?

Do games have a frame rate at X fps that updates logic and also renders? Or do games update logic at a much slower frame rate than rendering? Let's say 20-25 fps for logic, and 60+ fps for rendering....
1
vote
1answer
51 views

Can I implement allocation-free time releated event scheduler via pure C#?

I read some article about a gameloop, based on Actor system. (yes, it is Development & Deployment of Multiplayer Online Games Vol.2 by 'No Bugs' Hare) Here is pseudocode. ...
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
47 views

Java advice (Printing game data to the window)

Does anybody know the best method for taking game data and setting up java to read the data then print it to the window... of which you want the game loop to start the game and read the data... Here ...
0
votes
1answer
116 views

Should I send the elapsed time to the fixed step update function from my game loop?

I am making a basic game loop based on this article. This is the nearly final version: ...
7
votes
2answers
4k views

OpenGL - How come drawing sprites takes so much performance

I'm wondering how drawing simple geometry with textures can eat up so much performance (below 60fps)? Even my good graphics card (GTX 960) can "only" draw up to 1000 sprites smoothly. The textures I'm ...
0
votes
2answers
190 views

Latency issue on multiplayer game networking

I am currently writing a 2D top-down shooting multiplayer game using Java. I have a game loop at the client-side that does the following in order in each game tick (The client is running in a tick ...
1
vote
1answer
207 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
146 views

How to handle component-based objects in a game loop?

I've been writing my own game engine and I was wondering the correct way to handle my game objects. Each game object is different. The only thing they have in common is a set of operations to handle ...
-1
votes
1answer
178 views

Is my frame rate being calculated correctly?

I'm having a long headache (which may not be that complicated) with this frame rate thing. I already tested several frame rate algorithms, lastly I tested this here and they all gave something strange ...
1
vote
0answers
315 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 ...
1
vote
2answers
41 views

In track and field dash, determine starting speed from a final time with acceleration

I am developing an athletics game, and working on the mechanics of the 100 meter dash. The player controls an athlete, that during the race has acceleration and a max speed. To win the race, the ...
8
votes
1answer
622 views

How can City-sim simulate hundreds of characters?

My games usually start lagging quite easily when there are a couple hundred of boxes representing possible characters. While games like SimCity or even Anno have hundreds of characters. I realized ...
3
votes
2answers
268 views

Is single/double frame allocator suitable only for POD datas?

Let´s say I have a single frame stack allocator, so I´m using it for allocating memories for my temporary data. ...
2
votes
1answer
258 views

Screen objects sometimes not rendering

I am a mildly experienced programmer who has created several game engine templates and small 2D games in Java. I am currently expanding to 3D game engines and I am re-writing a previous engine to be ...
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 ...
0
votes
1answer
22 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
1answer
82 views

Screen size independent movements

I am developing a simple game for Android. It is a really simple game, with only one object - a ball. I am using the game loop based on delta time. However I have noticed that my game runs not in ...
3
votes
0answers
563 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 ...
5
votes
1answer
436 views

How can I make the main game loop frame-rate independant?

I am trying to create a frame independent game loop. I am currently using the following code ...
2
votes
1answer
528 views

Game AI architecture for a RTS game

I am developing a RTS (real-time strategy) game involving robber and cops. I have designed a simple rule based AI system for the robber. Goals of the robber AI: Escape from the cops (robber should ...
6
votes
3answers
206 views

How and when should I update events occuring after a while?

This question is not language specific but a more generic approach on how to deal with lazy updates for some game variables. Let's say, for instance, that I want to implement a "character age system" ...
1
vote
1answer
225 views

Timestep with multithreading

There are several questions and articles which deal with timestep - for example: Should game logic update per second or per frame? https://gafferongames.com/post/fix_your_timestep/ Accounting for ...
2
votes
2answers
623 views

Using an interpolated game loop (such as Gaffer's final game loop), will the frame be rendered out of sync?

A highly recommended game loop is one from an article called Fix Your Timestep. It presents a method to update using a semi-fixed time step with interpolated rendering. The problem with this is that, ...
0
votes
1answer
186 views

How can I make the Player animation appear smooth?

I'm using GLFW for my window and input related work. I'm calculating delta time and multiplying it with my player speed and then finally adding it to the current position of the player. The thing is ...
0
votes
1answer
105 views

Character jumping but not returning to ground platform game AS3

I am making a platform game where the main character moves right and left and jumps however my character jumps and does not return to the ground but stays on top of the stage.My characters movie-clip ...
0
votes
1answer
310 views

How to manage changing Z-Index in an Entity-Component-System?

If got an Entity Component System based game-project (like classic zelda). The Player as well as Enemys are Entities with sprite- and tranform-components. The Weapons are also Entities with sprite- ...
0
votes
1answer
417 views

What functions should be called in C++ gameloop from Lua Script

I am using sol2 lua wrapper for my 2D game-engine to implement some lua scripting,but I have some questions about what should functions should i call from Lua scripts in c++, and i cannot find any ...
0
votes
1answer
703 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
569 views
2
votes
1answer
2k views

Game loop with multithreading

I have learned how to create and manage threads in C++. Now I'm trying to create game loop based on multithreading but I can't imagine how should I split whole game to tasks. I mean, should rendering ...
0
votes
1answer
481 views

Function call time

I'm making a game and I want an update method to be called every 120th of a second. I've looked up timers but they start the timer after the function has returned, but I want the timer to start when ...
1
vote
1answer
86 views

requestAnimationFrame handles game ticks weird when tab isn't viewed

So i have the game logic and render in the callback for requestAnimationFrame, and somehow the ticks run very weird. In fact, the rendering happens alright. But the ticks seem to skip an ...
1
vote
2answers
888 views

Java - Why does my game loop stutter randomly?

I'm a beginning game developer and I'm trying to make a game in Java, but for some reason, it keeps stuttering at random times. I believe what I'm experiencing could also be called microstuttering. ...
0
votes
1answer
349 views

Is this a good Java gameloop?

I wonder if this gameloop in Java is accurate to give around 60 frames a second, is it? ...
0
votes
1answer
51 views

Changing the current state of an entity in the middle of an update step or wait for the end?

Let's say that I use a behaviour component that holds a function call to be called every update step assigned to an entity. Inside that function call I'm changing the active state for the entity to ...
1
vote
1answer
291 views

Why does my Java game loop randomly jump to 62 FPS and crash?

I've been working on a Java game, but I couldn't keep it from stuttering. I did some research, and found out that I was using a bad game loop. I've been working on a new game loop, which works a ...
0
votes
1answer
727 views

Is there a way how to handle multiple SDL_PollEvent loops without clearing the event queue?

Is there a way how can I handle more SDL_PollEvent while loops for one SDL Event, without taking the events off from the event ...
0
votes
2answers
506 views

BufferedImage canvas is null

I'm sorry if this isn't the right place for this post, but I don't know where to go. I'm trying to make a simple game loop but it's already failing ...
1
vote
1answer
1k views

Game Loop delay the right way and game speed

I am a newbie game developer. I am trying to find a right way to create my game loop. Consider following example. Simple Android Game I have a game with a simple gameplay - bouncing ball. I want ...
0
votes
2answers
178 views

Do I still need limit FPS when I have a variable timestep?

Lets say I have a simple game loop (variable timestep - but it applies also for other timesteps): ...
0
votes
1answer
511 views

Where do I handle my input in a basic game loop?

I recently had the occasion to work on a game, during a game jam at my college, and it really got me into it, so I've decided to start something more polished with a friend of mine. During the game ...
0
votes
1answer
160 views

Game Loop, Deltas. What is wrong?

For my Android app this is the gameloop: ...
2
votes
1answer
272 views

How much do inconsistencies in update timing matter?

Yesterday I wrote my first game loop with fixed timesteps. It is supposed to run every 50 ms, however it runs at 50-53 ms. Does it matter? I'm guessing no, but I figured I would ask anyway. ...
1
vote
1answer
61 views
2
votes
1answer
313 views

Framerate-independent game loops and discrete tasks

When writing good framerate-independent game code, you take some sort of deltaTime parameter in your main render() function and ...
0
votes
2answers
74 views

How do I pass my objects to the update method?

I've had formal education in Java for around half a year now, and as a hobby I would like to attempt game development. I've downloaded the Slick2d library to help with this. I've run into a problem ...