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)

-1
votes
0answers
35 views

Updating counters using time.delta [on hold]

Why when we want to try to make a counter up or down we use counter+=Time.deltaTime; Isn't Time.deltaTime can be a fractions of number like 0.003, that wouldn't be accurate counting.
-1
votes
0answers
24 views

Double buffering a rectangle [on hold]

It always works with images but rectangles and ovals never buffer right. I have a basic game loop in my gamepanel class that draws the player repeatedly. It doesn't remove the rectangle, just leaves a ...
0
votes
0answers
30 views

How can I add graphical objects to my gameloop [on hold]

I have a basic game loop and I will edit the thread art in the loop later. I don't use the keyevents yet but how would I add images to it from another class. Let's say I have a player class. In the ...
3
votes
3answers
131 views

Make openGL program only update every 1/60 seconds

I'm learning C++ and openGL and have this program as a result from tutorials and playing around. The problem is that the main loop is running at "full speed", making the program unnecessarily cpu ...
0
votes
0answers
33 views

How to render graphics in java [closed]

I'm using thechernoproject's code from youtube and for some reason I cant get a black rectangle to fill the screen in my render method. : package com.thecherno.rain; import java.awt.Canvas; ...
-1
votes
2answers
112 views

What happens when a character attacked in fighting game?

I went through many websites explaining fighting game systems, frames, hitboxes, but i couldn' find the answer so i ask here. Basically fighting game hitbox system works like this : 1.Player A ...
3
votes
1answer
90 views

Game loop in Javascript

I've been into javascript game programming with html5 and canvas lately. So far I've only been able to implement a game loop with setInterval, but I'm aware this means using fixed timestep. I've ...
1
vote
3answers
186 views

How can I implement a main menu?

I have been following the tutorials at http://lazyfoo.net/tutorials/SDL/index.php and although they are all very well written and I have learned more than I would have on my own, I am not sure how to ...
1
vote
1answer
136 views

Should game logic update per second or per frame?

I'm trying to wrap my head around how and when to update an entities position. My game loop updates logic at 25 FPS and renders at 50-60 (Depending on the computer hardware). So lets say I'm moving ...
3
votes
1answer
93 views

Pro's/Con's of separating game logic and render threads

Originally, I have thought that it is good practice to separate my game logic (updating) from my rendering thread. In this threading model, the rendering thread has no limitation on frame rate and ...
7
votes
3answers
1k views

Is a separate thread for game loop compulsory for simple games?

I am new to game development. In order to learn I am recreating this game on android platform. You can observe the game-play video at the above link. It is a simple game. I have read a lot of ...
1
vote
1answer
93 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
3answers
92 views

Why is my FPS computation yielding higher numbers than I expect?

