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
31 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 ...
2
votes
1answer
28 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 ...
15
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
46 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
81 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
130 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
29 views

Smooth animation using delta times - big delays ocurring …

I'm writing a game on Android using OpenGL ES 2.0 for fun. I'm developing on Samsung Galaxy Note 3. I want to try to master smooth animation, i.e. correct frame transition and movement. I am focusing ...
0
votes
1answer
70 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; ...
11
votes
2answers
1k views

Pausing the game inside the game loop

Inside the game loop, the game is paused by pressing P, meaning that the game loop does not run anymore. Problem is that after this loop is halted, P cannot be pressed again to resume the loop, since ...
1
vote
1answer
88 views

Simple Tanks game - Client-Server communication approach doubts [closed]

I want to create simple a multiplayer 2D game with tanks ( cooperative ) in C# with .NET. I also want to keep it simple, because it is only a semester project, and unfortunately i don't have time to ...
1
vote
2answers
113 views

Movement in gameloop

I wonder what the best way is to move the player. Is it best to always check for movement like I do in the first example of is it better to only access the movement function via the input function ...
0
votes
1answer
79 views

How BufferStrategy works

I've used this piece of code a lot in my games, but I still don't know exactly how it works. // Main loop while (!done) { // Prepare for rendering the next frame // ... // Render ...
0
votes
1answer
61 views

Unity 2D: Change one instanced prefab then make all the others on the scene like it

I want to get this thing working: I have a prefab with coins, some obstacles and enemies, and i want it to be instantiated each time the player got to the right or left on the stage, to make the stage ...
1
vote
3answers
102 views

render/draw or input first?

When creating the main game loop, what order should things generally happen? IE, should i be getting input, doing logic and then rendering, or something else? does this even matter? when i was coding ...
0
votes
0answers
37 views

Directx 9 Obj Model

There's is a error with my obj load/render that I can't solve I'm a newbie in directx 9, I'm trying to do this in the best way The model is not displayed properly, do not know if this correct model ...
1
vote
1answer
63 views

How do I implement a fixed delta time step with a SDL_Delay(15ms) precision

So I am using SDL2.0 for making a Game Engine. Where I am having a problem is using SDL_Delay(). SDL_Delay's minimum delay time is 15ms, I've tried everything, and my FPS is Stuck at 64 because of ...
0
votes
1answer
50 views

What type of loop code on game engines? [duplicate]

Recently I worked on a game on Spritekit Engine. My question is not about spritekit, but generaly about game engines. When I write a loop code and run it (eg while i< 100000) my CPU usage goes to ...
2
votes
1answer
68 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.
0
votes
1answer
68 views

What is the better way to speed up gameplay as the level rises?

I started with game programming couple of weeks back. For the starters I tried to develop ZigZag (link takes you to 2 min gameplay). I am done with the logic of gameplay by now. It runs well and ...
0
votes
0answers
49 views

Game loop not functioning correctly

I'm working on a game loop in C++ using OpenGL and GLFW and it works like expected (I think), except when I'm focused in the window the FPS drops to 1fps (or 1000ms per frame) but when I'm not focused ...
0
votes
1answer
85 views

Basic Monster Movement

I'm new to game development. Specifically server side. Currently I am trying to implement movement of monsters. From point A to point B. I have used an a* pathfinding library to calculate the path to ...
-1
votes
1answer
45 views

Java game loop delta not working

Hello I have game loop where I can change framerate. But when I change framerate to other, delta time not working fine. For example when framerate is lower everything is faster. Here is game loop: ...
0
votes
0answers
36 views

Game Loop Thread for different activities

First of all, sorry for my mistakes of language. I'm a noob of game programming in Android but I'm trying to make one using canvas and bitmaps. My game have two screens, the Title Menu and the Game ...
0
votes
0answers
117 views

Scrolling background loop however produces little gaps

I have myself a parallaxing background, i'm using SFML to render my background, I have myself 3 sf::Sprites, each sprite has the width of 576, I create myself 3 sprites with x positions 0, 576 and ...
0
votes
4answers
146 views

Designing a multi-level game

I want to know to code structure of a game that has different levels to choose from on the main screen. More precisely, I want to know how does the main loop hands off the rendering to another loop ...
0
votes
1answer
181 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 ...
5
votes
4answers
304 views

How can I implement a real-time game loop in a text-based game?

I am trying to make a short text game with c++ to help me learn the language. I have made a version that basically displays texts, waits for an input, once the input is received it displays text, and ...
0
votes
0answers
125 views

Implementing a game loop with interpolation

I am trying to implement the Game Loop interpolated found in this website http://www.gameprogblog.com/generic-game-loop/. Here is my implementation: long frameRate = 50000000; int maxUpdates = 3; ...
0
votes
1answer
133 views

android game development: why is my screen black?

so, im strarting an android game from scratch, and every time I try i stumble uppon the same problem, my screen is not displaying what i want it to. I've read various tutorials but they are either ...
0
votes
0answers
109 views

Cocos2d pause game freezes the screen

I am trying to create pause screen for my game. The game is developed upon continuous scrolling background (top to bottom) with obstacles which are moving independently (left to right). Below is the ...
0
votes
2answers
119 views

Do I really need a render() method in the game loop if the view subscribes to the models?

For a game that I'm working on, we've followed the MVC paradigm. However, in classic MVC, the view subscribes to the model and when the model updates it informs the view. We've implemented this as an ...
0
votes
1answer
253 views

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

Overview Guys really hopeing 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
1answer
187 views

Capping framerate independently of logic updates in single-threaded Android Gameloop

My game is currently using the below game loop (this is an OpenGL ES 2.0 game, therefore the loop-work takes place on the rendering thread in the provided onDrawFrame method). Currently my loop ...
1
vote
1answer
52 views

Checking whether moving object has reached target position

So I have a fast-moving object in my game, let's say a bullet. At each iteration of the main loop I update the object's position based on the delta time value dt and draw it at the new position. I ...
1
vote
1answer
89 views

Using GetTickCount (to shoot missiles) [closed]

I have some difficulties to understand how to correctly use GetTickCount() as I have some problems in my little game. I have to place on a case a space ship. This one will shoot with a certain ...
1
vote
1answer
123 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 ...
0
votes
1answer
120 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 ...
-1
votes
1answer
69 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
138 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
148 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
207 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
66 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
121 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
174 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
199 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
284 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
121 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 ...
17
votes
4answers
4k 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
151 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
132 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: ...