Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Ticks vs. FPS  (Read 3126 times)
0 Members and 1 Guest are viewing this topic.
Offline ghostsoldier23

Junior Member


Medals: 1



« Posted 2011-12-23 02:53:20 »

I've heard of the concept of using ticks and FPS in animation.  I assumed "ticking" is updating the game logic where as FPS is, obviously, the frames rendered per seconds.  So FPS measures the frames rendered per second and TPS is ticks per second.

I tried implementing this into my indev game, but it seems that making the tick count be lower than the FPS (which theoretically it should be), hurts performance (i.e. flashing/not rendering correctly).

Is this what ticks are supposed to be used for?  Are they even necessary?  Or should I just be updating game logic with each frame render?
Offline ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #1 - Posted 2011-12-23 04:43:43 »

Logic should be kept at a steady pace while rendering can be either set at the same pace as the logic or let loose.

Offline ghostsoldier23

Junior Member


Medals: 1



« Reply #2 - Posted 2011-12-24 02:48:33 »

Ok.  So its ok to have 120 "ticks" (logic updates) per second at 300 fps (renders) per second?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #3 - Posted 2011-12-24 02:51:41 »

Yep that's fine.

EDIT: by the way, you said "second" twice: 300 fps (frames per second) per second Grin

Offline lhkbob

JGO Knight


Medals: 32



« Reply #4 - Posted 2011-12-24 05:21:23 »

Usually when you separate logic ticks from rendering, you don't just render more frames if you can.  If you don't do anything extra, those additional frames should render the exact same images so the player can't notice and they will perceive updates at the logic rate.

However, you can interpolate between logic and rendering so you can do logic updates at 30 times/second and render at 60 times/second.  Every other rendered frame is a blend between the previous logic state and the one just computed.  This works well with physics that needs to be computed at a fixed time interval.

Alternatively, separating the logic and the frames gives you the benefit of dropping rendered frames when it's impossible to render as fast as the logic requires.  If you can't get 60 updates/second with 60 fps, you can render at 45 but still update at 60.  This can produce a better experience for a player, especially in a multiplayer setting where everyone needs to update the game state at the same rate, or in physics where you need the simulation to step at realtime.  You can't just update physics with larger time deltas or the error in the simulation increases. 

Dropping frames allows you to increase the time delta between visual updates while maintaining a more consistent physics/ai update rate.

Offline ghostsoldier23

Junior Member


Medals: 1



« Reply #5 - Posted 2011-12-25 04:08:54 »

Yep that's fine.

EDIT: by the way, you said "second" twice: 300 fps (frames per second) per second Grin

Oops  Grin

Nice catch.
Offline MunchGamer

Senior Newbie


Medals: 1



« Reply #6 - Posted 2012-02-06 17:55:11 »

I found this tutorial really useful for separating the idea of updates/ticks from frames: http://www.java-gaming.org/topics/game-loops/24220/view.html

I'm currently running a variable timestep loop in my implementation (seemed preferable to having a 1 frame latency via fixed timestep interpolation)
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (117 views)
2013-05-17 21:29:12

alaslipknot (124 views)
2013-05-16 21:24:48

gouessej (153 views)
2013-05-16 00:53:38

gouessej (146 views)
2013-05-16 00:17:58

theagentd (160 views)
2013-05-15 15:01:13

theagentd (145 views)
2013-05-15 15:00:54

StreetDoggy (189 views)
2013-05-14 15:56:26

kutucuk (213 views)
2013-05-12 17:10:36

kutucuk (212 views)
2013-05-12 15:36:09

UnluckyDevil (216 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.078 seconds with 20 queries.