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
334 views

What would be the problems with using a singleton design pattern for my engine?

I'm desiging an HTML5 2D game engine in Javascript, and currently, I use the singleton pattern. There is only one global object in the namespace called simply Engine. All other objects are ...
1
vote
3answers
737 views

My rhythm game runs choppy even with high frame rate

EDIT: [SOLUTION] I posted a possibly explanation for my issue below to anyone who has a similar problem. Hope it helps. I'm coding a rhythm game and the game runs smoothly with uncapped fps. But when ...
2
votes
2answers
414 views

Is using a dedicated thread just for sending gpu commands a good idea?

The most basic game loop is like this : while(1) { update(); draw(); swapbuffers(); } This is very simple but have a problem : some drawing commands can be blocking and cpu will wait ...
2
votes
1answer
301 views

Handling various frame layouts in Android

I am trying create a Contra or the old TMNT game (but a simple one) like game for Android. For the game I decided to divide my main screen in three parts - upper for stats, mid for the game and lower ...
-2
votes
1answer
181 views

Issues with networking in my Java game, Client crashes when I try and read from the server input

A buddy and I have been programming a code game over the last 2 weeks, it is intended to be a multiplayer game with the ability to have 2 players play against each other. I am running into an issue ...
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 ...
1
vote
1answer
3k views

AS3 Calculating Delta Time In Seconds

Here is how I've been trying to implement delta time based on different internet resources. var startTime:Number = getTimer(); game.Update(deltaTime); deltaTime = Number(getTimer() - startTime) * ...
3
votes
1answer
224 views

Framerate control and physics engines?

I am reading this article on how to control the framerate and physics calculations. But in the game I am writing, I use a third party physics library and the only thing I do to update my physics is ...
3
votes
4answers
3k views

Most effective way to manage a gamestate system that is easy to use?

I just started working on my game, mostly the game management. I plan and using game-states to make the menu's and other stuff easier. My main idea for implementing the game-states is creating a game ...
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 ...
0
votes
1answer
764 views

In some games, we just let the main() loop be the Player object or Table object?

I was thinking that let's say if there is a game of Blackjack or MasterMind, then we should have a class called Dealer or ComputerPal, which is how the computer interact with us (as a dealer for ...
7
votes
2answers
1k views

Managing game state / 'what to update' within an XNA game 'screen'

I'm trying to figure out how best to manage state within my game screens - please bare with me though! At the moment I'm using a heavily modified version of the fantastic game state management example ...
6
votes
1answer
1k views

How to chain actions/animations together and delay their execution?

I'm trying to build a simple game with a number of screens - 'TitleScreen', 'LoadingScreen', 'PlayScreen', 'HighScoreScreen' - each of which has it's own draw & update logic methods, sprites, ...
4
votes
2answers
254 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
251 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
591 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 ...
-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 ...
4
votes
1answer
824 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 ...
10
votes
4answers
1k views

Using idle time in turn-based (RPG) games for updating

If you take any turn based RPG game there will be large periods of time when nothing is happening because the game is looping over 'wait_for_player_input'. Naturally it seems sensible to use this time ...
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 ...
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 ...
-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 ...
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.
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?
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 ( ...
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
626 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
337 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 ...
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 ...
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 ...
3
votes
1answer
550 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 ...
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 ...
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 ...
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 ...
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?
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 ...
15
votes
3answers
4k views

Finite state machine in C++

So, I've read a lot about using FSMs to do game state management, things like what an FSM is, and using a stack or set of states for building one. I've gone through all that. But I'm stuck at writing ...
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 ...