Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [timer]

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

0
votes
1answer
48 views

Use vsync event instead of a 16ms timer?

I found that in game development, most people set a timer that gets triggered every 16ms to do the rendering. As an Android programmer, I'm familiar with the Choreographer. You set a callback that ...
0
votes
1answer
51 views

How to spawn enemies after a certain amount of time?

I wanted to spawn different enemies(meteors) after a certain amount of time this is the script that I tried doing but it's giving me an error. I'm still just a beginner and I don't if I did something ...
0
votes
0answers
20 views

Duplicate packets and termination of packets in multiplayer game

I'm making a multiplayer game (lazertag) with real hardware. After hours of research, I'm choosing the UDP instead of the TCP protocol to exchange data. Because of how unreliable UDP is and because ...
1
vote
1answer
65 views

Unity3d Pause RigidBody object, don't stop time

Time.timeScale = 0 obviously works to stop physics but it's also stoping my Invoke calls. How can I get around this to pause ...
0
votes
1answer
91 views

Unity C#: Accurate MachineGun Firerate at lower FPS

I have long accepted that my firerate will be more or less irregular and inaccurate. Now that I'm adding sound things are getting really ugly. My methods for getting the firerate are primitive and I ...
2
votes
2answers
76 views

Timer as part of a condition

I am using a sensor as the input to my game. When a certain level of force is exerted on the sensor, for a certain amount of time, I want the next level to be reached. How would I do this? I have ...
2
votes
2answers
126 views

Time based events separate from the game loop

How can set up time elapsed based events separate from the game loop? I want the character to heal over real time rather than per cycle of the game loop. How might i do that?
0
votes
1answer
58 views

Start timer when button pressed (what is wrong with my code?)

I want a timer to start when my rocket takes off and stop when it lands. Stopping works fine (using a collider and state-switching) but I can't get the timer to start when I press the boost button. ...
1
vote
1answer
101 views

Saving total play time could be fine?

I'm making a game that needs to save total played time into file (using JSON) for comparing & resolving data conflicts between local and cloud. I will override outdated one. Currently, I'm just ...
2
votes
1answer
130 views

How to structure a game that continue even when closed?

I'm developing a Unity based game purely for fun but I'm stuck with a problem. How can I implement a system that keep my game running even when is closed? I don't want to HAVE IT running when it's ...
1
vote
1answer
241 views

Is Time.deltaTime different on various devices?

Can someone say what is wrong with my code. I have custom timer implemented like this: ...
3
votes
2answers
91 views

To implement a game object that expires, should I store the start time and total, or store the remaining time?

Example: There is a bomb (like in Counter Strike) which explodes after 45 seconds. Should I— store the 45 seconds in a variable, and decrease it by the delta time at every update, or store the time ...
1
vote
1answer
49 views

Prevent parent alarms to activate a child alarm event

I'm working on a small game using Gamemaker Studio 2 and I've noticed that my Parent o_enemy.Alarm[0] Is activating the Child ...
1
vote
1answer
176 views

Keep the timer counting after changing scenes

In my game you have 2 minutes to finish the whole game and after searching for an answer to my problem I think I should use DontDestroyOnLoad but I can't understand ...
5
votes
1answer
188 views

Precision timing in Unity3d

I am trying to implement a method which should be called each 10ms with a precision not less than 0.1ms (better 0.05ms). This method is very complex and it is generating sound samples which are placed ...
4
votes
1answer
124 views

Game time and pausing

I am writing a simple game where some things happen after some amount of time. I used simple time analog of the framework I use to schedule these events, however, I have found that I will not be able ...
1
vote
1answer
206 views

How to stop an anmation and a loop in relation to a timer? Phaser javascript

I am not ajavascript or phaser expert, I just got stuck with this problem. I'll try to explain it. In this game; is a 21 second timer in all this: which starts AFTER a beginning 3 second animatiton. ...
1
vote
2answers
216 views

Make timer for game to run for 2min

I'm trying to make a game using C++ (in Visual Studio 2015). I want to make the game run for X minutes and then end. I have a function play() that calls all other ...
1
vote
1answer
105 views

Fixed timestep updates with a variable timestep update

Many suggest that a game loop looks something like this. See: http://gameprogrammingpatterns.com/game-loop.html http://www.koonsolo.com/news/dewitters-gameloop/ https://gafferongames.com/post/...
1
vote
1answer
104 views

Accounting for drift between ticks

What are some solid techniques to account for the gap between processing time and frame update ticks? In other words, the game/render loop looks like this: Some important points: Tick timings are ...
0
votes
1answer
164 views

SDL - Limiting loop with timer? Not polling

I am using SDL/Glew to create an engine for a game I want to make. I am trying to set a constant framerate of like around 60 (once every 17ish ms). I don't know the best way to do this so I do ...
1
vote
2answers
83 views

Making quick time events in my text adventure more noticable

I'm making a post-apocalyptic text adventure in Unity. One of the gameplay features I've added is a quick time events on certain parts. Whether a part is a quick time event is defined inside the story ...
-1
votes
1answer
541 views

how to make a timer on JavaScript?

I have a JS game similar to snake how can i set a timer for the game where when the game ends it displays game over, shows the score of the player, and has a play again button?
0
votes
1answer
81 views

