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)

4
votes
2answers
253 views

How do I consolidate the differences between iOS and Android update loops?

I'm currently working on moving some Android-ndk code to the iPhone. From looking at some samples it seems that the main loop is handled for you and all you've got to do is override the render ...
2
votes
3answers
250 views

What are the pros and cons of a non-fixed-interval update loop?

I am studying various approaches to implementing a game loop and I have found this article. In the article the author implements a loop which, if the processing falls behind in time, skips frame ...
6
votes
1answer
647 views

When to detect collisions in game loop

My game loop uses a fixed time step to do "physics" updates, say every 20 ms. In here I move objects. I draw frames as frequently as possible. I work out a value between 0 and 1 to represent the ...
4
votes
3answers
590 views

How do I do a game loop in c99?

I'm having trouble with how to structure a game using c99. I've seen a few tutorials on making a game loop, but they are all done with c++ and classes. My main problem seems to be moving data around ...
4
votes
5answers
361 views

Game Loop Problem - Growth and Recharge as Integer Values

I have a question about game loops. I understand that you shouldn't have a static loop, say 100ms and set something's speed to 1px/frame so it moves 10px/sec. You should have a speed and multiple that ...
2
votes
1answer
315 views

way to implement a menu -pratical

i do my first game and already read alot about design strategie, programming style, design .. and so on theoretically it works perfect but in practice i dont know if i do thinks "right" i have three ...
4
votes
1answer
823 views

Cocos2D-iPhone, how does the Game Loop work in Cocos2D?

Could anyone theoretically explain how the game loop works in Cocos2D and Objective-C? If you need me to be more specific about what I'm asking, please read on. I've got a rudimentary understanding ...
0
votes
2answers
248 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
2answers
551 views

Entity manager loop opinions

This days I'm refactoring code and one of the things I want to improve is my entity manager code. More precisely, the update funcion where entities are updated. My engine is a 2D tile based engine ...
11
votes
2answers
5k views

how should i develop my android game efficiently?

I have attached a image of a flow chart that i made in paint. The image shows how i want to develop my game. I want a game that runs great with smart coding that is easy to update and ad features ...
3
votes
1answer
238 views

How can I organize code for views efficiently?

I'm making a video game for the Android platform and I need advice on the overall set up of the activities and views in the code. I don't need actual code, psuedocode will do, but actual code always ...
-3
votes
1answer
1k views

What can be the cause of sudden lag spikes in my Android game?

My Android game has sudden lag spikes sometimes. I know this is due to something going wrong. My phone has a 1GHz processor so there shouldn't be a problem. Basically I use the Canvas class to render ...
22
votes
2answers
4k 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.
6
votes
3answers
7k views

XNA game loop Update and Draw

I'm confused on how the game's methods are called and when. So I read that the sequence is: Initialize LoadContent Update Draw UnloadContent Where 3 and 4 are the game loop, so after Update is ...
2
votes
1answer
399 views

How to wisely update body trajectories in a 3D space simulation game?

