Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Beginner's Guide to Game Programming Ep1 Part 7-A Regulating FPS in Allegro 4

Loading...

Sign in or sign up now!
5,742
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jul 3, 2009

The Beginner's Guide to Game Programming:
A Problem Solving Approach
Episode 1: Makin' Pickin' Sticks
Part 7: Regulating FPS

This is a written and video tutorial created to teach the basics of Allegro and SDL as well as game programming in general, while encouraging the newbie to code it out themselves.

Tells you how to create a function to regulate FPS in your Allegro game.
Sorry for the poor sound quality, this and the last video I uploaded were done on my laptop.

You can get the written version and other things at my site:
http://www.moosader.com

Playlist link:
http://www.youtube.com/view_play_list?p=B9C8BC6F495BD17E

  • likes, 3 dislikes

Link to this comment:

Share to:

Uploader Comments (LusikkaMage)

  • When i build it i get this error c:\mingw\bin\..\lib\gcc\mingw3­2\4.5.2\..\..\..\libmingw32.a(­main.o):main.c|| undefined reference to `WinMain@16'|

    ||=== Build finished: 1 errors, 0 warnings ===|

    i dont know what the problem is ? btw im using code::blocks

  • @Xaloez Do you have END_OF_MAIN(); immediately after the main function block?

  • I have two questions, in the loomsoft tutorial, they used "END_OF_FUNCTION(incCTL), don't we need that. and why do we decrease the variable?

  • Ahh, I looked it up. You need it for a function that's been LOCKed by a timer, but doesn't seem necessary for anything else.

see all

All Comments (24)

Sign In or Sign Up now to post a comment!
  • @LusikkaMage ok i'm confused, so in the counter loop I have character.update which gets the input and I have character.draw in the counter loop which blits the character to the buffer. Outside this loop but still in the game loop I have the buffer blitted to the screen. When I run the game, problems occur.

    1. the walking animation is way too fast, how do I slow it down.

    2. the character flashes..

    what do I do?

  • question, when I run that code, i get an error:

    Unhandled exception at 0x100dabf5 in (name of game i'm making): 0xC0000005 Access violation reading location at 0x00000098.

    what do I do.

  • Your tutorials are fabulous! Thank you!

  • @CodingMadeEasy

    The inner loop is essentially for getting input, as it might happen more than once per cycle. You only want to draw once per cycle, so you won't put it inside the loop.

  • @LusikkaMage Quick Question. Why should the draw to the screen stuff be outside the second while loop?

    why can't you put it inside the second while loop and then clear the buffer in the first while loop?

    so basically like this

    while (!done) {

    while (counter > 0) {

    /// update

    blit (Buffer, screen , 0 , 0, 0, 0, 640, 480);

    }

    clear_bitmap (Buffer);

    }

  • Great video, I thought when I read the title, that you refered FPS as First Person-Shooter.HAHAHA!

  • that's pretty spiffy, i love your tutorials. Is it a good idea to try to limit the logic loop too? As to avoid eating a lot of cycles, I mean. Could i have the game calculate the logic 100 times per second and no more, for instance? That would be nice, right?

Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more