Creating a digital game
Unit Creating a digital game
Year level: 9-10 Topic: User Design and Programming Time: 10-20 hours
A digital game can give students the opportunity to learn and refine their object-oriented programming (OOP) skills which is a requirement at years 9–10. Students follow a problem-solving process to design, build and evaluate a digital game. They state the digital design problem and decompose it in order to develop a solution. They create an algorithm for the game and relate this to an OOP approach. As a group or in pairs they implement a solution to build a computer game using OOP principles. Finally, they evaluate the end product (the game) and the solution.
Flow of Activities
Creating a digital game
A digital game can give students the opportunity to learn and refine their object-oriented programming (OOP) skills which is a requirement at years 9–10.Algorithm
Create an algorithm for the game and relate this to an OOP approach.Implementation
Implement a solution to build a computer game using OOP principles.Evaluating
Evaluate the end product (the game) and a solution that incorporates OOP principles.Activity Creating a digital game
Who’s the game for and what’s its purpose?
Australian Curriculum Alignment
- Investigating and defining (ACTDIP038)
What's this about?
A digital game can test a user’s skill, provide them with a challenge and/or educate the user, all using game play.
The first step is to define the problem. Defining what the game is required to do enables us to identify the functional and non-functional requirements. At this point we also need to identify if there are any constraints or factors that should influence the nature of the game or how it is developed. How will the user interact – via a keyboard using arrow keys, a mouse or game console?
State the problem in terms of requirements. This will help in the process of designing an algorithm and, following that, to write the computer program.
Imagine we want a game where a superhero completes a challenge to gain points. If the superhero fails to complete the challenge in the allotted time, they lose a life. For each challenge, rewards are available for the superhero to increase their power. Their power starts to decrease as the challenge begins.
To make this game, we need to:
- represent the superhero
- represent their power
- represent the time remaining
- display their score
- have a way to input instructions to make the superhero react in the intended way
- alert the player when the superhero’s life has been lost
- include a way to reset the game.
To incorporate the use of OOP language students will need to be familiar with how to use classes as a way of associating variables and functions. This will help students to clarify ideas in the design phase. Note in OOP, variables are often referred to as attributes and functions are referred to as methods.
Using the superhero game as an example, class ‘Superhero’ could include:
Attributes (variables) | Methods (functions) |
---|---|
Image | Move |
Location | Collect tokens |
Power level | Gain power |
Other classes might include ‘Score display’, ‘Energy discs’ (for increasing power levels), etc.
Note: The programming language that students use to build the game will depend on students’ experience with general purpose programming languages. Note that Python on its own can be used to produce fairly rudimentary games in terms of a user interface. Students who want to include graphics can use the PyGame library by importing it at the start of the computer program.
Learning tasks
- To introduce the basics of OOP, you may decide to set students the task of building a game. They can work through the stages as a class. This lesson can be used to develop students’ familiarity with the Python environment. Students also learn about classes and how to build a game. They follow the suggested problem-solving process from defining the problem to evaluating the solution.
- Ask students familiar with OOP who have good programming skills to design their own games in collaborative teams.
- Students brainstorm game ideas, and identify the audience and purpose. Once they have agreed on an idea for the game, students sketch out interactions and how the game might flow. Students can easily add and modify ideas by sketching on a whiteboard or equivalent.
- Students programming in Python may want to add graphics. You can give them examples of existing games such as those in Game Frame to download, play and review. By seeing how the game works and tracing the events onscreen to the particular code, students can build up and enhance their programming knowledge.
- This type of activity can help students with the design of their own digital game. It is expected that before students implement their programming they decompose their own design problem and generate design ideas.
- Unity is an alternative to Python. Unity might be favoured by students who want to develop a user interface with more graphics. Refer to the lesson provided.
Supporting Resources



Lesson Ideas
Assessment
Define and decompose complex problems in terms of functional and non-functional requirements.
Suggested approaches may include
- The completed Snake Game works as intended
- Table showing classes with associated variables and functions
Activity Algorithm
How can I represent my design of the solution?
Australian Curriculum Alignment
What's this about?
An algorithm is a logical step-by-step process for stating how to create a digital solution. Algorithms are generally written as a flowchart or in pseudocode. A flowchart is a common way to visually represent an algorithm. Another relevant approach particular for games and apps is to do a storyboard which often focuses on the onscreen actions.
Pseudocode is a way of describing a set of instructions that does not have to use specific syntax. Students use structured English to express these instructions; for example, using ‘while’ and ‘endwhile’ when describing a ‘while loop’.
As they design the solution, students need to refer back to any constraints identified when they defined the problem, such as social and technical constraints. The design of the user interface and consideration of these constraints is referred to as user experience. Design of the user interface draws on design principles such as contrast, space, balance and repetition.
Learning tasks
- Ask students to complete a noun–verb analysis of the description of the problem that they are solving.
- For example in the following paragraph, nouns are written in red and verbs in blue (see the table below for a listed version):
Select your superhero to start. Our superhero jumps from box to box to reach the life elixir (reward) to increase her life by 1. Along the way she captures energy discs to boost her power. She avoids the monster that guards the top box where the life elixir is stored. A collision with the monster results in a life lost. Three lives lost and the game is over.
Nouns Verbs superhero
box
life elixir
reward
life
one
energy discs
power
monster
top box
three
gameselect
start
jumps
reach
increase
captures
boost
avoids
guards
stored
results
lost - The nouns are usually the classes and the verbs are often the functions. Compare this to the identified classes and related functions. Students use this information in the development of the algorithm which may be in the form of a flowchart or written in Pseudocode.
- Students complete a relationship diagram to map the interactions between sprites/characters and events in the game. This can help with algorithm development or can be compared with the algorithm.
- Discuss the options to create an algorithm for the game. This could be in the form of a flowchart or written in structured English (pseudocode).
Supporting Resources




