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
vote
1answer
169 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
130 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 ...
0
votes
1answer
243 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()) { ...
1
vote
1answer
136 views

When updating a mesh, does glBufferSubdata belong in the update or render function?

When updating a mesh does the glBufferSubdata call belong in the update function or render function? I'm trying to organize my game appropriately and knowing this would help me. This is my first ...
1
vote
1answer
187 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
130 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; ...
1
vote
2answers
130 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. ...
4
votes
1answer
114 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 ...
23
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 ...
3
votes
2answers
941 views

HTML5/JS - Choppy Game Loop

I have been experimenting with HTML5/JS, trying to create a simple game when I hit a wall. My choice of game loop is too choppy to be actually of any use in a game. I'm trying for a fixed time step ...
1
vote
2answers
160 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
139 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. ...
0
votes
1answer
441 views

Am I doing this node.js game loop wrong?

I have 2 arrays of JSON objects, actions and game objects. At any time a user can make a request from the client which can add an action to the actions array. I have a setInterval(function(){ }, ...
0
votes
1answer
971 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 ...
4
votes
1answer
193 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
138 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 ...
2
votes
1answer
3k views

Android: Improving surfaceView?

I'm using Surfaceview in my Android app. I have two threads, one for UI and another for rendering and updading the UI. I am limiting my frames per second to 30 fps and have employed frame-skipping ...
28
votes
3answers
2k views

Several classes need to access the same data, where should the data be declared?

I have a basic 2D tower defense game in C++. Each map is a separate class which inherits from GameState. The map delegates the logic and drawing code to each object in the game and sets data such as ...
1
vote
1answer
290 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
139 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
162 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
1k 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
194 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 ...
0
votes
2answers
246 views

Effort of impementing interpolation in networked Asteroids

Questions: When we draw with interpolation, where should the collision detection code be? Is it worth implementing interpolation in the following situation? This is for Scrolling Asteroids. I have my ...
1
vote
1answer
257 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 ...
0
votes
2answers
391 views

Why does this game loop stop my process from responding?

I implemented a fixed time step loop for my C# game. All it does at the moment is make a square bounce around the screen. The problem I'm having is that when I execute the program, I can't close it ...
1
vote
0answers
491 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
95 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. ...
8
votes
2answers
2k views

Java 2D game programming: Different approaches to make a game loop

I am new to Java game programming, but the more I read the more I'm confused, because I've seen several different approaches to make a game loop: 1. The standard approach, that uses the Timer class ...
0
votes
2answers
499 views

Android Loop : Draw Loop : How to pull off smooth FPS?

I am writing 2D side scrolling bullet hell-like game. I am at a point where I struggle to pull off smooth fps. I have separated loop that manages drawing. However I want update the position of ...
0
votes
2answers
166 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 ...
1
vote
1answer
116 views

Picking game entities

What is the preferred methods for doing so, performance-wise? For example I want to pick certain objects in an area around a given point. What I have thought off so far is using invisible objects as ...
1
vote
2answers
182 views

Game loop delta, factoring execution time?

Was thinking this morning, I 99.9% of the time, only see a main game loop, looking like this, just as much so where the delta is passed into update(): while running getDeltaTime() ... f(deltatime) ...
-2
votes
1answer
218 views

How to add difficulty levels to a Guess The Number game using rand()? [closed]

User guesses a random number (between 1 and 100 or 5000 and 25,000 depending on difficulty) that the computer picks. User selects difficulty from list, difficulty (1, 2, 3, 4) is assigned to int ...
0
votes
1answer
162 views

Removing drawn Allegro texts and primitives

I'm working on a game with Allegro 5 that has a loop. I'd like to make the program write onto the screen, how much time the loop has ended. These are the rounds of a turn-based game, obviously. I use ...
1
vote
0answers
90 views

Accessing variables from non-neighbouring classes specifically in game development (Android) [closed]

Edit Using direct access while breaking the law of demeter looks like this: res.sprite.drawQuad(res.sprite.xScreen,res.sprite.yScreen, mMVPMatrix); Using proxy methods / getters / setter looks ...
6
votes
1answer
661 views

Android game loop's effect on cpu/battery usage - unexpected results

I will try to keep this question as concise and as readable as I can. I recently came across an odd problem with my Android game that I'm developing. It's an openGL ES 2.0 game and initially I was ...
-1
votes
1answer
186 views

Get distance between the edge of screen and a moving sprite

How to get the distance between the edge of the screen and a vector moving sprite? I want to get the distance between my moving sprite and the edge of the screen so that when my sprite touches the ...
0
votes
6answers
883 views

Avoiding constant IF checks for loops

As an example, I have 3 different loops that are executed in certain conditions. I want to know if there's any way short of something like this: if(day) x++; else if(night) y++; else z++; ...
2
votes
2answers
548 views

Why are my game ticks longer than expected?

I was working on my game, adding stuff to it, when I noticed my ticks were in the low 50's when I had set it to do a constant 60. This is my run method. public void run() { init(); long ...
2
votes
2answers
245 views

Correct utilisation of gameloop (Android)

When using a gameloop like (much simplified)............ updateLogic(); render(); How does one perform 'single' operations? I mean, things like triggering sounds (which will only be played once), ...
-2
votes
1answer
95 views

how to restart in java japplet? [closed]

how to restart a game? problem with my code is that when it restarts it double the enemy. so there are 10 enemies and lets say player dies than user restart and now there are 20 enemies and so on..... ...
1
vote
1answer
330 views

Gamemaker Loop Question

How often do loops repeat in game maker? Is it every step, or as fast as it can handle? I need it to loop every step, is it possible to do that? I'm talking about in code, I have a do until loop. Just ...
2
votes
2answers
332 views

Lockstep Game Loop

I have an XNA game using a basic lockstep update loop. The client sends all commands to the server, and updates only if it has received the next turn's commands from the server. When does a turn end? ...
7
votes
4answers
593 views

Simultaneous game states

I think I understand the basic idea behind a Finite State Machine-based game loop. But I'm trying to write a little game in which the same object can simultaneously be in multiple, independent states. ...
-1
votes
1answer
134 views

simple win32 window wont show [closed]

The program compiles and runs successfully but does not show a window, it simply ends immediately. #include <Windows.h> LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, ...
3
votes
2answers
225 views

Behavior Tree Iteration Rate

How is a Behavior Tree iterated in a game? For example, let's assume you have an extremely large Behavior Tree with about a hundred Actions/Conditions. If we were to run one action or condition ...
1
vote
3answers
436 views

Whats an elegant implementation for 2D collision detection in a block based game?

to make things clear, i do not want to know HOW to implement collision detection mathematically. What i am looking for is an elegant way to check for collisions without having to manage seperate lists ...
4
votes
1answer
3k views

The most efficient and accurate game loop?

Obviously for a game to work you need a game loop... Normally, my game loop would consist of something like this: while(running){ update(); render(); Thread.sleep(10); } This seemed to ...
-6
votes
1answer
176 views

Generic Class Name for RTS [closed]

Hopefully this will be a nice easy question :- I am building an RTS as a way of learning OOP techniques. Currently the code has the following classes Class MustInherit GameUnit Class MustInherit ...