View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

5.0 | 1 rating Rate this file 9 Downloads (last 30 days) File Size: 4.79 KB File ID: #37588 Version: 1.1
image thumbnail




23 Jul 2012 (Updated )

This is a one-dimensional tracking game. Use a joystick to make the cursor follow the target.

| Watch this File

File Information

As part of my graduate research, I have used manual tracking games (based on the work of previous researchers) to test the control behavior of human operators, and how their behavior changes as the dynamics of the cursor change.

Programming these games in MATLAB is fun. I am posting a simple example game to serve as a reference in case anyone wants to make something similar.

There is a list of settings near the top of the function. Feel free to modify settings and observe their effect on the game. If things get messy, the default settings are given immediately after the NOTES section.

My code demonstrates a few techniques that I have found useful, including:
1) Enforcing a fixed frame rate with a MATLAB timer object
2) Using MATLAB's Control System Toolbox to get a discrete state-space model from a transfer function, and using the model to move the cursor based on joystick input (see "Other requirements" below)
3) Creating a seemingly-random signal from a sum of sine waves with random relative phase
4) Defining a small set of global structs that make it easy to share variables across functions, and make it obvious what kind of information is stored in each variable.

These techniques could be used for designing a variety of games, not just tracking games.

Required Products Control System Toolbox
MATLAB release MATLAB 7.14 (R2012a)
Other requirements This game requires either jst.mexw32 or jst.mexw64 (depending on your system), which can be downloaded FOR FREE at Marc Bodson's website: The jst file must be in the same directory as PlayTargetTracker().
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
24 Jan 2017 Mr Smart

24 Jul 2012 1.1

Pointed out that joystick mex files are free.

Contact us