Winter 2026 CS 32

Programming Assignment 3
Lemmings

Part 1 due 11:00 PM Monday, February 23
Part 2 due 11:00 PM Monday, March 2 Tuesday, March 3

The Project 3 specification document is posted.

Updates

To see what the game looks like in action, you'll have to do a little prep work: In order to build and run Project 3, you'll need to install the SFML package. (SFML = Simple and Fast Multimedia Library). How you do that varies by platform.

On a Mac

  1. Open a Terminal window.
  2. If you haven't already installed the Homebrew package manager, do so by running the one-line command shown under "Install Homebrew" on the Homebrew page. That command is
        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  3. To install SFML, run the command
        brew install sfml
    
  4. Verify that the installation path is /opt/homebrew/Cellar/sfml or /usr/local/Cellar/sfml by running the command
        brew info sfml
    

Once SFML is installed, unzip the Mac sample executable zip file. In that zip file is a file named README.txt that tells you how to launch the program.

On Windows

  1. Launch Visual Studio and open the Developer PowerShell by selecting Tools > Command Line > Developer PowerShell. Run the command
    	vcpkg integrate install
    
    This pops up a dialog box wanting your administrator password to integrate vcpkg with Visual Studio. It's safe to do this and answer yes. If you do, you'll never have to do this step again. Close the PowerShell window.
  2. What you will have to do for any project you create that uses some package (such as SFML) is tell Visual Studio to use that package for that project. Download the Windows skeleton project. When you open the Windows skeleton zip file, make sure you drag the Lemmings folder in it to your desktop (or somewhere else) and in the folder there, double-click on the .sln solution file to open the project in Visual C++. It doesn't work if you try to double-click on the one embedded in the zip file.
  3. With the project open, select Tools > Command Line > Developer PowerShell, which should open a PowerShell window in your project folder that contains the .vcxproj file. Run the commands
    	vcpkg new --application
    	vcpkg add port sfml
    
  4. In the Solution Explorer tab, right click the boldfaced project name (Lemmings) and at the bottom of the menu that pops up, select Properties.
  5. In the dialog that pops up, for Configurations at the top select All Configurations from the dropdown. In the left frame under Configuation Properties, select vcpkg. In the right frame next to Use Vcpkg Manifest, select Yes instead of the default No. Click OK.
  6. You should now be able to build and run the skeleton program. You can now also see the game in action: Open the Windows sample executable zip file and drag the folder named LemmingsSample in it to your desktop. In that desktop folder, double-click on the Lemmings application. (If the program crashes after 1 to 30 seconds with a dialog box showing an error code 0xc0000022, try disabling your antivirus software. Unfortunately, we can't tell the SEASnet Windows Server to accept that there's no virus, so it may be impossible to run Lemmings on that server.)

On Windows (another method)

On a system like the SEASnet Windows server where you don't have administrator permissions or are otherwise constrained, or if the method above isn't working for you, here's another method.

  1. Decide where you want to install the SFML files; it can be whatever path you want. Perhaps you'd like C:\tools on your own machine, or Z:\tools on the SEASnet Windows server. In these instructions, we'll use C:\tools.
  2. Download the latest stable version (SFML 3.0.2) from https://www.sfml-dev.org/download/ and copy the SFML-3.0.2 folder from the zip file SFML-3.0.2-windows-vc17-64-bit.zip into C:\tools. Rename C:\tools\SFML-3.0.2 to C:\tools\SFML.
  3. Download the Windows skeleton project. When you open the Windows skeleton zip file, make sure you drag the Lemmings folder in it to your desktop (or somewhere else) and in the folder there, double-click on the .sln solution file to open the project in Visual C++. It doesn't work if you try to double-click on the one embedded in the zip file.
  4. If you installed SFML somewhere other than in C:\tools, select File > Open > File... and open MyVariables.props. In the fifth line of that file, replace "C:\tools" with the path to where you installed SFML.
  5. You should now be able to build and run the skeleton program. See the last step of the other Windows method above to see the game in action.

On Linux

  1. Install SFML:
  2. You should now be able to build and run the skeleton program. A Linux sample executable is not yet available.

After Installing SFML

You can download the project skeletons with the code we've written, for Windows, macOS with Xcode, macOS on the command line, or Linux, and make sure you can build and run them. All they'll do is close the window after you type q, but at least you can verify that the SFML library works for you. Even if you're not ready to put time into this project at this moment, test this now! You don't need to write any code to test this.

The only files you will modify are Actor.h, Actor.cpp, StudentWorld.h, and StudentWorld.cpp. Indeed, those will be the only code files you'll turn in, so in implementing your solution, you must not make and depend on any changes you make to code files other than those four.

At some point in Project 3, you may find the Stringstreams writeup helpful.

As a simple example of how a StudentWorld object and an actor object can interact, this demo zip file has the StudentWorld and Actor files for a simple demo that has one object appear that plays a sound whenever you hit the space key. That object never dies, so type q to end the demo. (Our framework intercepts the q to end the game.)

Note for Xcode users

Your program may write a handful of log message lines to the Xcode console window, starting with "Cannot index window tabs due to missing main bundle identifier" and ending with "Reporter dsconnected ..." or maybe "HALC_ProxyIOContext.cpp:1623 ...". You can ignore these messages. When your program finishes, though, the last line should be the "Program ended with exit code: 0" that Xcode writes.