Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
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 4688 times)
0 Members and 1 Guest are viewing this topic.
Offline ghostsoldier23

Junior Duke


Medals: 1



« Posted 2011-12-23 01: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: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #1 - Posted 2011-12-23 03: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 Duke


Medals: 1



« Reply #2 - Posted 2011-12-24 01: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: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #3 - Posted 2011-12-24 01: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 04: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 Duke


Medals: 1



« Reply #5 - Posted 2011-12-25 03: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 16: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.

 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (42 views)
2014-10-16 15:22:06

Norakomi (32 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (59 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (85 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!