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.
3
votes
1answer
70 views
How can I separate processing input and update?
I know that game loop is broken up into three distinct phases: processing inputs, update, and render, but I just can't see how I can make processing input and update independent of each other.
Let's ...
2
votes
1answer
44 views
Game loops using Hard realtime systems vs Soft realtime systems
I have read the article here about realtime systems and am looking for examples specific to game loops.
Am I correct in saying:
Hard realtime systems will lag and slow down gameplay causing slow ...
0
votes
1answer
35 views
Game Loop and Animation states/frames
I just wanna be straighforward. I read a dozen of articles talking about game loop, components, modules, structures, time control, etc...
But, in the end I'm still somewhat confused of how animation ...
1
vote
0answers
34 views
Java: Any good, complete video series / tutorials or books with Java Game Dev in mind? [closed]
So I've been through a Java intro class recently and I still have about 3 more courses related to Java in the near future. I figured I'd start to learn about writing games with it since I'll be using ...
5
votes
1answer
121 views
In JavaScript, should I write a game loop for a turn-based game?
I am using javascript and HTML5 canvas for turn-based games (e.g., checkers, mastermind, minesweeper).
Should I write a fixed-timestep game loop? What are the alternatives?
-2
votes
1answer
92 views
Why is my delta time constantly under 1 millisecond?
I have a game loop that looks like this:
while (Sync())
{
DoStuff();
}
The sync function computers my delta time like this:
bool Sync()
{
EndTime = GetTime();
DeltaTime = (EndTime - ...
0
votes
1answer
53 views
Most efficient way for nested loop to not repeat a value of parent loop in pair-wise structure (C# or Javascript) [closed]
It's hard to choose the correct title for this question, so let's see if I am able to better convey here what I am in search for. If the title is too far away, suggestions are welcome and I can edit ...
0
votes
0answers
24 views
Controlling when a Java game repaints
I've been learning how to program game loops lately and the issue I'm running into at the moment is figuring out how to repaint my window only when I tell it to. I suspect that my issue is not fully ...
0
votes
0answers
19 views
How to disable LockTexture for new level in unity?
i am building a game consist of 8 level. I use the following script to switch next level. But when i unlock a level the Lock Texture still remain in the window. I want to remove the lock texture when ...
1
vote
1answer
43 views
How should I define interaction modes in a strategic game?
I am creating a typical strategic game that gamer can select, deploy and move the game characters (Human mostly) and move or create buildings on its isometric map.
These all are going to be done by ...
1
vote
1answer
57 views
Basic game loop, what does Update() and HandleInput() mean to you?
I have been developing a game and until now I have been handling input like so:
Player presses a key
HandleInput() acknowledges a key is pressed calls a function within the Player class which ...
0
votes
2answers
49 views
A method to create and assign a name to a GameObject (Unity)
I'm trying to create a function that takes in a name of an object in the editor and assigns this accordingly as well as the name of a sprite, rigidbody, etc.
Basically what I have so far is-
...
4
votes
2answers
233 views
Could someone help me understand this game loop logic?
I'm learning Java game development and trying to dissect this game loop:
// Game loop
final int TICKS_PER_SECOND = 60;
final int SKIP_TICKS = 1000 / TICKS_PER_SECOND;
final int ...
0
votes
1answer
83 views
Implementing a modal dialog from scratch with C++
Right now I'm implementing my modal dialogs in windows with a separate message loop after popping up the dialog.
This straightforward an approach won't work with other systems that don't have message ...
4
votes
1answer
162 views
How can I show slow motion?
In my very, very simple 2D game I'm working on, I'd like there to be moments of slo-mo.
What is the best method of showing the player that the game is currently in slow-motion? As in, what is the ...
2
votes
1answer
263 views
Varying framerate (FPS) [closed]
In my game-loop, I am using fixed time step for physics and interpolation for rendering as suggested on Gaffer on Games | Fix Your Timestep!
However, when the framerate is varying between 30-60fps ...
1
vote
1answer
171 views
Laggy empty project at 60FPS
@Override
public void create() {
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
}
@Override
public void render() {
Gdx.gl.glClearColor(0, 0, 0, 1);
...
1
vote
2answers
75 views
Should input be per-frame or per-update?
I'm implementing a GUI system to look around a 2D tile-based world. At the moment, I'm updating it every time the mouse moves (which happens to be per frame, since that's when it polls for events). ...
1
vote
1answer
48 views
Playing with hashmap in drawing
I'm developing a game in Java for Android, using LibGDX.
In my render(), between the batch.begin() and batch.end() I'm running through all the game objects and draw them.
Every game object is stored ...
2
votes
1answer
33 views
Client and server loops don't match up
I'm trying to build a small networked game using WebGL and NodeJS. I have a basic client and server setup and I'm at the point where I'm trying to implement dead reckoning to simulate what happens on ...
3
votes
1answer
87 views
Does libgdx implement the game loop for you?
Initially, I assumed that the developer has to implement the game loop because libgdx is a library - not an engine. But then I found out that Graphics has getDeltaTime() and getRawDeltaTime() so I ...
1
vote
0answers
77 views
How Many Particles at a Time? [closed]
How many particles should a particle system be able to process in a single step/game loop?
I designed a system and it can run up to 5000 particles with my 2GB RAM PC (I only run the particle system ...
2
votes
1answer
108 views
A deterministic game loop
I want to make a game loop that is deterministic sort of like a physics engine but it's for game update and rendering.
I've done a lot of reading and I still was a bit confused.
I've read these ...
0
votes
2answers
385 views
How to create a Update function in Java
I have recently started using Java, but have been programming in javascript, and actionscript 3 for a while.
I am used to the language giving me the ability to simply do something like:
private ...
9
votes
3answers
901 views
UPS and FPS - What should I limit and why?
I'm currently writing a game using C++ and SDL2 and there's one thing that I'm wondering about - does it make sense to limit my frames per second (FPS) and/or my updates per second (UPS)?
I get the ...
1
vote
1answer
64 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 ...
3
votes
1answer
144 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 ...
16
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
72 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
125 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
221 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
112 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;
...
12
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
449 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
138 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
247 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
176 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
183 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
56 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
281 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
69 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
3answers
107 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
86 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
62 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
93 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
61 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
44 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
222 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
187 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
329 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 ...