Questions tagged [game-loop]

The central component of any game, from a programming standpoint, is the game loop. The game loop allows the game to run smoothly regardless of a user's input or lack thereof.

The game loop is the central component of any game and it is generally split into three different pieces: initialization, update, and draw (or render).

During the initialization phase, the game is set up and the environment is prepared for the update and draw routines.

During the update phase, all of the objects and components of the game are updated based on the game's logic, user's input and the time since the last update routine.

During the draw or render phase, all of the objects and components of the game are drawn or rendered to the viewport based on the most recent update.

Once the current frame is rendered, the game loop repeats the execution of the update statements based on the new delta time and then renders again.

485 questions
-2
votes
1 answer

Use and over use of static variables

Is it recommended to use static variables where ever I am comfortable with? Because I tend to use it more often now. Is there any thing like using static variables is a bad practice or it will fill up the memory quickly? Currently I am doing small…
Yashwanth CB
  • 194
  • 1
  • 14
-2
votes
1 answer

Java creating game loop (game update)

In my 2D game, I am not sure about my FPS and my game frame update method. When I want it to print out, to check if it is working in the console, it never writes anything. Am I missing something? public class Main extends JFrame implements…
-2
votes
1 answer

How do I separate UI from rendering in C#?

I'm trying to write a game loop in C#, but I can't access the WPF objects from another thread... Basically this is what I want in my loop: Loop: Read Input Update game state Render to a buffer Send buffer to graphic card show rendered image on…
NomenNescio
  • 2,899
  • 8
  • 44
  • 82
-3
votes
1 answer

how to do a game that is simulated by a loop

how to do program a game that is simulated by a loop in which people has to repeat goes for as long as it takes to get out that it reach or pass square 80? I am doing a snake & ladder game and need to write a code that will allow this to happen
-5
votes
2 answers

c# passing variables to class

here is example of my game class (opens opentk graphics window) class Game : GameWindow { public Game() : base(320, 240, OpenTK.Graphics.GraphicsMode.Default, "OpenTK Quick Start Sample") { VSync = VSyncMode.On; …
doggy
  • 75
  • 1
  • 8
1 2 3
32
33