I have following code: void Game::execute() { isExit = false; init(); double dt = 1.0 / 60.0; boost::timer timer; double accumulator = 0.0; boost::timer fps_timer; int ...
-2
votes
2answers
111 views

Delta times and frame lag in the game loop

Let's say we have a standard gameloop like this, in pseudocode: while (true) { dt = GetDeltaTime(); Update(dt); Render(); } Here Update(dt) either uses a true variable timestep, or it ...
5
votes
2answers
697 views

Why is my gameloop logic not being restricted to 60 per second?

Here is my gameloop (taken from http://www.koonsolo.com/news/dewitters-gameloop/) which is supposed to limit the game (logic) updates to 60 per seconds and render as fast as the device allows: long ...
0
votes
3answers
147 views

How can I avoid a busy-wait in this game loop implementation?

I've been developing a small framework for OpenGL and WinApi for some research purposes. My biggest problem right now is the game loop. Simplified I did something like this: Main thread: HANDLE ...
1
vote
0answers
96 views

iOS OpenGLES - Multithread Game loop - Render and Update

I am trying to implementing multi-threaded game loop in iOS. (Actaully, two thread - Render and Update) This is my structure. Update Loop Has logic and at the end of loop, save update state. ...
3
votes
2answers
122 views

HTML5 game fps render lag

I am currently creating a flappyBird-like HTML5 game using Proccessing.js You can see current work here: http://files.tips4design.com/flappySlothRelease/ The problem is that even though the FPS is ...
1
vote
1answer
150 views

Why game loop should be running on a separate thread?

I am struggling to fully understand the responsiveness argument suggesting to run the game loop on a separate thread other than main thread. When OS sends a user event (touch, mouse move, etc.) it ...
4
votes
1answer
80 views

Dealing with interpolation and object creation/destruction

I've implemented a game loop similar to that in Glenn Fiedler's Fix Your Timestep! article. I have an update step running at 50Hz and a render step running at 60Hz (monitor refresh rate). To keep ...
0
votes
1answer
68 views

moving first person camera with the mouse on right click

I am new to game development and I am trying to get the game input working. I have successfully got all the movement keys for walking/running/looking around working; however, I am having a terrible ...
1
vote
1answer
158 views

Game Loop: Best way to limit the fps? [duplicate]

My game-loop looks like this: public void run() { init(); final double amountOfTicks = 60.0; double ns = 1000000000.0 / amountOfTicks; long ...
2
votes
1answer
187 views

does order of updates and renders matter?

I know in a game loop there needs to be an order like physics should update before rendering. So, I have created two separate functions: update and render and the game loops like below: ...
2
votes
2answers
126 views

Physics engine deltaTime and force acceleration

I am working on a physics engine that uses basic Euler integration to compute forces. So, here is the thing: function applyForce (rigidbody, force) { rigidbody.forces.add(force); } function ...
0
votes
0answers
126 views

Server Character Movement calculation

I am creating the movement function for an 3D MMO game server. It seems that I cant no get the position calculation to match the client and was wondering the best way to do this. Let me explain. The ...
1
vote
1answer
97 views

Implement an upper FPS limit in the gameloop

I implemented my game-loop as described in deWiTTER's article, using the last approach with an unlimited FPS and a constant game-speed. My problem is, that the unlimited FPS cranks up my CPU usage to ...
1
vote
2answers
109 views

Should the game update loop compensate for slowness

I am building a game engine and considering the design for the core game loop that will drive the game. In the most basic form, the implementation looks similar to this (in pseudo-code): while ...
12
votes
2answers
1k 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 ...
1
vote
1answer
156 views

Python game loop approach?

I intend to write a game in Python and, later, if needed, offload any performance-critical sections of code to C++. I want to use Python basically because I am really familiar with the language and I ...
-1
votes
1answer
95 views

why are there draw rate and update rate in fixed time step game loop?

http://www.gameprogblog.com/generic-game-loop/ Java boolean onLoop( Game game, GameState state, GameInput input, Graphics2D gr ) { long nanosElapsed = state.tick(); updateTime += nanosElapsed; ...
0
votes
2answers
96 views

LUA - Keeping track of game state for a digital card trading game

I am building a card game. Let's say it's similar to Magic the Gathering, Hearthstone, etc. The problem I am trying to figure out is how to architect "auras" and how much damage each card takes. ...
22
votes
4answers
2k views

What is the point of “delta” in this code? Does it reflect a standard thing in game dev?

I know very little about game programming but would like to learn more. I am trying to understand the code for this game. I am trying to understand why the code is passing a "delta" to ...
0
votes
2answers
130 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 ...
1
vote
2answers
143 views

Input of mouseclick not always registered in XNA Update method

I have a problem that not all inputs of my mouse events seem to be registered. The update logic is checking a 2 dimensional array of 10x10 . It's logic for a jewel matching game. So when i switch my ...
1
vote
0answers
104 views

Delay command execution over sockets

I've been trying to fix the game loop in a real time (tick delay) MUD. I realized using Thread.Sleep would seem clunky when the user spammed commands through their choice of client (Zmud, etc) e.g. ...
4
votes
1answer
94 views

How to manage sleep/awake state of physics body

I have a loop, which updates all the physics, inside the loop I'm updating the position of the objects, first thing is the gravity, which pulls all the objects to the bottom. Now my question is, how ...
0
votes
1answer
176 views

Framerate and game loop on mobile

I'm searching how to manage game framerate on mobiles devices, here is my problem: On a computer with got something like that: void main() { while(game.isRunning()) { ...
4
votes
1answer
179 views

Game Logic Update Order

Is there a commonly-accepted general approach to the order of processing logic updates? My current 2D platformer has objects that implement different concerns, including the following: Notifiable - ...
3
votes
3answers
134 views

Should I use select() for networking in my gameloop?

I'm writing a simple networked game in C/C++. To keep things simple I'm using TCP. In my server's game loop I'm using a POSIX select() with a zero second timeout for two things: Discover incoming ...
0
votes
1answer
575 views

How to use C++11 chrono header for a clock

In first, sorry for my bad english. :) I'm making a game using SFML and C++11 new features, but I've got a problem with my custom Clock class (made to replace the SFML one). When I get the elapsed ...
1
vote
0answers
131 views

Game Loop on Server [closed]

I'm writing a simple mobile game with the following requirements: Server needs to update all active games at frequent and regular interval (i.e. I need a game loop running on a server but the update ...
0
votes
2answers
152 views

declaring variables in a render/game loop: good idea or bad?

I was just wondering how most of you like to declare your variables: for a variable you know will be used and changed frequently (i.e. every frame), do you declare those outside of the loop and simply ...
4
votes
3answers
976 views

Game loop on windows

I have seen different "basic" game loops both from books like "Introduction to 3D game programming with DX11" or online tutorial ( Rastertek ) and if we take off all the fancy stuff to control ...
2
votes
1answer
169 views

Implementing a time scale in game with fixed physics update

I'm currently putting together my game loop based on the "Fix Your Timestep" article at gafferongames.com. This is going fine, but I'm also trying to implement a 'time scale', i.e. a way to control ...
2
votes
2answers
572 views

Why do my update and draw loops throw a concurrent access exception?

I've taken up the challenge of creating a basic 2D side-scrolling monster truck game for my little brother. It seems easy enough in theory, but jumping into Java out of XNA feels strange. My game ...
1
vote
1answer
222 views

How should I invoke a physics engine?

I'm new to writing games. I'm planning to write a 2D battle game which may require an physics engine. Suppose I've written one, but how can I combine it with the main routine of my game? Should I ...
1
vote
1answer
267 views

Mixing Objective-C and C++: Game Loop Parts

I'm trying to write all of my game in C++ except for drawing and game loop timing. Those parts are going to be in Objective-C for iOS. Right now, I have ViewController handling the update cycle, but ...
1
vote
0answers
437 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
91 views

either use a for loop or iterator for the List of sprites for loop Optimization in libgdx

I am making and there I am making a frequent use of java.util.ArrayList for enemies, coins and shots. Is there any other utility in libgdx better than this from the Performance point of view. ...
0
votes
2answers
154 views

Serious gameplay issue by spawning enemies according to elapsed time

EDIT: I have changed the title as I think that this is a general gamedevelopment question but, on a technical note, I am using Cocos2d v2.0 Some time ago I had asked a question on which was the most ...