The timing tag has no usage guidance.
0
votes
1answer
25 views
Timing in holding LWJGL keyboard event
I'm using LWJGL to develop a 3d game.
I have a trouble with my keyboard handler. My aim is to implement the function which is holding the space-key then release to trigger for increasing the velocity ...
0
votes
2answers
68 views
How long should a user's input be delayed?
For browsing the web, the UX site has a great answer.
My question is about games, not forms.
How long from the time a button is pressed, should the player's character react?
On the one hand, ...
1
vote
2answers
143 views
Game Loop getting 58-62 FPS. Why not exactly 60FPS? (SDL/C++/OSX)
Here's my game loop:
uint64 target_fps = 60;
uint64 ticks_per_s = SDL_GetPerformanceFrequency();
uint64 target_ticks_per_f = ticks_per_s/target_fps - (ticks_per_s/1000); //aim for (target - ...
0
votes
2answers
47 views
Timing while calling update more than once per frame
TL;DR: Using a timestep method that calls update() multiple times per frame. After an event happens, need to add a wait time before it can happen again. What's the best way to do this so the wait ...
0
votes
1answer
81 views
How to make async step timing (game loop) using Box2D and C++
I'm making a game in C++ using Box2D and WebSocket++. The world needs to updated every 1/60 second. Meanwhile the WebSocket server handles players. How I should make the interval? I know there's no ...
3
votes
1answer
121 views
Player motion and combo systems
Where do you usually implement player motion when going through the state machine of a combo system?
An example, when player presses X+Y it must do an uppercut like movement (Like street fighter) ...
0
votes
2answers
56 views
Object shrinks at same rate no matter what
I am using the following code to shrink a sprite:
public bool shrinking = false;
public float targetScale = 0.1f;
public float shrinkSpeed = 0.1f;
void Update () {
if(shrinking) {
...
6
votes
2answers
222 views
Is it safe to base a combo system in frames instead of time?
I'm building a prototype for a fighting game (not vs, something like Final Fight). I'm trying to define the data for the player combo tree and had a look around looking for inspiration and have seen ...
0
votes
1answer
30 views
Slaving OpenSceneGraph to an external time base?
I'm working on an OpenSceneGraph animation, and I want events in the animation to be synchronized to a time reference provided by my audio player (BASS or FMod). Yes, this is a demo :) . Which time ...
1
vote
1answer
292 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 ...
3
votes
1answer
61 views
Timers and performance for mobile JS
I'm using the Three.js JavaScript library to do some things in WebGL, and I wonder how the graphic aspects of timers are done on mobile.
I was creating numbers with geometries and just replacing them ...
6
votes
1answer
138 views
How do I set an object's speed to arrive in X seconds?
I want to move an object to a point in the game world, I have the distance value which is far the player should move. I want to complete the movement in X seconds.
I have tried many equations and ...
-2
votes
1answer
131 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 computes my delta time like this:
bool Sync()
{
EndTime = GetTime();
DeltaTime = (EndTime - ...
4
votes
1answer
2k views
In Unity, why do my animator states wait until the end of each animation to change?
I'm trying to make a simple idle-walk transition in Animator using Unity.
I've set a script that changes the Speed value from the Animator, and it works perfectly when I move the character forward ...
0
votes
1answer
667 views
Set Non-Looping Animation Time to Seconds
I have an animation that does not loop. It plays for the default duration (n seconds), then stops on the last frame. This is exactly what I want to have happen, but I want it to play for m seconds, ...
0
votes
2answers
732 views
Accurately measure time between calls to onDrawFrame (Android OpelGL ES 2.0)
I'm trying to sort out some timing issues within my gameloop and I've seen something that I don't understand.
The Nexus 10 is supposed to have (as far as I'm aware) a VSync on 60Hz. So that would be ...
1
vote
1answer
486 views
Firing bullets with a time interval between them [duplicate]
How can I make my enemies shoot bullets in intervals?
I already have the enemy shooting bullets, however my problem is that it shoots the next bullet instantly, making it look like a line instead of ...
1
vote
3answers
646 views
Why cap game loop delta-time?
I was reading some game's source code on Github and saw this game loop implementation for the first time:
var lastTime = 0;
var maxTime = 1/30;
/**
* @param {DOMHighResTimeStamp} curTime ...
1
vote
2answers
122 views
How do I implement time scaling?
I want to be able to change the game speed, to speed up or slow down all animations and gameplay. Ideally, this could also be set to a negative number to make everything go backwards.
I tried this:
...
1
vote
1answer
330 views
Timing in fighting game using animations time?
I am developing a 2D fighting game in C++. I have made the basic components such as moving, guarding and even a combo system that works perfectly well.
My main concern now is that I want the game to ...
3
votes
1answer
73 views
Giving one controler button two functions
I'm currently working on a game that allows the player to do some different actions.
Dodge (X button)
Attack (A button)
Use Item (Y Button)
Block (BButton)
I would like to be able to use the "Y" ...
0
votes
2answers
733 views
Creating A TickRate Class
I need to implement tickrate into my engine to handle timed events such as pushing out entity updates and I don't know where to start.
I have access to a timer which allows me get the time in ...
0
votes
1answer
1k views
C++ timer function acts as if time limit is instantly reached if it is less than 1 second [closed]
I'm trying to make a Snake clone with C++ and OpenGL/GLUT, but I've been having trouble with programming the timed input. I made a timer class, as you'll see below, to be used for the short time ...
0
votes
1answer
119 views
How should I detect collisions with objects on a “timeline”?
I'd like to replicate this game's mechanic of the player smashing walls with a precise timing to a background rhythm.
How should I check when each wall should be broken? Does the player animation use ...
4
votes
3answers
154 views
Approaches to timed puzzle elements
I'm working on a side scrolling game that has a number of timed puzzle elements. As a simple example: I have a number of moving platforms that have been setup to transition in a pattern. Ideally I'd ...
1
vote
1answer
125 views
How do I temporarily pause an XNA game?
Collision with an enemy should pause the game for 1.5 seconds.
My failed attempt:
bool tPause;
float timer;
public ovveride Update(GameTime gameTime) {
if(!tPause) {
// ...
if(...
1
vote
3answers
2k views
Delta times and frame lag in the game loop
Let's say we have a standard gameloop like this, in pseudocode:
while (true) {
dt = GetDeltaTime();
Update(dt);
Render();
}
Here Update(dt) either uses a true variable timestep, or it ...
2
votes
2answers
920 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 ...
0
votes
2answers
2k views
Using System Time to compute delay times that correctly deal with app pauses?
In my Android app I have the requirement to introduce small (for slowing down animation) and larger delays (for the purpose of delaying the appearance of a character for example).
I've experimented ...
0
votes
1answer
299 views
Timing Calculations for Opengl ES 2.0 draw calls
I am drawing a cube in OpenGL ES 2.0 in Linux.
I am calculating the time taken for each frame using below function
#define NANO 1000000000
#define NANO_TO_MICRO(x) ((x)/1000)
uint64_t getTick()
{
...
3
votes
1answer
12k views
How do I make a game tick method?
I've seen in some other simple 2D games that a "tick" method is used to sync game logic and graphics rendering. My main reason for using this is due to my collision detection malfunctioning, since ...
1
vote
2answers
217 views
Game loop delta, factoring execution time?
Was thinking this morning, I 99.9% of the time, only see a main game loop, looking like this, just as much so where the delta is passed into update():
while running
getDeltaTime()
...
f(deltatime)
---...
2
votes
4answers
596 views
Timing - use individual timer for every task or global timer?
I'm writing a game, where a player controls a spaceship.
It regenerates energy over time. So I need to make a little timer that adds certain amount of energy to the pool per second.
My enemies also ...
11
votes
2answers
843 views
Ghost replay - storage and timing
I am working on a car race game and just implemented a ghost sprite for replaying past races.
I use a physics engine and after much reading I came to the conclusion that the best way to store the ...
2
votes
2answers
4k views
Frame timing for GLFW versus GLUT
I need a library which ensures me that the timing between frames are more constant as possible during an experiment of visual psychophics.
This is usually done synchronizing the refresh rate of the ...
3
votes
3answers
2k views
using std::chrono::steady_clock for timing
I was wondering if it would be a good idea to use the steady_clock class (in the C++ std libraries) for game timing.
What are the pros/cons of using it as opposed to using a game library's timing ...
2
votes
2answers
2k 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 ...
1
vote
1answer
754 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
3answers
173 views
Shooting intervals with variable framerates
lets say i have a gun which fires at a rate of 10 shots every seconds.
so i every gameloop frame, i check if the necessary time has passed and instantiate a new shot.
now what if the framerate of ...
6
votes
1answer
945 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
1answer
328 views
ID3D Query Where should I put them?
I'm currently trying to time different parts of my rendering to see how long it takes. I've got the queries working and I'm getting some results.
My question is where should I actually start and end ...
1
vote
1answer
326 views
Stuck at enemy movement
I am making a TD game in unity, Initially I made all of my enemy movements frame rate dependent say:
I had a grid point1 at -22.65 and other at -21.1, diagrammatically:
(-22.65) _________(-21.1)...
1
vote
1answer
167 views
How can I throttle certain player actions?
Background
I have a variable time step, component based game, with components that collectively hold an entity's properties and different systems that act on entities with certain required components....
13
votes
3answers
5k views
How can I implement a “fast-forward” feature in my game?
How can I implement the fast forward feature for my tower defense game like in http://fieldrunners.com/ and other TD games?
I am using Unity 3D. Would there be something to manage fewer frames per ...
15
votes
5answers
851 views
How to tie a bullet release with a firing animation
Lets say you have an animation that you want to happen when firing a bullet. How would you get the bullet to show up at the end of the animation. The only thing I can figure out is to know the time ...
6
votes
2answers
596 views
Is it possible to have concurrent collision detection where every entity acts at exactly the same time?
There are many algorithms that can be used for collision detection. In many cases we check for an overlap in coordinates of an entity.
If we make a triangle a,b and c. We have 2 entities at a and b ...
4
votes
2answers
287 views
How to store the state of the world for a fixed time step?
Most of the posts on fixed time steps say something like this:
State previous;
State current;
while ( !quit )
{
double newTime = time();
double frameTime = newTime - currentTime;
if ( ...
3
votes
2answers
311 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 ...
1
vote
1answer
344 views
What time to display in text messages in multiplayer game?
Say I'm having a multiplayer RTS game. There's a main server for each individual game and several clients connected to it. All packets are sent to server first and then server retransmits them back to ...
5
votes
2answers
1k views
Splitting a tetris game apart - where to put time-management?
I am creating a tetris game in C++ & SDL, and I'm trying to do it "good" by making it object-oriented and keeping scopes small. So far I have the following structure:
A main with some lowlevel ...