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.

learn more… | top users | synonyms (1)

4
votes
2answers
72 views

Fixed timestep with interpolation & rounding draw positions: jerky animation when the character is not moving

I've implemented a deterministic, fixed timestep system from here: http://gafferongames.com/game-physics/fix-your-timestep/ Everything works fine, output is the same with each step but there's one ...
-1
votes
0answers
42 views

Game loop - cause exception

I have some problem. I am learning to program games and I want to try to program some game on my own. But I hit a snag just at beginning. I have 2 classes. The main class (call Frame) is only for ...
0
votes
0answers
28 views

Setting up game loop wait time and FPS

I have been able to set up the game loop method/function, but many objects do their stuff in separate threads. The reason for that is not ensure, that the program is not going to stop working, despite ...
0
votes
1answer
83 views

Game loop with fixed timestep gives strange result

So I've read the famous article at http://www.koonsolo.com/news/dewitters-gameloop/comment-page-2/#comments which describes different methods of implementing a game loop. I've tried to implement the ...
3
votes
0answers
89 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 (...
0
votes
1answer
39 views

Creating 3D gravity in zero-G tied to mass in unity with c#

As a total beginner, I've been working on a patch-job script for a gravity mechanic in an open space sim, I want to derive all my objects from this "Block ALPHA" object and its' set of variable ...
0
votes
1answer
27 views

Loop in coroutine stops after going halfway

I have a very weird problem with a particular loop in a coroutine: public IEnumerator DestroyCubesGameOver() { var startingCubeHolder = GameObject.FindWithTag("StartingCubeHolder"); ...
0
votes
1answer
41 views

Is Update(GameTime) called before it's finished?

Code at the beginning of Update(GameTime) is being called over and over again, and code at the end of Update(GameTime) is only being called after a delay. Is Update(GameTime) called again before it's ...
0
votes
1answer
100 views

CPU and RAM usage in OpenGL too high in Swift

My game is set up so the the display controls the game loop, usual in Cocoa. The callback function calls run() which is this. The thing is, the thread running the callback is using 63% CPU and the RAM ...
0
votes
1answer
94 views

Why is my deltaTime in my GameLoop 0?

I have a question about my code. I wrote a basic GameLoop for an Android Game and while testing it I realized the deltaTime is always 0. The code looks like this: @Override public void ...
1
vote
2answers
181 views

Game Loop design that is speed hack proof

I'm not sure if this is possible, but it's worth a shot asking. How does one design a game loop in such a way that hooking and enabling a speed hack app to the game(dx11) doesn't matter? I found this ...
2
votes
1answer
75 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: for each unit: n = compute next position if n is empty then move to n If I start the loop ...
0
votes
0answers
30 views

Do I restart the service?

I have a long running service in my game, that consists of two threads. //MY SERVICE: if(userEnabledProcessOne) //Shared preference value that I'm getting from the settings of my app based on a ...
0
votes
0answers
172 views

Game loop architecture using WPF(MVVM) and C#

Could i get some suggestions on how to implement a game loop whilst using WPF(MVVM) and C#, I am a professional developer and understand the technology well. The game loop usually contains a Init(), ...
1
vote
1answer
56 views

Repaint() in gameloop does'nt work [closed]

Recently I'm working on a PAC-MAN clone. I created 3 classes: StartingClass which extends Jframe and uses KeyListener Board which extends Jpanel Sparx which is responsible for changing the ...
0
votes
0answers
67 views

Custom game loop entirely in the Update method

I am attempting to implement a custom game loop in XNA/Monogame. I know that one can re-implement the Game class using WinForms (with the caveat of having to also redo the content manager, etc.). I ...
0
votes
1answer
91 views

Organizing Setup(), Update() and Draw() function in a game engine

I'm creating my first game engine and I want help with organizing the Setup(), Update() and Draw() functions in the correct way. Here is how my main() function looks like /* BEGIN main() Function */ ...
0
votes
1answer
79 views

How to Implement a Timer for my Prefab for Roll-a-Ball Game (C# in Unity)

I am trying to create a public float timer that senses when the particular prefab has not been there for a certain amount of time. Then, it will replace that particular object. The goal is to ...
6
votes
1answer
211 views

How to execute game logic every 100ms but render as fast as possible?

I have created a simple snake clone and would like to execute game logic every 100ms while rendering as fast as possible. How can I achieve this when the program might run with very different frame ...
0
votes
1answer
39 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 ...
3
votes
1answer
168 views

How can I separate processing input and update?

I know that game loop is broken up into three distinct phases: processing inputs, update, and render, but I just can't see how I can make processing input and update independent of each other. Let's ...
2
votes
1answer
58 views

Game loops using Hard realtime systems vs Soft realtime systems

I have read the article here about realtime systems and am looking for examples specific to game loops. Am I correct in saying: Hard realtime systems will lag and slow down gameplay causing slow ...
0
votes
1answer
74 views

Game Loop and Animation states/frames

I just wanna be straighforward. I read a dozen of articles talking about game loop, components, modules, structures, time control, etc... But, in the end I'm still somewhat confused of how animation ...
6
votes
1answer
288 views

In JavaScript, should I write a game loop for a turn-based game?

I am using javascript and HTML5 canvas for turn-based games (e.g., checkers, mastermind, minesweeper). Should I write a fixed-timestep game loop? What are the alternatives?
-2
votes
1answer
122 views

Why is my delta time constantly under 1 millisecond?

I have a game loop that looks like this: while (Sync()) { DoStuff(); } The sync function computes my delta time like this: bool Sync() { EndTime = GetTime(); DeltaTime = (EndTime - ...
0
votes
1answer
96 views

Most efficient way for nested loop to not repeat a value of parent loop in pair-wise structure (C# or Javascript) [closed]

It's hard to choose the correct title for this question, so let's see if I am able to better convey here what I am in search for. If the title is too far away, suggestions are welcome and I can edit ...
0
votes
0answers
32 views

Controlling when a Java game repaints

I've been learning how to program game loops lately and the issue I'm running into at the moment is figuring out how to repaint my window only when I tell it to. I suspect that my issue is not fully ...
0
votes
0answers
42 views

How to disable LockTexture for new level in unity?

i am building a game consist of 8 level. I use the following script to switch next level. But when i unlock a level the Lock Texture still remain in the window. I want to remove the lock texture when ...
1
vote
1answer
69 views

How should I define interaction modes in a strategic game?

I am creating a typical strategic game that gamer can select, deploy and move the game characters (Human mostly) and move or create buildings on its isometric map. These all are going to be done by ...
1
vote
1answer
72 views

Basic game loop, what does Update() and HandleInput() mean to you?

I have been developing a game and until now I have been handling input like so: Player presses a key HandleInput() acknowledges a key is pressed calls a function within the Player class which ...
0
votes
3answers
120 views

A method to create and assign a name to a GameObject (Unity)

I'm trying to create a function that takes in a name of an object in the editor and assigns this accordingly as well as the name of a sprite, rigidbody, etc. Basically what I have so far is- ...
4
votes
2answers
259 views

Could someone help me understand this game loop logic?

I'm learning Java game development and trying to dissect this game loop: // Game loop final int TICKS_PER_SECOND = 60; final int SKIP_TICKS = 1000 / TICKS_PER_SECOND; final int ...
1
vote
1answer
149 views

Implementing a modal dialog from scratch with C++

Right now I'm implementing my modal dialogs in windows with a separate message loop after popping up the dialog. This straightforward an approach won't work with other systems that don't have message ...
4
votes
1answer
192 views

How can I show slow motion?

In my very, very simple 2D game I'm working on, I'd like there to be moments of slo-mo. What is the best method of showing the player that the game is currently in slow-motion? As in, what is the ...
2
votes
1answer
340 views

Varying framerate (FPS) [closed]

In my game-loop, I am using fixed time step for physics and interpolation for rendering as suggested on Gaffer on Games | Fix Your Timestep! However, when the framerate is varying between 30-60fps ...
2
votes
2answers
333 views

Laggy empty project at 60FPS

@Override public void create() { batch = new SpriteBatch(); img = new Texture("badlogic.jpg"); } @Override public void render() { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20....
1
vote
2answers
108 views

Should input be per-frame or per-update?

I'm implementing a GUI system to look around a 2D tile-based world. At the moment, I'm updating it every time the mouse moves (which happens to be per frame, since that's when it polls for events). ...
1
vote
1answer
66 views

Playing with hashmap in drawing

I'm developing a game in Java for Android, using LibGDX. In my render(), between the batch.begin() and batch.end() I'm running through all the game objects and draw them. Every game object is stored ...
2
votes
1answer
81 views

Client and server loops don't match up

I'm trying to build a small networked game using WebGL and NodeJS. I have a basic client and server setup and I'm at the point where I'm trying to implement dead reckoning to simulate what happens on ...
3
votes
1answer
150 views

Does libgdx implement the game loop for you?

Initially, I assumed that the developer has to implement the game loop because libgdx is a library - not an engine. But then I found out that Graphics has getDeltaTime() and getRawDeltaTime() so I ...
2
votes
1answer
161 views

A deterministic game loop

I want to make a game loop that is deterministic sort of like a physics engine but it's for game update and rendering. I've done a lot of reading and I still was a bit confused. I've read these ...
0
votes
2answers
2k views

How to create a Update function in Java

I have recently started using Java, but have been programming in javascript, and actionscript 3 for a while. I am used to the language giving me the ability to simply do something like: private ...
9
votes
3answers
1k views

UPS and FPS - What should I limit and why?

I'm currently writing a game using C++ and SDL2 and there's one thing that I'm wondering about - does it make sense to limit my frames per second (FPS) and/or my updates per second (UPS)? I get the ...
1
vote
1answer
71 views

In the game loop, apply dt before the loop starts, or after it finishes?

Say I have a Game class with an update loop that receives a time increment dt by parameter. I was wondering if it's better or customary to apply this dt before the loop starts or after the loop ...
3
votes
1answer
200 views

Endless Running Game - Changing Lane Function in JAVA

I am developing a kind of vertical endless running game, where the character has 4 possible lanes to be in. I am using libGDX and want the character to change lanes by adding a horizontal velocity to ...
16
votes
2answers
3k views

Why does my sprite player move faster when I move the mouse?

I'm trying to develop a simple game made with Pygame (Python library). I have a sprite object which's the player and I move it using arrow keys. If I don't move the mouse, the sprite moves normally, ...
0
votes
1answer
81 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 tick and subdivide that for how much ...
1
vote
2answers
174 views

Questions About Game Loops

I've been reading up how to lay out a game loop that'll work optimally in both great and not so great conditions but I think I've confused a few techniques together... so I have some questions... ...
3
votes
1answer
317 views

Should UI be part of the game-loop?

I can't really find a good answer to this anywhere, I have never worked on games in a proffessional environment and I am wondering; Do these games render their UI in the main game-loop? That is, do ...
0
votes
1answer
162 views

How to use multiplication operation in game render delta time?

We are using delta time like this: private static final float SPEED = 200f; // Moving pixels in one second @Override public void render(float delta) { myObject.vx += SPEED * delta; myObject....