12
\$\begingroup\$

Ok so this is a very beginner level question but I need to know this, what does the term "tick" refer to in the context of game development? Is it the same thing as FPS? Thanks!

\$\endgroup\$
  • 1
    \$\begingroup\$ Where did you get this terminology from BTW? Some people just call it tick because physics engine update frame is too long for casual players to remember/understand. \$\endgroup\$ – Bálint Sep 28 '16 at 7:52
18
\$\begingroup\$

A tick is a unit of measure for time, specifically it is refers to a single instance of a repeated action (usually a broad action) in a game, or the period of time that action consumes.

Ticks are repeated and (mostly) regular; the term comes from one of the sounds a clock makes ("tick" and "tock").

Typically a tick is an iteration of some loop, such as the main game logic loop. One can say, for example, that the game logic "ticks" once a frame, or that "during the tick, the character positions are updated."

However it can also refer to more granular periods; one can say that "the AI tick in the game is limited to 5ms of processing time."

FPS is a measure of how many frames (usually render frames) a game processes in a second. Ticks and FPS are not necessarily related, however sometimes people will call a single execution of the game logic loop a "logic frame," in which case the (logic) FPS rate would be the number of ticks processed per second. This is particularly common for games that enforce fixed frame rates for game logic or physics for whatever reason.

\$\endgroup\$
2
\$\begingroup\$

Most games are implemented in a loop. Something like

def main
 setup(a, bunch, of, stuff)
 load(a, bunch, of, stuff)
 while true do {
   // <- A tick starts here
   read(a, bunch, of, inputs)
   call(a, bunch, of, stuff)
   do(a, bunch, of, stuff)
   update(a, bunch, of, stuff)
   // <- A tick ends here
 }
 clean(a, bunch, of, stuff)
 save(a, bunch, of, stuff)
end

It's a pretty standard way of doing things, and while rendering and UI elements may be handled in a separate thread, the actual game logic (press w move your ship forward), happens inside this tick.

This is also called a "frame" and is usually refereed to as a Frame rate (not to be confused with the graphics stuff). Tick has become a popular synonym to help differentiate the two.

As a programmer your goal is to have a constant, stable frame (tick) rate no matter what. This keeps the responses in your game smooth and rational, while at the same time allowing a model (programming not graphics) to process things in a computer friendly fashion. Tick times are not constant across games and there is no magic number. Some games are 100 Frames per second, others are 1 tick every 3 seconds.

\$\endgroup\$
  • 1
    \$\begingroup\$ It's important to note that not all games have a static tick rate. Screeps, and Eve online both support variable tick rates. Minecraft is supposed to be a stable tick rate but usually doesn't achieve it, and handles it well. Dwarf Fortress has a static frame rate and sucks when it can't keep up, but it does still work. \$\endgroup\$ – coteyr Sep 28 '16 at 7:05
  • \$\begingroup\$ I think you are mixing the terms "frame" and "tick" here a little too much. Ticks can also span multiple frames (or update cycles). \$\endgroup\$ – Tyyppi_77 Sep 28 '16 at 9:03
1
\$\begingroup\$

A "tick" can refer to two different things. It could refer to a frame tick as you said were all the visible graphics on the screen gets updated. However, the term "tick" may also refer to a game loop tick. That type of tick is where your code get's executed. Usually your ticks is in a context of a loop of the same repeating ticks that will continue until the game stops.

\$\endgroup\$
1
\$\begingroup\$

A tick generally refers to one iteration of the game loop in which all the logic is computed, so games generally have multiple ticks per second.

However, many games run both the graphics and game loop on the same thread because the graphics usually don't take so long to display so that logic is interrupted, or vice-versa (although developers put checks in place for situations like that, like taking the difference in time between the last and current frame and adjusting the rate of movement accordingly).

FPS stands for Frames Per Second, so for many games, yes, technically speaking, each frame is one tick.

\$\endgroup\$
  • \$\begingroup\$ So I can use both terms interchangeably? \$\endgroup\$ – user3843164 Aug 9 '14 at 23:52
  • 2
    \$\begingroup\$ I wouldn't. I would use "FPS" when referring to graphics, and "ticks" when referring to logic, because some games, especially those with intense graphics, tend to have two loops: one for the graphics and one for the logic. \$\endgroup\$ – StrongJoshua Aug 10 '14 at 0:02
  • \$\begingroup\$ A tick is not a thread. \$\endgroup\$ – Josh Aug 10 '14 at 4:07
  • \$\begingroup\$ @JoshPetrie Oooh, I see my mistake, thanks for pointing it out. It's fixed now. \$\endgroup\$ – StrongJoshua Aug 10 '14 at 10:50
  • 1
    \$\begingroup\$ Games generally have multiple ticks per second. "Often", maybe. "Generally", no. Board games or strategy games might tick only when the user makes a move, both in the "main loop iteration"-sense and the "render"-sense. \$\endgroup\$ – Anko Aug 10 '14 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.