Implement delay using polling or threads?

I'm making a real-time risk-like game in Python. Players can move armies from one region to another. I want army movement to take time proportional to the distance between the two regions, therefore I ...
0
votes
1answer
69 views

Invulnerability timer while standing on spikes

I want to decrement the player's health every .7 seconds while the warrior is standing on a spike tile. Every frame, the game calculates what kind of tile the player is walking into. I've tried ...
3
votes
2answers
198 views

Finding average input value over time in seconds

I'd like to find the average input value from a controller over the last n seconds (say the last 0.1 seconds) and do this every frame. I can see how to do this for the past n frames by storing a list ...
1
vote
1answer
29 views

Tracking playing position into an array

I'm trying to track playing position every 500ms which i can do but i need it to populate an array which i save to a txt file as a comma delimted list or something. I have this code so far (which ...
0
votes
1answer
340 views

Function call time

I'm making a game and I want an update method to be called every 120th of a second. I've looked up timers but they start the timer after the function has returned, but I want the timer to start when ...
0
votes
1answer
249 views

Change Time.timeScale during an animation event - Unity

I have an animation. A few seconds after this animation starts I set an animation event that is correctly being triggered. This animation event calls a method where I am trying to modify ...
0
votes
1answer
81 views

How do I enable a Box Collider when a timer reaches 0?

I'm pretty new to Unity, and I am trying to enable a BoxCollider from another object when the timer reaches 0, using this code: ...
1
vote
2answers
336 views

How to set a Label position after a timer ends, in a repetitive structure?

I have this fragment of code. It moves a pawn on a board. ...
-1
votes
2answers
102 views

Power regenerate after 3 seconds?

I work on script that makes an object with a "sprite" power moves faster. Like "Dark souls". Here is my script: ...
1
vote
1answer
119 views

How to cause delay of 1 second of bullets when space pressed

I was wondering how to cause the bullets to delay since at the moment, they fire pretty much one after another. So I was wondering how to make each bullet be delayed by one second when the space bar ...
1
vote
0answers
224 views

Accuracy timer for html5 gaming (even with inactive tab) how?

I've implemented Timer class for high accuracy timing (for example for update logic/game-loop, sending ping each 15 seconds by WebRTC etc.) setTimeout/setInterval ...
4
votes
1answer
325 views

Score over time

I have the following code for adding 1 to global.score in the step event: global.score +=1; The problem is this adds the ...
2
votes
1answer
191 views

I need my timer to go up every 30 seconds

I wrote code for a jackpot to increase from one date to the next, and it works beautifully. The client wants the numbers to stay put for a while, and then increase. This is the code: ...
1
vote
1answer
2k views

GameStudio : How to remove object after delay

When you pick an item in the inventory and drop it to obj_item_ground, this item is send to the ground. That's fine. I want to add a delay to this item to destroy ...
0
votes
1answer
60 views

Delaying the game to restarts with Coroutine

I want to create some sort of delay for the game to restarts when the ball is stops moving but the game keeps restarting whenever the velocity reaches zero. I want use a timer where the game will ...
2
votes
1answer
173 views

DrawString and Render graphics after custom time

I want to draw String after some second like "Boss is incoming",and after the string is disappeared i want to draw the Boss.I have the graphics and the string so my question is how to add timer for ...
0
votes
2answers
1k views

How to kill a fired bullet sprite after certain amount of time in Phaser?

The bullet should be killed after it was shot from the player, and after a certain amount of time. ...
2
votes
2answers
3k views

I want to delay 3 sec to load next level after the collision in C#

I need to delay the load new level by a few second. Please help.This is the script I need to use: ...
0
votes
2answers
42 views

(Optimization) Efficiently discovering if a new day has been reached

I'm making an in-game clock/calendar system. In-game time is 12x real time. In addition, in-game events can fast-forward time. I also have in-game events that reset or trigger at the turn of each day. ...
2
votes
1answer
886 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 ...
1
vote
3answers
1k views

Start Countdown on Resuming Game (Unity)

I am pausing game by setting Time.timeScale to 0. And When the Game resumes Time.timeScale is set to 1f again, and game resumes. Now I want to add timer before actually resuming game. It shows 3,2,1,...
0
votes
1answer
67 views

How can I check if the player clicks (or doesn't) on a target within a time limit?

In GameMaker, I'm trying to set up something like this: The player will need to click on some object within three seconds. If they click on it within the timeframe, I'll do one thing (call ...
0
votes
0answers
447 views

C++ timer for game loop(consistency across machines)

sorry I have been searching for ages and can't seem to get a good answer that I can understand, I am trying to make a game in my universities TL engine, and I can create a timer class fine, but I'm ...
6
votes
2answers
341 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 ...
1
vote
1answer
991 views

Libgdx spawning enemies at random time

Hello I want to spawn enemies at certain location but at random time,like for example every 10 seconds. Atm I am spawning enemies whenever I click to spawn heroes but with delay, but I sure does not ...
0
votes
1answer
399 views

How to make Frame Independent Timer Clock

I want to make a frame Independent Timer that it work consistently across different computer configuration.
2
votes
1answer
241 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 ...