Assessment
Design and implement modular programs, including an object-oriented program, using algorithms and data structures involving modular functions that reflect the relationships of real-world data and data entities.
Suggested approaches may include
- Tracing the flow of interactions using an algorithm created to describe the game.
Activity Implementation
How can I code my solution?
Australian Curriculum Alignment
- Producing and implementing (ACTDIP041)
What's this about?
It is a requirement that students in years 9 and 10 use an OOP. This will require a shift from a procedural programming approach to using OOP approaches.
OOP is a style of programming that focuses on using objects to design and build applications.
In OOP, objects represent a combination of data (the variables or attributes of an object) and the actions that can be performed on or with that data (the functions or methods of the object). An example might be the declaration of a ‘car’ which has attributes that describe its physical nature (such as the number of doors, its colour, the size of the engine) and methods for the actions it can perform (such as accelerating, braking and turning).
The attributes and methods of an object are defined by its class. Using a class, we can organise information as attributes so we can reuse these elements when making multiple instances of that data type.
A programmer could make three instances of a superhero, such as Batman, Wonder Woman and the Hulk, using the Superhero class to store similar information that is unique to each superhero. For example, they look different, have different levels of power, etc. The programmer could also associate the appropriate information with each superhero. The methods of the superhero might be to jump and collect tokens. Collecting tokens could replenish power levels.
Once students have developed their algorithm and mapped out the classes with their associated attributes and methods they can begin to implement their design by programming.
Learning tasks
- In their groups students implement the algorithm using a suitable programming language. It may help to provide a time limit for each team member to input the code; for example, each person has a 5-minute block to type the code then swaps with the next person. This way all students get a chance to experience programming rather than watching one competent student do all the inputting.
- Given the students ideally use OOP principles in this task it is useful to discuss the implications of how this will impact the way they implement the program. What classes did students identify and what will this look like in the programming? Discuss the syntax of the program being used; for example, in Python programming:
- the class needs to be initialised, and attributes and methods need to be defined; then, when the individual instances of the class are created, its attributes must be initialised
- first parameter for methods is ‘self’. The ‘self’ parameter is used to create member variables.
- Remind students of the importance of making their objects and classes as clear and intuitive as possible.
- As they go through their programming they can run parts of the code to test on screen to make sure the code works as expected. Debugging is a central aspect of the programming. Students may need to do a web search to find an answer to why their code may not be working and fix the error. Ask students to keep a log of what they did individually and as a group to overcome any problems.
Supporting Resources









Lesson Ideas





Assessment
Design and implement modular programs, including an object-oriented program, using algorithms and data structures involving modular functions that reflect the relationships of real-world data and data entities.
Test and predict results and implement digital solutions.
Suggested approaches may include
- Presentation of the completed game and discussion of how the game is programmed using classes.
Activity Evaluating
Have I met the user’s needs and how well did we perform the task as a group?
Australian Curriculum Alignment
- Evaluating (ACTDIP042)
What's this about?
Product evaluation
Rubrics can be used to assess the quality of the final product. In conjunction with the rubric, a peer review can be conducted with a suitable scaffold to provide feedback on the quality of the final product from a user’s perspective.
Student performance evaluation
As students progress through the task ask them to document their design solution, implementation plan, and any code reviews. Several pieces of evidence should be gathered to evaluate student performance. Peer reviews can also be a valuable tool.
Learning tasks
- Product evaluation
The primary focus of product evaluation is to make sure the product does what it is intended to do. - Student performance evaluation
Typically, teachers are required to report on students’ performance. Digital technology work is almost always project based and a variety of pieces of evidence are needed in order to assess students’ performance. - Student-guided rubrics represent a meaningful assessment exercise. They engage students not in the content that they are learning, but also the motivations behind why they are learning it. Students may, as a class, list characteristics of what would make a good project. For example, when considering their digital technologies project, they might consider what would make a good presentation of a requirements and data analysis. Some of these characteristics might be: easy to understand, complete, relevant discussion of constraints and requirements, and consideration of user community.
- Think Aloud is a learning and assessment strategy designed to assist students to articulate their thought processes, and to help foster a supportive environment for learning.
- In an example of formative assessment, students could be asked to test each other’s game and provide feedback to their peers, including the top three best features, as well as the top three issues.
- In summative assessment, you could introduce intentional mistakes in a previously developed block of code. Students could be given the faulty code and asked to identify all the mistakes.
Supporting Resources





Assessment
Design and evaluate user experiences and algorithms.
Suggested approaches may include
- Consider using a checklist for students to review their programming.
For example:- Am I able to understand the code easily?
- Is the code written following acceptable coding principles?
- Is the same code duplicated?
- Can I test/debug the code easily to find the cause of errors?
- Where and how well have I used ‘classes’ in the program?
- A log could be made of the days worked on the project with a one-line statement about the work/task covered for each entry. A rating could be made of their input.
- Student negotiated and agreed rubrics.