yusufuddin443234300.files.wordpress.com · Web viewThe game which I decided to create will be...
Transcript of yusufuddin443234300.files.wordpress.com · Web viewThe game which I decided to create will be...
Unit 22: Developing Computer Games
Designing a computer game (P3)
For this task I will map out a design using different techniques such as pseudo codes, storyboards & flowcharts to help understand how I will start to create my game.
Narrative
The game which I decided to create will be called ‘Floppy Duck’ and it is based on a similar game which can be found online and in app stores in mobile devices, called ‘Flappy Bird’. Essentially what I would like to do is change the game so I can add different sound effects, different backgrounds and a new character. The goal of this game is to survive for as long as you can by making sure you guide the character away from the pipes and making sure the character does not fall outside of the map. The story of the game is basic; however, the actual gameplay requires timing skills and accuracy making it somewhat intense.
Pseudocode
I will now create a pseudocode to help understand what I would like to implement into the computer game that I will be creating.
New World = FloppyDuckWorld
Create new character ‘FloppyDuck’
Create new object ‘Pipe’
IF spacebar is pressed
Start to move FloppyDuck Up
Else
Start to move FloppyDuck down
ELIF floppy bird touches pipe OR falls out of world
Print ‘GameOver’
Exit()
IF FloppyDuck touching Pipe = False Then
Score +1
1By Yusuf Uddin
Unit 22: Developing Computer GamesFlowchart
I will now create a flowchart to also help understand the basic structure of my game and to help further with my design phase. In order to accomplish this, I will be using a site called ‘Draw.io’ which specialises in creating flowcharts and provides the tools required to help in its creation.
2By Yusuf Uddin
Unit 22: Developing Computer Games
Actions and outcomes
Here I will discuss the actions the user can input and the outcomes that each of these actions will provide.
Action Outcome
User selects the run button This starts the game and the FloppyDuck then starts moving.
User presses Spacebar Stops FloppyDuck from falling and moves it upward
Users action makes FloppyDuck hit a pipe Prints Gameover and the game and score is reset after being printed
Users action makes FloppyDuck fall out of the world
Prints Gameover and the game and score is reset after being printed
User presses Reset Resets the game and wipes the data of the current game.
User presses pause Pauses the game
User presses the resume button Resumes the game where it was left off
3By Yusuf Uddin
Unit 22: Developing Computer Games
How I would like the game to look (Graphical representation)
I will now give a graphical design on how I would like to make my finished program look like at the least. It will not be the representation of my finalised game; however, it will be a foundation which I will use to build the final product.
4By Yusuf Uddin
The FloppyDuck
PipeBackground
Unit 22: Developing Computer Games
Determine appropriate data types for a computer game and show how they are declared (M1 & P3 extended)
Program design:
My program design is simple and consist of basic user interface that will be tailored through the feedback I receive to create a much cleaner and user-friendly game which satisfies the user.
Purpose of the program:
The purpose is to build on the foundation of the Flappy Bird game, my own similar game called FloppyDuck which will be designed and coded by myself.
Modularity:
In simplistic terms this is when modules can be developed on separately and can then all be combined to create the software/program. Modularity is very important in the process of developing software.
Systematic approach:
Systematic approach is ensuring that a program is developed correctly and is tailored properly. This is accomplished by ensuring that before developing a program, it is designed and planned out properly. Also, when in development it must be analysed & tested thoroughly for errors and to ensure it meets the purpose that it is being designed & developed for.
Data Dictionary:
This essentially is a descriptive collection of multiple items within the program and what they are designed to do.
Data Structure:
This is the way in which data is stored within a program or system. Some of the data structures are:
Integer: This is a whole number such as the number ‘1’.
Float: This is a number which has digits following the decimal point, essentially a number which has a fractional value.
Boolean: This is either true or false, in binary it is represented as 1(true)&0(false).
Characters: Values which can be found on a keyboard such as individual letters, numbers and symbols.
Strings: This is a collection of characters which forms words and sentences.
Methods:
Essentially this is a set of instructions which are used when called upon by the program.
Parameters Passed:
5By Yusuf Uddin
Unit 22: Developing Computer GamesThis is simply the process of manipulating data and commuting it around different parts of the program to help with its functionality.
Return value:
This is the output given based on specific actions. Such as 7+3 was the action and the return value would be 10.
Scope:
This is where data is accessible by an object.
Visibility:
This is where the code can be visualised and displayed by an individual.
Private:
Private data in a program is data which can only be accessed in the area which it has been declared.
Public:
This form of data can be accessed at any point within the program.
Static variable:
This is a form of data where its life span is the entirety of the program’s duration.
Friend function:
Similar accessibility as methods to private & secure data.
Instantiation algorithm design:
This is the production of a real instance which can be a class of objects.
Develop:
Developing a program is when one codes the program so that it can be interacted with and visualised.
Choice of language for program:
I have chosen to use Greenfoot java and in specific I will be doing object-oriented programming which allows me to create multiple classes and call upon them when needed. Furthermore, it also provides the ability to reuse lines of codes to help provide a more organised structure to the code of my program.
Development facilities:
I will be using a windows pc which will be running the latest version of Greenfoot.
Menus:
My game will not consist of a menu, however a menu consists of different options which can be chosen by the user, for example a menu might allow a user to select ‘start game’ or ‘settings’. Essentially the menu provides the user with access to a variety of in-game features.
Editing techniques:
6By Yusuf Uddin
Unit 22: Developing Computer GamesThis is essentially how I approach my program using effective techniques to ensure changes, such as visual graphics of the program, are made efficiently.
Saving files:
During my coding I will be saving my files continuously as changes are made to them so that I do not loose data and I will also be saving them into a back up to further ensure its safety.
Building or Compiling Code:
This is a stage whereby the compiler automatically searches through the code for invalid syntax and errors before the program is run, so that the program can function without problems (prior to changes if necessary).
Built-in help facilities:
Greenfoot IDE consists of different features that I can use to help develop my program, such as help with code and it has a debugging system which I can use for my code. It provides me with information necessary to tackle most problems I may encounter during the coding phase.
Good programming practice:
I will be implementing good programming practice such as commenting on the program where needed and ensuring that indentation of the program is correct.
Small unitary code blocks:
Code blocks each have their own task and function and commit to them by itself and can be erased and copied where necessary.
Invocation:
This is when a function is called or started.
Consistent indentation:
This can fall under good programming practices and it is ensuring code is neat and indented where possible.
Descriptive identifiers:
Each variable should be given an appropriate name which helps to understand what it is better.
Coding: Good use of program structures:
This is ensuring that the programs code is in a organised structure and that no irrelevant code and commenting is present.
Syntax:
Syntax is the ruling for the way in which code can be implemented, such as the use of semicolons at the end of each line in java or colons at the end of statements in python.
Assigning values:
This is giving variables data which they will consist of.7
By Yusuf Uddin
Unit 22: Developing Computer GamesOperators, input/output statements:
This is essentially the process of taking in inputted information and data and processing the data to provide an understandable output.
Selection methods:
An example would be calling procedures from anywhere in the program using only a line of code.
Iteration loops:
These are pre-conditions which are required to be met before it can proceed to the rest of the code within a method.
Post-conditioned:
This is essentially the opposite of a pre-condition and is a condition that is true after the code has finished running in a specific method.
Fixed loop:
This is a loop where a specific algorithm is continuously run until a specific condition is met.
Declaring:
An example would be assigning a constant which means a variable will have a value or will represent a specific data throughout the duration of the program.
Variables:
Variables can be both public or private and they represent value and data which they are assigned to and can be changed depending on the data they consist of.
8By Yusuf Uddin
Unit 22: Developing Computer Games
Develop a computer game for a given specification (P4)
I will have now used Greenfoot Java to develop my game, using the design as a foundation and will show what I have developed. The way that I will organise this is that I will first of all explain the contents of the modules found in the ‘World’ module and then all the actor modules.
World
FloppyDuckWorld:
I will now explain the contents of the module FloppyDuckWorld which is the world which the game is set in.
9By Yusuf Uddin
The ‘int counter = 0’ is where I created a counter variable which is only a whole number and would later be used to help spawn the pipes at random at every 100 counts.
The ‘PIPE_SPACING’ variable is a constant variable which is used to create a specific space between the top and bottom pipe throughout the duration which the game is run for.
In this section here I have generated he world at a pixel size of 600 x 400 and have created the FloppyDuck character and added the character object into the world. It is added at the middle height.
Unit 22: Developing Computer Games
10By Yusuf Uddin
In this section I have generated and added the top and bottom pipes using the counter, so that the pipes spawn every 100 counts. This is so that the pipes don’t overlap. Also, I used the variable ‘PIPE_SPACING’ to generate a constant space between the top and bottom pipe so that they do not meet and provide the optimum space required for the FloppyDuck character to pass through.
Unit 22: Developing Computer Games
Actor
FloppyDuck
I will now explain the contents of the actor subclass ‘FloppyDuck’ which is the main character of the game.
11By Yusuf Uddin
In this section of code, I have created variables ‘dy’ to set the point of gravity ‘g’ for the value of the constant pull of gravity and finally ‘BOOST_SPEED’ for the amount the FloppyDuck will move upwards when the spacebar key is pressed.
In this specific section I have created a statement whereby if the bottom pipe is interacted with, the GameOver image would be printed on the screen followed by a sound played for hitting the pipe and another sound which says ‘GameOver’. The game then stops.
Unit 22: Developing Computer Games
12By Yusuf Uddin
In this specific section I have created a statement whereby if the top pipe is interacted with, the GameOver image would be printed on the screen followed by a sound played for hitting the pipe and another sound which says ‘GameOver’. The game then stops.
In this section, I stated that if the space key is pressed then it calls upon the variable ‘BOOST_SPEED’ and sets it into the variable ‘dy’ which means the position of the character will move upwards by the value of ‘BOOST_SPEED’ every time the spacebar key is pressed. It will also play a sound effect with each press of the spacebar key.
Unit 22: Developing Computer Games
GameOver
I will now explain the actor subclass ‘GamOver’
13By Yusuf Uddin
In this section I have created a statement whereby if the FloppyDuck reaches the bottom edge of the screen then the game will be over and the character will lose. Also, it will play 2 sound effects, one which is a falling sound and the other which says ‘GameOver’. The game will then also end. In addition, the section which states ‘dy = dy + g’ is a statement where gravity pulls down on the current position of the FloppyDuck.
This section of code is empty as all that is required is the image which I have already set for it, which is then called upon during different parts of the code
Unit 22: Developing Computer GamesPipe (bottom)
Pipe (top)
Conclusion:
The code for my game is now complete and fully working with no errors and I have uploaded it to the Greenfoot website. Overall, I believe the design phase has helped a lot with providing me a foundation which was used to develop my computer game.
Link for the game: https://www.greenfoot.org/scenarios/23229
14By Yusuf Uddin
In this section I have generated the bottom pipe so that it is spawned at a set location and at specific speeds which it will appear. The pipe speed at which they appear is set in the variable ‘PIPE_SPEED’
In this section I have generated the top pipe so that it is spawned at a set location and at specific speeds which it will appear. The pipe speed at which they appear is set in the variable ‘PIPE_SPEED’
Unit 22: Developing Computer Games
Follow a test strategy to test and debug a computer game and use multiple testing tools (P5 & M1)
Testing strategies:
Black Box:
This is essentially where testing occurs whereby the individual who is testing the program has not seen the code and does not know how it works. In my case it was done by my classmate to find in game bugs and errors, or any glitches that may occur.
White Box:
This is the opposite of Black box and it is testing which is done by someone who can view the code and can understand how it works. In this case it was done by me as I understand the code and by thoroughly looking through it, I fixed any syntax errors and added code necessary to allow my program to run smoothly and efficiently.
The rest of the testing strategies are already evident throughout my work so far and will be added in the testing table below:
Test Number
Reason for Test
Expected Result
Actual Result
Possible Fix & improvements
Evidence
1
To see if the game ends and plays
sound when the top pipe is touched.
The game should end and the 2 sounds
should be played.
The game ended and the sound
effects were played.
N/A
2
To see if the game ends and plays
sound when the bottom
pipe is touched.
The game should end and the 2 sounds
should be played.
The game ended and the sound
effects were played.
N/A
15By Yusuf Uddin
Unit 22: Developing Computer Games
3
To see if the game ends and plays
sound when the
FloppyDuck touches the
bottom edge.
The game should end and the 2 sounds
should be played.
The game ended and the sound
effects were played.
N/A
4
To see if the FloppyDuck moves when spacebar key
is pressed.
The FloppyDuck
should move up.
The FloppyDuc
k moved upwards.
N/A
5
To see if the pipes are
spawned at different
sizes.
The pipes should be different lengths
every time they are
generated to the previous
size.
The pipes were all different lengths to
the previous, when they
are spawned.
N/A
6
To see if the top pipe and bottom pipe
have a constant
same space in-between.
The pipe should have
the same space
between them each time they
are generated.
The same space was
kept between the
top and bottom pipes
throughout the entire
duration of the game.
N/A
16By Yusuf Uddin
Unit 22: Developing Computer Games
7
To see if the game can be paused then
played
The game should
pause when pressed and
resume back to
where the user was
when resume is pressed.
The game paused when
needed and resumed exactly where it
was left off.
N/A
8
To see if the reset button
works
The game should reset
from the beginning when the
reset button is pressed.
The game reset
immediately as
expected.
N/A
The Greenfoot IDE also came built in with debugging features which I used to remove potential errors in my code. Also, I have used this feature multiple times throughout the development of my program to ensure that no errors were present. Greenfoot also notified me when & if there was a syntax error and showed me in which line of code this error occurred, so that I could make changes to fix that error. Overall, Greenfoot has an environment, whereby the tools needed to test and ensure my program has no errors was provided to me.
Use appropriate iteration methods for a computer game (M2)
The iteration methods are all presented and evident in the P4, P5 and M3 tasks. Also, it can be viewed in the source code form in the following link: https://www.greenfoot.org/scenarios/23229
17By Yusuf Uddin
Unit 22: Developing Computer Games
Suggest improvements for the game designed after receiving feedback from users (M4)
For this task I have given the users who have tested my program a survey so that there is an opportunity for me to receive feedback and understand what I should improve next time. The surveys were taken on Instagram and snapchat, and I will be writing feedback which was given to me by the users in its raw form.
Did you enjoy playing the game?
100%
Did you enjoy the game?
NoYes
All 10 of the users enjoyed playing the game and even shared it with other people to play, which is a good sign.
Which part was most enjoyable?
. Overall the entire game concept was fun
. A good feeling of nostalgia
. Sound effects were very fun
. The overall game had a very good visual representation
. Enjoyed spamming the spacebar to dodge the pipes
. Surviving for as long as possible
Which part was least enjoyable and what improvements would you suggest?
. Scores were not kept
. Nothing to increase the speed of the character
. Only spacebar moved the character upwards
18By Yusuf Uddin
Unit 22: Developing Computer GamesConclusion
Overall, I am impressed with the reviews as it has been voted 100% enjoyable by all the users who tried it out, however there are many more improvements which can be implemented to improve overall gameplay and make the game more competitive. This includes adding a score counter, so that the score can be counted and adding a high score board, so that individuals can have a fun competition to see who gets the highest scores. Also increasing the speed of the FloppyDuck gradually as it survives longer in the game, to slowly make it harder and harder. Finally, to add another key to also move the character upwards rather than just the spacebar
Produce a user & technical documentation for a computer game (P6 & P7)
I will now produce a user & technical documentation for my computer game whilst ensuring it is organised and understandable.
User Documentation
Specified Game Application:
The FloppyDuck game is built for users that have access to a PC web browser which can download Greenfoot IDE which can be used only on the following operating systems:
. Linux
. Mac
. Windows
Purpose of game:
The game which I have created is designed to create my own version of the Flappy Bird game, however with different features such as a new character, different theme and new sound effects.
Operation of game:
The game revolves around the user having to press the spacebar key to stop the bird from falling & guide it past the pipes which are generated and random sizes. Due to the random sizes of the pipe, it makes the game more intense to manoeuvre the character around it.
FAQ:
Q: How do I move the FloppyDuck?
A: You press the space key to move it upwards
Q: How do I pause the game?
A: There is an option to pause it at the bottom of the game
Q: What happens if the FloppyDuck hits the pipe?
A: The game will be over
Q: What happens if the FloppyDuck falls all the way down?
A: The game will be over
19By Yusuf Uddin
Unit 22: Developing Computer GamesTechnical Documentation
Data Dictionary:
Data dictionary stores the data and its field name in a specific program. In my case, for my program I have inputted the following for my data dictionary:
Field Name Data type Purpose
counter Integer Allows me to create a counter to help spawn the pipes every 100
counts
PIPE_SPICING Integer To create space in-between the top and bottom pipe
offset Integer For random sized pipes
Dy Double For the position of the FloppyDuck
g Double For the pull of gravity on FloppyDuck
BOOST_SPEED Double For the speed at which FloppyDuck moves upwards when the spacebar
is pressed
PIPE_SPEED Integer For the speed at which the pipes appear
20By Yusuf Uddin
Unit 22: Developing Computer GamesAlgorithm design including control methods:
A control variable is a variable which has a value which will not change at all. I have used a control variable in my program and an example is ‘double BOOST_SPEED = -5’. In this instance the variable ‘BOOST_SPEED’ will always remain as ‘-5’.
Selection:
This is essentially a loop which will keep occurring until very specific conditions are met. For example, if a question is asked and the wrong input is given, it will repeat the question until the correct answer is given. Once the correct answer is given it will proceed to the next stage.
Iteration:
This is when specific lines of instructions are repeated.
User interface method design:
This has been demonstrated by me as I have used multiple methods to produce a user interface and this is evident in this piece of work above and in the program which I have produced.
Action charts:
This is essentially a way in which actions and their outputs are displayed, however due to the simplicity of my game, my flowchart displays the same information.
Action tables:
This is another way where the actions of the process and its outputs are displayed, I have done this in the work above.
Input, process, output tables:
Since my program does not process information, it is not necessary for me to produce an input-process-output table. However, it is essentially the input of multiple information, processing them and providing the result of those inputs. For example, multiple random letters could be inputted (input), then they can be processed and built into different words(process) and finally all those words that can be built out of the random letters will be displayed (output).
Class and instance diagrams:
These types of diagrams display the relationship between classes and objects, classes and variables and instance variables.
Data flow diagrams:
This essentially displays how the information flows in a specific system or process. I have used a data flow diagram also known as a flow chart, to show the flow of information in my program.
21By Yusuf Uddin
Unit 22: Developing Computer Games
Explain how the structure and design of a game can assist in maintenance and capacity for extension (D2)
For this task I will be using my code as an example to discuss how the structure and design of a game can assist in maintenance and capacity for improvements and extension.
In-line code commenting:
In line commenting is when code is commented on without the program interpreting what is written in the code. Essentially code commenting is implemented to help explain what each section of code does and what each line function is and how it commits to the program. Comments are very useful for people who are working in groups on the same code since by commenting they will help each other understand why they used a specific line of code. They can also detect problems much faster and find code that may just be excess and remove it. Furthermore, if an individual decides to go back and make an edit to a previous code they have programmed, they can easily remember why they did what they did, as the commenting will help them remember. This is very useful when making extensions for the game as it can help find areas of maintenance and improvement with much more ease. I will now provide a screenshot example of where I provided code commenting to explain sections of my code.
22By Yusuf Uddin
Unit 22: Developing Computer GamesIndenting and layout:
Indentation is a crucial component when allowing maintanence and future extention as it provides a more organised structure to the program and makes it more visually appealing. Indenting also allows the code to be separate from other lines of code and text so that the codes are not all jumbled up together. Due to the more organised structure from indenting, improvements can be added much more easily. In my code indentation and layout was a priority, the cleaner the code, the easier it is to maintain:
In the screenshot above we can see an example of how I used indentation to make my program more organised and easier to understand. Due to it cleaner appearance, it is far easier to add future extensions and improvements.
23By Yusuf Uddin
Unit 22: Developing Computer Games
Syntax:
Syntax in Greenfoot java is essentially the way in which lines of codes and algorithms must be structured and organised. An example would be, for compiling to work in java, the lines of code must end in semi colons, or else a syntax error would appear & the program will not start up. The importance of syntax is very important as the program will not work if it is not correct, hence why understanding syntax of a programming language properly is needed for future extension and maintenance of the program. If I were to take the FloppyDuck class and place it into the Pipe class, it simply will not work due to syntax error. Therefore, programs must be tailored according to the syntax of the chosen language, so that everything can work more smoothly, efficiently and without errors. The use of correct syntax is evident throughout my entire program and I will present a screenshot to display this:
In the screenshot above my use of syntax such as the semi-colons are present.
24By Yusuf Uddin
Unit 22: Developing Computer GamesModularisation:
This is essentially where the program is broken into separate parts that all build and work together commit to creating and functioning a program. Each module will be given specific tasks to complete, each tailored in its own way, but all tailored to work with each other. When changes need to be made, rather than having to look long lines and essays of code, when modules are used, the user can simply navigate to the module which contains the code which they would like to edit and make those changes and add extensions. Due to the modules being split up but all functioning together maintenance is much easier. For example, in my code if I were to find an issue with the Top Pipe, I can simply navigate to the top pipe class and make the changes necessary. I will show an example of my separate classes which allow me to change the pieces of code with much more ease:
25By Yusuf Uddin
Unit 22: Developing Computer Games
Variable names:
Providing variables with appropriate names which describe what the variable does is very crucial when it comes to maintenance and future extensions of the code. This is because it helps the user identify variables much easier and can help them save time so that they don’t have to search through the entire program just to find the name of the variable. A variable name should describe what that variable consists of, and if it is named well it usually requires no in-line commenting as the piece of code will already be self-explanatory. I will now provide a screenshot of where I used appropriate and descriptive variable names.
Overall Conclusion
After receiving the feedback for my computer game, I now know how can add future improvements such as adding a scoreboard and score counter to make the game even more fun and competitive. Also, to allow the FloppyDuck to move with more keys rather than just the spacebar key and increase the pace as the FloppyDuck passes through more pipes. Also, I would like to add sound every time the FloppyDuck goes past a pipe
In my game I have added sounds which is different from the original design idea, so that the game is more user friendly and fun. The sound when loosing from hitting the pipe and falling is different, providing the user with a different outcome to the different actions.
Overall, I feel as though my game did very well and it is very close to perfection and have very much enjoyed this project and learned a variety of new skills and honed many of my previous programming skills.
26By Yusuf Uddin
Unit 22: Developing Computer Games
27By Yusuf Uddin
Unit 22: Developing Computer Games
28By Yusuf Uddin
Unit 22: Developing Computer Games
29By Yusuf Uddin
Unit 22: Developing Computer Games
30By Yusuf Uddin