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)

3
votes
3answers
960 views

Frameskipping in Android gameloop causing choppy sprites (Open GL ES 2.0)

I have written a simple 2d platform game for Android and am wondering how one deals with frame-skipping? Are there any alternatives? Let me explain further. So, my game loop allows for the ...
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
1answer
40 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
474 views

Why is my screen black?

I'm developing an android game, and my screen is not displaying what I want it to. I've read various tutorials but they are either outdated or hard to follow. I have followed this tutorial and most of ...
4
votes
2answers
75 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
43 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 ...
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....
0
votes
3answers
121 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
1k views

Events and objects being skipped in GameMaker

Update: Turns out it's not an issue with this code (or at least not entirely). Somehow the objects I use for keylogging and player automation (basic ai that plays the game) are being 'skipped' or not ...
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
84 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 ...
23
votes
2answers
6k views

Is it safe to use Sleep() in game loop (on Windows)?

Is it safe to use Sleep() function on Windows in game loop (C++)? I want to have fixed frame rate.
1
vote
2answers
595 views

Cocos2d: Moving background on update: offsett issue

working with Objective C, iOS and Cocos2d I am developing a vertical scrolling shooter game for iPhone (retina display models with 640 width x 960 height pixel resolution). My basic algorithm works ...
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 (...
1
vote
3answers
299 views

how to handle interactive choice in the middle of the game loop?

I am programming a turn-based game, 2D tile-based, overhead view. I have an update function and a render function running in separate threads. When it's the player's turn, the player can e.g. ...
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 ...
1
vote
2answers
182 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 ...
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 ...
24
votes
2answers
13k views

What is the standard C# / Windows Forms game loop?

When writing a game in C# that uses plain-old Windows Forms and some graphics API wrapper like SlimDX or OpenTK, how should the main game loop be structured? A canonical Windows Forms application has ...
3
votes
1answer
169 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
3answers
397 views

Should FPS exceed ticks/second?

I was once told that you should never re-draw a frame if the game logic has not changed since the last draw. Assuming game logic is updated once every tick, and assuming a game runs at 40 FPS @ 20 ...
0
votes
0answers
262 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 ...
1
vote
3answers
592 views

Why cap game loop delta-time?

I was reading some game's source code on Github and saw this game loop implementation for the first time: var lastTime = 0; var maxTime = 1/30; /** * @param {DOMHighResTimeStamp} curTime ...
1
vote
1answer
239 views

Delta time not accurate enough

In my game i have a delta timer based almost exactly on the page from here http://wiki.lwjgl.org/index.php?title=LWJGL_Basics_4_%28Timing%29 But if the the main loop is fast enough, my delta time ...
-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 - ...
1
vote
1answer
517 views

Multiplying by delta not giving smooth movement

I started working on my first proper game but reached a problem straight away. In short I have a game that runs most of the time at 60 fps. ( I am using Libgdx a popular Java framework) but my game ...
2
votes
4answers
713 views

Android Game-Loop (rendering & logic removed, but still 'skipping frames')

Overview Guys really hoping for some help here. My game loop is based on code from Fix Your Timestep!. I've read the article more than a few times, but I can't quite work out what exactly is ...
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
177 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(), ...
4
votes
1answer
6k views

Game Update in Libgdx

In libgdx, the game loop is the render() method. But why is that, and is there a way where I can make an update() method that is called 60 times a second? As in the update() method, I would add the ...
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
1answer
209 views

NodeJS setTimeOut - How to run callback before delay time exceeded

I'm developing a card game server. I want to do this : While server process a turn for players, players have 20 seconds to do something. If players send a request to server within 20 secs, timer will ...
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
0answers
69 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 ...
3
votes
2answers
1k views

How to implement the server-side game loop?

The server needs to handle the physics, because all the movement will be handled by it. So for that I need a game loop. The thing is that the server doesn't have the render part, it's just a console. ...
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 ...
2
votes
3answers
139 views

What is the relationship between FPS and a game loop?

What is the relationship between FPS - Frames Per Second and a game loop? I'm confused how my book is using theses terms.
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
293 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?
1
vote
1answer
70 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 ...
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 ...
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
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 ...