# Tagged Questions

A way of measuring time intervals for the purposes of triggering an action after some elapsed time.

2k views

### How to make something happen every N seconds in game?

I want to have something happen every N seconds, how would I do that? Maybe use a timer but how?
4k views

### Java 2D game programming: Different approaches to make a game loop

I am new to Java game programming, but the more I read the more I'm confused, because I've seen several different approaches to make a game loop: 1. The standard approach, that uses the Timer class (...
1k views

### Effective methods to continuously update movement in a tower defense game?

We are four guys making a Tower Defense game as a project in first grade on a university. The game is going to be really simple! Three different towers Three different monsters One map (maybe add ...
214 views

### Good techniques for syncing gameplay actions to specific animation timings?

So I've come across an issue in the game I'm working on, but it seems to be a pretty fundamental thing that probably comes up in a lot of games. My game requires that some gameplay function occurs ...
1k views

### Game Clock Precision

I'm reading a fantastic article about game timer precision and here is a quote about 2/3 of the way into the article: If you start your game clock at about 4 billion (more precisely 2^32, or any ...
462 views

### Game resource timers - general implementation

I'm interested in understanding how resource generation timers work on many of the mmorts type games out there. I can't wrap my head exactly around how the timers are synched with servers, especially ...
1k views

### Thread runs faster on a faster processor… how to control Thread speed

I have a thread that uses TimeUnit.MILLISECONDS.sleep(5); Problem is when I load my app on a faster phone say with a snapdragon, it runs at lightning speed. Is there a way to control this speed so ...
595 views

### Checkpoints in a racing game?

The game would be a race from A to B through several checkpoints. I think there are two approaches for the concept of time. The game starts with some time and player has to make it to the finish ...
8k views

### Creating a countdown Timer in Unity

I want to create a countdown timer in a Unity game I am creating. Up until now my game was running for a specific time but I was using InvokeRepeating to end the game after the set time. But now I ...
379 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 ...
1k views

### Execute code at specific intervals, only once?

I am having an issue with XNA, where I want to execute some code in my Update method, but only at a given interval, and only once. I would like to avoid booleans to check if I've already called it ...
969 views

### Converting time of day into a smooth day/night variable?

I'm trying to make a smooth day/night cycle for a game project that I've been working on. I've already set up a clock that adds deltaTime to seconds, wraps seconds to gameMinutes, etc. The issue that ...
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 ...
2k views

### Will running cron jobs every minute a good practice?

I'm trying to create a browser-based game (made in PHP, MySQL, Js, HTML, and CSS) that is heavily dependent on user's actions being carried out after a certain amount of time passed whether online or ...
407 views

### Playing a death anim on an enemy that I want to remove

I've been trying to find a tutorial on how to best make animations in Android. I already have some animations for my enemies and my character that are controlled by rectangles and changing ...
760 views

### Game programming and quantity of timers

I've made a simple 2D game engine using C# and DirectX and it's fully functional for the demo I made to test it. I have a Timer object that uses QueryPerformanceCounter and I don't know what's the ...
173 views

### Time critical events based on framerate

Problem Description Basically, I've made a "programming game" in which I've made my own scripting language. It is a completely standard Lunar Lander game, though instead of directly controlling the ...
670 views

### Determine animation frame from interval

I have an array of sprites that are displayed in-order to make an animation. There is code in an update loop that has access to a value 'time' indicating how far along the animation is. Time is a ...
1k views

### C# Timers for game development

I want to find out the best way of creating time based events in games. Lets talk for example about Texas Holdem Poker. Server can handle thousands of tables and in every table we have timers: turn ...
584 views

### Android Java: Way to effectively pause system time while debugging?

In my project, I call nanoTime and use that to get a deltaTime which I pass to my entities and animations. However, while debugging (for example, stepping through my code), the system time on my ...
804 views

### C++/OpenGL Game - How to Make it Compatible with Screen Recorders?

I'm developing a 3D tower defense-like game in C++/OpenGL on Windows. The problem I'm having isn't about the game itself (the game runs fine), but it's about using screen recording software to record ...
479 views

### How to create a delay/timer and fire an action once it expires in C# Monogame? [duplicate]

First off I'm somewhat new to C# but I'm working on a game in C# Monogame and I'm trying to get timers working. There was a similar question answered around here a while back but I found that the ...
310 views

### Variable-step update() in game loop is falling behind, how can I get around this?

I'm working on a minimal game engine for my next game. I'm using the delta update method like shown: void update(double delta) { // Update code that uses `delta` goes here } I have a deep ...
62 views

### Can someone help me with my mario-inspired timer scoring system?

I am new to GameMaker's coding language or GML. I have learned and done a lot so far, but now i am having a problem. I have a countdown timer starting at 5 minutes counting down and I want the player ...
1k views

### android game performance regarding timers

Im new to the game-dev world and I have a tendancy to over-simplify my code, and sometimes this costs me alot fo memory. Im using a custom TimerTask that looks like this: public class Task ...
2k views

### HTML5 Canvas Game Timer

How to create good timer for HTML5 Canvas games? I am using RequestAnimationFrame( http://paulirish.com/2011/requestanimationframe-for-smart-animating/ ) But object's move too fast. Something like ...
382 views

### How to sync game tick in peer to peer game?

I am making a 2-player iphone action game using a synchronization service (in this case Firebase). The service allows state syncing through the internet, but I have to execute all game logic on the ...
5k views

### Game Timer In C++

I need to be able to find out how many milliseconds since that last update. Is there any way I can find it out with time rather then a thread that counts like I did below? #include <iostream> #...
285 views

### What are the factors that determine the default frequency of a shader call?

After i have been played for some days with various vertex and fragments shaders seems clear to me that this programs are called by the GPU at every and each rendering cycle, the problem is that I can'...
658 views

### Let a time counter working when an app is closed?

Can we let a time counter working even if an app is closed? I would like to add a timer so that we have to wait XX seconds/minutes before a building is created in a game. I don't want to use an ...
209 views

### Gameserver travel time checks

I'm making a little RPG multiplayer game where each player can travel long distances. Traveling from point A to B can take up to 10 minutes and – once initiated – is an automatic process. Now, I am ...
300 views

### For timed levels, how do you determine time steps that are less than 1/(frames per second)?

I have made a simple HTML5 racing game. The laps are timed. I am running the game are 40 frames per second, each frame represents 40 milliseconds. There for my timer will increase in 0.025 ...
121 views

### How should I implement a timer in a strategy game?

I'm developing a real strategy game for Android and want to implement timers. Those timers will represent the time remaining until some building is finished. Say that i have a building in ...
150 views

### Timestamps as ids in an entity manager?

I've built my own entity manager, as I found out some days ago, it is very similar to the Artemis framework. For now, I just use integers as entity ids. Behind the scenes, there is a simple integer ...
117 views

### Unity 5 - Time Remaining displaying in scene but not in Game

I'm currently learning game development in Unity from this course on Lynda.com. Currently I'm trying to displaying the time remaining in the game after it has been set to 5 minutes initially. When I ...
240 views

### Could the delta frame time be negative?

I'm following a tutorial about the time management and, the tutorial shows this function: double GetFrameTime() { LARGE_INTEGER currentTime; __int64 tickCount; QueryPerformanceCounter(&...
305 views

### How can I animate a recursive algorithm?

Say I have a recursive algorithm, for example one that generates a random tree: // Pseudocode, just a simple algorithm: it isn't perfect. function generate_branch(angle, length, current_depth, ...
202 views

### Reconciling external events with the game loop

Is there any way I can program (in Java or Python, but open to other solutions) some game logic based on events, timed and sent by player input, without dealing with it inside the game loop, by having ...
516 views

### Game Maker Studio - how do I disable mouse click for a duration of time?

I Have a button that starts in a rest state, and then after clicking on the button, it animates out. I want to disable the mouse click for around 30 steps after the button has been clicked, otherwise ...
814 views

### How can I create delays for sprite animations that work correctly when the application is killed and restored?

Please see my original question here: How should I use system time to compute delay times without stutters? In summary, I am attempting to to introduce a delay (say of 5 seconds or so) before a ...
519 views

### Lockstep Game Loop

I have an XNA game using a basic lockstep update loop. The client sends all commands to the server, and updates only if it has received the next turn's commands from the server. When does a turn end? ...
93 views

### synchronizing client-server actions

What's the usual way to handle events that are checked both on server and the client, like attacking? There's a cooldown timer to an attack of which the client is aware (so to prevent spamming server ...
104 views

### How to apply effects that occur (or change) over time to characters in a game?

So assume that I have a system that applies Effects to Characters like so: public class Character { private Collection<Effect> _effects; public void AddEffect (Effect e) { e....
1k views

### How to rotate to a target position over time

I know how to do rotations to vectors, but how do I rotate over time? For instance say I made a function RotateTo(vec2 iPosition, float iTime); so it rotates to iPosition over iTime - how would ...
845 views

### Will having many timers affect my game performance?

I'm making a game for android, and earlier today I was trying to add some cool stuff to my game. The problem is this thing needs like 5 timers. I build my timers like this: timer += deltaTime; if(...
408 views

### How to PRECISELY measure execution time of a code?

In order to compare algorithms speed, I measure execution time of a code part with a method similar to the one described in this question. I am not operating on Windows, but on Linux, so I use ...
292 views

### How can I compute delta time in a cross platform fashion in C++?

I need a way to get time for calculating the delta time. I see that OpenGL and GLFW have methods for it, but unfortunately I can't use them since I need to make server software too. What is the best ...
2k views

### Should I accumulate state time based on a global or a parameter?

Generally, we associate a "state time" with our sprites. Libgdx provides a method to do so: float deltaTime = Gdx.graphics.getDeltaTime(); However, in the main game loop, we have a delta time as a ...