Tagged Questions

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)

0
votes
1answer
11 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
0answers
48 views

Random Object in Array

I am using Unity3d. I am stuck in my game. I Couldn't find the solution yet. I have created 8 different types of objects, stored in array, . i displayed them on the scene randomly in grid pattern. ...
-1
votes
1answer
39 views

How to increase player Lifes count

I am new in Unity Game Development. I am designing infinite game using C# scripting. There are many cubes in my game scene. if single cube is hit by player, He gets 100 points. if same color, two ...
0
votes
1answer
92 views

Can someone provide a practical example of decoupling game world updates from frame redraws in iOS?

Please bear with me as I've been spending some time lately trying to get a better grasp of some game dev fundamentals. My specific issue is a direct result of trying to apply what I've read about ...
0
votes
2answers
71 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. ...
1
vote
2answers
144 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
1answer
61 views

Skipping a loop in foreach? [closed]

I'm trying to get Unity to filter through a list of nodes, but I am unsure on how to do so. This is what I have derived. foreach (TileNode z in map.nodes) { int num = TileNode z; ...
1
vote
1answer
97 views

Input processing performance

I'm building a game using SDL in Linux platform. Now I want to read user input with SDL_GetKeyboardState, but my doubt is wich is the best way using a thread or a timer. I tried both and I think ...
0
votes
2answers
113 views

How to detect collision between two directed object?

I'm currently writing a game which is like Battle City game. But right now I'm facing a trouble involved to checking collision between two objects. This is the code that I wrote: ...
0
votes
0answers
69 views

Need some guidance implementing event based game loop in JavaFX card game

i tried to make the title as much informative as possible. Anyhow, i'll try to be brief - I'm fairly new to java programming and programming altogether, after learning the basics and some advanced ...
1
vote
3answers
156 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
87 views

Interpolating rotated objects

I've finally got interpolation working to 'smooth' out movement, however it doesn't seem to work for objects that are rotating (around their own center) - when I try to do this, the objects in ...
16
votes
4answers
3k views

Is there any harm in having the main game loop run uncontrolled?

I was wondering if there is any possible harm when my game loop runs as fast as the system allows? I currently have a loop, that, by measuring passed time in nanoseconds, runs the game logic and ...
5
votes
1answer
144 views

Is there a good alternative to a world state data structure?

How do you avoid one big data structure containing all the current world state ? Let's pretend we're in a real-time strategy game, how would you code a skill that decrease mana of units around it ? ...
0
votes
1answer
79 views

Trying to understand the XNA fixed time step game loop logic

I came across the blog post Understanding GameTime, and after lots of reading on fixed time steps in game loops this is the approach I would like to take. In summary, this is the logic from the post: ...
0
votes
1answer
226 views

Fixing game loop to 60fps makes animation very jittery

ns is 1000000000 / amountOfTicks; long now = System.nanoTime(); delta += (now - lastTime) / ns; lastTime = now; if (delta >= 1) { tick(glad); updates++; ...
2
votes
1answer
108 views

Best practice for organizing the physics of objects?

Apologies because this is a long post and I am inexperienced. I would really appreciate the input from some experienced developers. These are my two goals for this project: To learn the best ...
0
votes
2answers
402 views

How to change from 60FPS to 30FPS while keeping things smooth?

Here is my current game loop: final int ticksPerSecond = 60; final int skipTicks = (1000 / ticksPerSecond); float dt = 1f/ticksPerSecond; while(System.currentTimeMillis() > nextGameTick ...
0
votes
0answers
123 views

Vsync and Gameloops

I was about to publish my app but I tested it on a cheap Android tablet. It's anew tablet, but a cheap / low spec one. The game runs, but is pretty choppy. I'm made a discovery that quite surprised ...
1
vote
2answers
236 views

Where should I put my game loop?

I've seen some tutorials on programming a good game loop, but none mention where (in the game code) I should call it. My guess is I should call it from the main() method. Am I right? Is there another ...
0
votes
2answers
131 views

Updating entities in response to collisions - should this be in the collision-detection class or in the entity-updater class?

In a game I'm working on, there's a class responsible for collision detection. It's method detectCollisions(List<Entity> entities) is called from the main gameloop. The code to update the ...
0
votes
1answer
93 views

How does this game loop actually work?

I read this playfulJS post, about ray-casting: http://www.playfuljs.com/a-first-person-engine-in-265-lines/ It looks really interested, so I decided to look at his javascript. I am no expert in ...
0
votes
3answers
105 views

Separate draw and physics loops

I there a point in updating the physics at a different rate than drawing / taking input? Is it just to exploit parallelism? I've heard that many engines update the physics at 15FPS but render at ...
0
votes
2answers
149 views

How can I efficiently update only the entities that matter in a given frame?

I'm making a RTS, which can potentially have lots of units in one map (think Age of Empires). I'm looking for a way to update my units. I want to avoid calling a virtual Update() method every frame ...
0
votes
0answers
326 views

Limiting game loop to exactly 60 tics per second (Android / Java)

So I'm having terrible problems with stuttering sprites. My rendering and logic takes less than a game tic (16.6667ms) However, although my game loop runs most of the time at 60 ticks per second, it ...
2
votes
2answers
329 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 ...
4
votes
2answers
1k views

Why does my turn-based game loop allow the enemy to act repeatedly?

I'm trying to create a turn-based game in pyGame but hit a wall when trying to properly handle the main game loop. So I have something like this: def loop(self): while self.stategame==1: ...
0
votes
0answers
155 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 ...
2
votes
1answer
180 views

Running state in Behavior Trees

What happens, in a behavior tree, when a priority node chooses another branch over a running branch? Small example: Priority 1: Fight Sequence: -Enemy near? -Fight! Priority 2: ...
2
votes
0answers
138 views

Abstracting Game Logic from Game Engine [closed]

I've seen that the Quake 3 Engines uses QVMs and DLLs for the gamelogic. Unity uses some kind of Component-Entity system. My question is basicly: What's a good way to keep the engine seperated from ...
1
vote
0answers
112 views

What's the best way to set up an OpenGL draw loop in windows?

On mac os x, there's a way to pass the system a function pointer that is triggered at an ideal time to start your drawing code. These are the CVDisplayLink tools. I'd like to understand how to do ...
0
votes
1answer
121 views

Game Taking too long during render cycles [closed]

Firstly, I'm not asking anyone to read my code. It is only posted as a reference just in case you want to. I am asking for general tips on how to get my game running at higher FPS on android, for ...
4
votes
3answers
359 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 ...
-1
votes
2answers
155 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
127 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
687 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
310 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
183 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 ...
8
votes
3answers
2k 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 ...
2
votes
1answer
1k 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
103 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 ...
1
vote
3answers
461 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
738 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
395 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
188 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
564 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 ...
2
votes
1answer
218 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
96 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
215 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
255 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 ...