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.
2
votes
2answers
376 views
How to slow down a sprite that updates every frame?
I am going through a Allegro 5 tutorial which has a game loop.
There is also a variable "active" which determines if a key is being held down. Thus if the left key is being held down active is on and ...
0
votes
2answers
552 views
Networking Client Server Packet logic (How they communicate)
I want to know what is the logic behind server client communication through packets for a real time game.
for example the server sends x packets then the client receives x packets and processes them.. ...
-1
votes
1answer
164 views
2D Game Help In XNA
I'm making a game in XNA called The Adventure Of The Very Hairy Princess Fairy. The game is a "Sidescroller/Platformer" like mario but there is a problem. How do I attach a weapon to the player ...
0
votes
1answer
210 views
How to make this game loop deterministic
I am using the following game loop for my pacman clone:
long prevTime = System.currentTimeMillis();
while (running) {
long curTime = System.currentTimeMillis();
float ...
0
votes
1answer
143 views
Passing elapsed time to the update function from the game loop
I want to pass the time elapsed to the update() method as this would make easy to implement the animations and time related concepts.
Here's my game-loop.
public void gameLoop(){
boolean running ...
1
vote
1answer
448 views
javascript game loop and game update design
There is a main game loop in my program, which calls game update every frame. However, to make better animation and better control, there is a need to implement a function like updateEveryNFrames(n, ...
-6
votes
1answer
162 views
Making A C++ Game [closed]
I'm gonna make a game and I think C++ would be perfect for it.
I think I'm gonna use SDL and OpenGL but I need help with making the code manageable.
These were my ideas:
1. Making A DLL File With ...
2
votes
2answers
609 views
Turn-based Strategy Loop
I'm working on a strategy game. It's turn-based and card-based (think Dominion-style), done in a client, with eventual AI in the works. I've already implemented almost all of the game logic (methods ...
1
vote
1answer
197 views
random spike in delta time
The title pretty much sums it up. I'm using delta time to move my objects and every few seconds the delta time will spike and all the objects will jump forward. Should I just Interpolate the delta ...
0
votes
0answers
127 views
Kinect losing tracked players with Beta2 SDK
I'm creating a game using the Beta2 SDK for Kinect. The issue i am having is that in the middle of gameplay if another person enters the Kinects FOV it stops tracking the player and will not track ...
1
vote
2answers
206 views
what is the best way to use loops to detect events while the main loop is running?
I am making an "game" that has pathfinding using pygame. I am using Astar algo.
I have a main loop which draws the whole map. In the loop I check for events. If user press "enter" or "space", random ...
4
votes
3answers
367 views
Best practices on separating Update and Draw on game loop
I've been working on my first HTML5 prototype and I found a good model that uses the regular Update and Draw loop we see in game dev. My question is, where does one end and the other begins?
The ...
3
votes
1answer
601 views
Why is the framerate (fps) capped at 60?
ISSUE
I recently moved a project from my laptop to my desktop(machine info below). On my laptop the exact same code displays the fps(and ms/f) correctly. On my desktop it does not. What I mean by ...
1
vote
2answers
679 views
Why does my game loop speed vary on different platforms with the same hardware?
I've got a serious issue with my game loop. This loop varies in time with the platform and with the same hardware. This is a list of FPS achieved:
- Windows ======= 140 to 150
- Linux ...
2
votes
0answers
303 views
What is wrong with my game loop/mechanic? [closed]
I'm currently working on a 2d sidescrolling game prototype in HTML5 canvas.
My implementations so far include a sprite, vector, loop and ticker class/object.
Which can be viewed here: ...
0
votes
2answers
618 views
Speed, delta time and movement
player.vx = scroll_speed * dt
/* Update positions */
player.x += player.vx
player.y += player.vy
I have a delta time in miliseconds, and I was wondering how I can use it properly. I tried the ...
1
vote
3answers
482 views
Android, how important is deltaTime?
Im making a game that is getting pretty big and sometimes my thread has to skip a frame, so far I'm not using deltaTime for setting the speed of my different objects in the game because it's still not ...
2
votes
2answers
320 views
Explaining Asteroids Movement code
I'm writing an Asteroids Atari clone, and I want to figure out how the AI for the asteroids is done.
I have came across that piece of code, but I can't get what it does 100%
if ...
0
votes
2answers
323 views
how to get started with a game engine [closed]
I'm a 3rd year Computer Science student and I would like to get started with building a game engine or at least tinkering with making one. I am curious if there are any good resources to use to get ...
0
votes
2answers
164 views
Negative timeout value in Variable Timestep loop
I was working on my game loop and I came across an odd problem. The loop was working fine, my states could render, received updates, etc. I then proceeded to create my Input system, which, also works. ...
2
votes
1answer
197 views
Synchronizing input, update and rendering threads
How do you synchronise the input-handling, state-updating and rendering threads?
If a sprite position is modified due to input, the wrong position of the sprite might be drawn to the screen if the ...
1
vote
1answer
320 views
How to precisely limit fps
I am having trouble making my game's main loop to run at exactly N fps. Let's say i want game to run at constant 60 fps. Here is part of my code:
int ticksPerSecond = 60;
int skipTicks = 1000 / ...
0
votes
0answers
456 views
Best practices in Game architechture design [closed]
I have to create a game using Java. It is a simple game with a mix of rules from Texas Hold'em and Scrabble. The purpose of this project is to cover all software engineering practices. I have some ...
1
vote
1answer
395 views
User input in game loop
I am building a simple multi-player fly-around-a-3D-world game in Javascript/webGL/websocket (Chrome, Firefox mostly).
How should I handle and process user input?
My preliminary design (untested) is ...
0
votes
1answer
415 views
Java2D Game Flickering
I'm in the process of trying to get familiar with making games in Java, using the Swing library.
Coding my Snake game however, I've got to a point where the game is flickering/ghosting and I haven't ...
0
votes
1answer
229 views
Rendering Loop Problem (Java)
I'm not new to programming, but I am relatively new to game programming. I am trying to create a version of Breakout, as a good basic game to get myself introduced to 2d game programming.
I currently ...
1
vote
2answers
155 views
Benefits of implementing systems like classes instead of just functions
In an Entity System I am making, there is a central class called World, which stores all component instances. It's a dictionary-of-arrays, and entity ids are indexes for the arrays.
To access a ...
4
votes
4answers
492 views
Game loop alternatives for efficiency
Understand where I'm coming from - I've been taught that a game is implemented something like this (pseudocode):
while (!win_condition)
{
waitforinput();
updategraphics();
//etc..
}
exit();
...
6
votes
2answers
362 views
Replay system: record inputs or events?
I read this: How to design a replay system But it don't really answer my question.
My game is built with the client "view" of the game as a separate program from the server "model" and "controller". ...
4
votes
2answers
279 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 ...
2
votes
2answers
336 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 ...
1
vote
3answers
421 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
1answer
172 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
151 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 ...
1
vote
1answer
1k 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
199 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 ...
2
votes
4answers
1k 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 ...
0
votes
1answer
474 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
746 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
827 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, ...
0
votes
0answers
111 views
When updating a mesh does glBufferSubdata belong in the update function or render function?
When updating a mesh does glBufferSubdata 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 game and I ...
4
votes
2answers
236 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
219 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 ...
5
votes
1answer
396 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
489 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
330 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
241 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
645 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
1answer
163 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
435 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 ...