Suppose I have a Spacecraft object in 3D space, controllable by the player. I want it to update its own trajectory, so I give it a function for that (actually it might be inside a controller component ...
1
vote
2answers
714 views

Game Loop: Should resources be initialized in the game loop or in the respective classes? (both?)

For example, lets say we have an enemy class in my Android game project. I am initializing the enemy bitmap to be used with certain sprites in my game loops init. I am then calling the respective ...
6
votes
3answers
1k views

What are “frame rate” and “fps?”

Can someone give me a detailed explanation about frame rate and fps concepts?
-3
votes
1answer
385 views

Options available to a programmer on the Main Game Loop [closed]

Could someone please give me some insight into each one of the four topics listed below. I have a good idea about what passive and active rendering are, and that the use of active rendering is more ...
4
votes
2answers
275 views

How to store the state of the world for a fixed time step?

Most of the posts on fixed time steps say something like this: State previous; State current; while ( !quit ) { double newTime = time(); double frameTime = newTime - currentTime; if ( ...
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 ...
16
votes
4answers
3k views

Should actors in a game be responsible for drawing themselves?

I am very new to game development, but not to programming. I am (again) playing around with a Pong type game using JavaScript's canvas element. I have created a Paddle object which has the following ...
4
votes
3answers
441 views

Synchronise graphics and logic code

I have a procedural approach to the game loop that runs various classes. it looks like this: continue any in progress animations check for used input apply AI move things resolve events such as ...
15
votes
2answers
1k views

Where should collision detection logic be placed?

I am developing a small 2D game engine. The characters have a paint method which currently does the following: Calculate the new position of the character as per its speed, etc. Update the collision ...
0
votes
2answers
625 views

Console Text game: Vertical Scroller collision problems

Alright so i'm making a vertical side scroller where you are an '8' character traveling downward while avoiding my randomly generated walls (the "generation" function) on the left and right sides of ...
4
votes
5answers
612 views

Flash Game not working on Android

I am not sure if I will be able to provide enough information for someone to answer this question, but any ideas might help. I am creating a tower defense game in Flash and I eventually want to make ...
-1
votes
3answers
2k views

C++ GameState management

I have been attempting to make a game engine in C++ and have come across the dilemma of game state management. I have done a lot of research and found numerous ways of accomplishing from game engine ...
5
votes
2answers
336 views

Draw and update order in 3d graphics

In all of the code samples that I have looked at, the game loop looks something like this: while(true) { InputAndUpdate(); Draw(); SwapBuffers(); } However doesn't this destroy ...
4
votes
4answers
1k views

C++ Game engine time scale

i have begun creating a very simple game engine and i am trying to work out how to create a time scale for the game.by time scale i mean some way of increasing and decreasing the speed of the game(not ...
11
votes
2answers
4k views

Semi-fixed or Fully-fixed timestep?

I am making an iphone shmup and am trying to decide what type of game loop to use. I want to use either semi-fixed timestep or fully-fixed timestep. With semi-fixed timestep I will make zero or more ...
3
votes
1answer
547 views

How to handle input from user

I am making an iphone opengl es 1.0 game. I am using a fixed timestep with interpolation on the end. One thread only. I am using CADisplayLink to fire the game loop. First question: is it okay to use ...
4
votes
2answers
217 views

JS: Should I have an upper limit to the number of update cycles per sec?

I'm making a javascript game engine for fun and one thing I noticed was that my laptop runs super hot with the simplest game mechanics and that my game is doing about 600 updates per second. The ...
1
vote
2answers
786 views

Flash Custom Events

I am working on a Flash Tower Defense game. I have a main game loop which is an eventListener for each frame. Whenever you gain money or lose a life, I want the GameUI to be updated to display this ...
1
vote
1answer
2k views

C++ OpenGL Game Timer [duplicate]

Possible Duplicate: Tips for writing the main game loop? I am attempting to make a game using OpenGL and C++ but i haven't been able to find any good tutorials..or anything that could ...
12
votes
4answers
2k views

Programming the combat sequence in a role playing game

I'm trying to write a short "game" where a player goes around and fights monsters but I have no idea how to handle the combat. For example, say I have a "Warrior" and a "Troll". How do the two fight ...
4
votes
1answer
706 views

XNA GameTime before first Update

Using XNA, is it possible to access the GameTime object before Update is called for the first time? Can it be used in the game constructor, Initialize or LoadContent methods?
7
votes
2answers
2k views

Multi threaded game - updating, rendering, and how to split them

From the StackOverflow post (it was recommended I move this): So, I'm working on a game engine, and I've made pretty good progress. However, my engine is single-threaded, and the advantages of ...
2
votes
1answer
542 views

Do game programming just let all the objects in the program to interact with themselves and what about preventing infinite loop?

Does game programming use the method of 1) using time as the main controller to let objects interact with each other, so each step, let 1 object send messages to N objects, and the second object to ...
5
votes
2answers
1k views

Correct order of operations in a platformer game loop

I've run into an issue with my Mega Man engine, and the structure of my game loop is making it very difficult to fix. With Rush Jet, or any falling platform, Mega Man needs to stay attached to the ...
4
votes
2answers
4k views

Constant game speed independent of variable FPS in OpenGL with GLUT?

I've been reading Koen Witters detailed article about different game loop solutions but I'm having some problems implementing the last one with GLUT, which is the recommended one. After reading a ...
0
votes
8answers
853 views

Games development with a game loop that's abstracted away [closed]

Most game development happens with a main game loop. Are there any good articles/blog posts/discussions about games without a game loop? I imagine they'd mostly be web games, but I'd be interested ...
3
votes
1answer
220 views

iPhone 3GS - can't ever seem to hold 60fps with CADisplayLink

So I've switched from NSTimer to CADisplayLink and I'm still seeing unexpected variation in my frame counter - it fluctuates between 59-60fps, even when I'm not rendering much. Has anyone else seen ...
1
vote
1answer
583 views

Tetris Movement - Implementation

I'm developing a Tetris clone and working on the input at the moment. When I was prototyping, movement was triggered by releasing a directional key. However, in most Tetris games I've played the ...
19
votes
2answers
13k views

A good way to build a game loop in OpenGL

I'm currently beginning to learn OpenGL at school, and I've started making a simple game the other day (on my own, not for school). I'm using freeglut, and am building it in C, so for my game loop I ...
15
votes
5answers
954 views

Game actions that take multiple frames to complete

I've never really done much game programming before, pretty straightforward question. Imagine I'm building a Tetris game, with the main loop looking something like this. for every frame handle ...
4
votes
4answers
1k views

Creating the concept of Time

So I've reached the point in my exploration of gaming where I'd like to impliment the concept of time into my little demo I've been building. What are some common methodologies for creating the ...
12
votes
2answers
2k views

“Optimal” game loop for 2D side-scroller

Is it possible to describe an "optimal" (in terms of performance) layout for a 2D side-scroller's game loop? In this context the "game loop" takes user input, updates the states of game objects and ...
4
votes
4answers
19k views

Android game scrolling background

I'm just trying to figure out the best approach for running a scolling background on an android device. The method I have so far.... its pretty laggy. I use threads, which I believe is not the best ...
3
votes
2answers
474 views

WinAPI window taking 50% of CPU when idle

I'm currently working on a game that creates a window using WindowsAPI. However, at the moment the process is taking up 50% of my CPU. All I am doing is creating the window and looping using the ...
4
votes
3answers
686 views

What technology would you use to communicate between an iOS game and a Lua-based AI server?

What technology would you use to communicate between a two-player,turn-based, board game (like checkers or Othello) running native on iOS, and a remote game server The remote game server is just the ...
5
votes
2answers
467 views

Physics in my game confused after restructuring the Game loop

I'm on my way with making a game in Java. Now I have some trouble with an interpolation based game loop in my calculations. Before I used that system the calculation of a falling object was like ...