Frame Capping

Lab Image
Today's goal: Learn a linker trick for monitoring performance. Get acquainted with SDL graphics and how to frame cap your game.


In today's lab we will be using a little linker trick to monitor memory. Then you will work on another little hack to ensure your games can run on any system at the same framerate.

Your Task(s)

  1. Slides for our half half lecture
  2. Find your partner in the spreadsheet here.
  3. Complete the section below: "Linker"
  4. Complete the section below: "Frame Capping"

Files Given/Starter Code

  • Clicking the following link gives you immediate access to your github repository.
    • You may use your personal or Northeastern github account. I do not care, but please be consistent with what you choose.
    • Please do not click until class starts. Occasionally I make changes until a few minutes before class (usually spelling corrections and other small typos).
    • Click now: Github Repository

1. Linker

Linker Tricks

Complete: Compile-Time interpositioning for monitoring malloc.

Follow the instructions in the github repository for running a cool little experiment. Note that you will have to ssh into to complete this portion (linux and mac users should be okay to do so on local machine. MinGW users mileage will vary).

2. Frame Capping

Too fast is a problem!

Just as we may use compile-time interpositioning to find slow code in our game, we will have to sometimes slow our games down to make sure they are playable! Check out the github for some code that needs to be frame capped!

Going Further

Finished Early? Did you enjoy this lab assignment? Here are some (optional) ways to further this assignment.
  • What happens if we never hit our frame rate? Can/should we modify our movement? (i.e. if I have a slow system, will that make the game "easier" to play if the cpu does not update as fast).


  • You and your partner will receive the same grade from a scale of 0-2. (Individual labs you get your own grade)
  • At the start of the next lab I will circulate to check off your lab. You or your partner should be ready to show it.
    • 0 for no work completed.
    • 1 for some work completed, but something is not working properly or missing
    • 2 for a completed assignment (with possible 'going further' options completed)

More Resources

Some additional resources to help you through this lab assignment

Found a bug?

If you found a mistake (big or small, including spelling mistakes) in this lab, kindly send me an e-mail. It is not seen as nitpicky, but appreciated! (Or rather, future generations of students will appreciate it!)
  • Fun fact: The famous computer scientist Donald Knuth would pay folks one $2.56 for errors in his published works. [source]
  • Unfortunately, there is no monetary reward in this course :)