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:
Design a simple real-time game involving one or more moving marbles.
Sketch and fabricate a simple mechanism including ball pathways, sensor placement, moving elements, actuator mounting, and motion transmission.
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¶
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.
Please remember games may be real-time or turn-based. In either case, timing and pacing are important elements of game design.
Scorekeeping is optional but encouraged.
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:
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.
Plan out the essential features in advance: game play sequence, user inputs, visible and audible outputs.
Design the physical structure of the game. Be sure to remember to include space for electronics.
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.
Add temporary code to test your inputs and outputs. At this stage it is helpful just to print values to the Serial port.
Set up the essential run loop. I suggest using a real-time event polling loope, it is a versatile structure.
Incrementally add the game logic, testing at each step.
Please be sure to include user instructions in comments at the top of your code.
Deliverables¶
The result of your explorations should include:
Live in-class demo of your device.
A short report posted to the course work blog including:
a zip of your SolidWorks files
a photo and/or brief video
a short text statement reviewing your intent and outcomes
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.
Try adding an ‘attract mode’ to garner attention between plays.
What’s the most subtle way for the computer to cheat?
Could you have implemented your game purely in mechanical logic without the Pico?