Exercise: Marble Game

In this exercise we will work in groups to design a game involving moving marbles. The emphasis is on creative game design which applies the marble run elements developed so far. This exercise will explore all aspects of game development, including game design, mechanical design, software design and implementation, and playtesting.

One strong hint: please start with a well-defined, simple game idea. It is easier to elaborate a working design than start with complexity.

Objectives

After this exercise, you should be able to:

  1. Design a simple real-time game involving one or more moving marbles.

  2. Sketch and fabricate a simple mechanism including ball pathways, sensor placement, moving elements, actuator mounting, and motion transmission.

  3. Implement low-latency processing of asynchronous inputs and events in CircuitPython using event-loop and state machine structures.

Reference Guides

Please review the following reference guides as needed:

Creative Constraints and Opportunities

  1. You may use any available components. However, you are strongly encouraged to start with the components we have already encountered: accelerometers, reflective photointerrupters, hobby servos, DC gearmotors, laser-cut plywood, 3D printed parts.

  2. Please remember games may be real-time or turn-based. In either case, timing and pacing are important elements of game design.

  3. Scorekeeping is optional but encouraged.

  4. The game should be single-player, either a solitaire puzzle or against an active computer opponent.

Steps and observations

The overall objective is to create a interactive game. The following checklist may help:

  1. Please start by collaboratively choosing a game concept. A clear idea at the beginning will focus the rest of the work. It’s fine to adopt or adapt an existing game idea.

  2. Plan out the essential features in advance: game play sequence, user inputs, visible and audible outputs.

  3. Design the physical structure of the game. Be sure to remember to include space for electronics.

  4. Set up the shell of a CircuitPython program to support your hardware, e.g. set up all the hardware interface objects, read and write inputs and outputs.

  5. Add temporary code to test your inputs and outputs. At this stage it is helpful just to print values to the Serial port.

  6. Set up the essential run loop. I suggest using a real-time event polling loope, it is a versatile structure.

  7. Incrementally add the game logic, testing at each step.

  8. Please be sure to include user instructions in comments at the top of your code.

Deliverables

The result of your explorations should include:

  1. Live in-class demo of your device.

  2. A short report posted to the course work blog including:

    1. a zip of your SolidWorks files

    2. a photo and/or brief video

    3. a short text statement reviewing your intent and outcomes

    4. your CircuitPython code, either as an attached file (if long) or as a SyntaxHighlighter Code block (if brief)

Challenges

If you would like to explore more, please consider the following optional challenge questions.

  1. Try adding an ‘attract mode’ to garner attention between plays.

  2. What’s the most subtle way for the computer to cheat?

  3. Could you have implemented your game purely in mechanical logic without the Pico?