Unit 22 Task 3 & 4

Task 3

Design

Narrative

My game is a 2D football game, however instead of footballers, their are cars. I took this idea from an existing game (Rocket League). Its a two player game, and the objective of the game is to score in the opponents goal. There is no timer, which means that the game can go on forever. The two players could always put a timer on or stop at a certain score.

Pseudo Code

Using pseudo code is a fast and efficient way of explaining how I want my game to work after it’s played. When he runs the game, he can use W,A,S,D or the arrows, depending on what player ( blue or red) he/she is. The players have to hit the ball into each others net. When the ball is in the net, the score of the player who scored will increase, until the ball is out of the net. The game never ends.

Flow chart

This flow chart is to provide a short summary again of how the game will behave as such events occur.

Action list

Story Board

Main game: The football pitch and the ball is displayed, as well as the 2 players and their score/points.

Graphical tools

Due to me not being a good drawer, I decided to take he images from the internet and use it in my game. The background I took from a 2D game. The cars I took from the internet too. And the ball from the internet too, which was essentially a ball for the arcade pin ball game. But I decided to use it as a football. Graphical tools are used to develop games by creating a character or anything really, which you can then be brought into the game. Without the graphical tools, you on’t have for example a character and so you won’t have a character to control and play the game with. Therefore graphical tools are really important in developing a game.

Program Design

This part of the design will look at the project’s more professional and engineering-savvy face. This will explain all the strategies that I can use in my game development, and why I use them. I don’t have advanced program design, but I still have 2 goals and textured car and ball.

5 Best Practices for Designing a Successful Training Program ...

Purpose

The main purpose for my game is to entertain the players for a short or long period of time. Due to there not being a time limit, they won’t have to reset the game every time, they can continue from where they left off. My game has a simple objective, which is to get the highest score by scoring goals. Which can make my game competitive or casual (chill). The players can easily master the mechanics, which will attract a variety of people to my game. Having a purpose or objective in a game is crucial in developing a game. As if there is no purpose in a game, then the players won’t know what to do, as there isn’t an objective in the game.

Modularity

My program won’t have a heavy focus on modularity, because I’m not planning to make different maps (backgrounds) for now. But if I was, then I’m sure that more people would be interested in my game, as seeing different background won’t make the game boring and repetitive. Maybe in the future I’ll think of making new maps (backgrounds) and new objectives, maybe even making an AI or making it a 2v2 game, instead of a 1v1 game. Which will make the game more fun and entertaining. As the players won’t see the same thing over and over again. Modularity is used in developing games, as by adding multiple levels (maps) in the game will make it more fun and players would be curious and determined to finish the other levels. It makes the game more engaging for players, if there is more levels. As the players won’t see the same level over and over again.

Figure . Four types of modularity defined by Salvador et al ...

Systematic approach

This is a theory that requires finding the right solution to a problem or finishing a job. Many people lose track of what they are doing without a clear course of action and they end up all over the place that slows the production of their finished product. In this order I will concentrate on specific tasks to prevent this issue. Systematic approach helps develop a game quicker and easier, as you concentrate on specific jobs before moving on to the next tasks.

Methodology used for the development of the Testing Game ...

For example:

  1. World generation
  2. Player design and movement
  3. Interaction with ball
  4. Creation of score/points
  5. Adding sound effects

Data dictionary

For a specified database, the code dictionary explains the contents. Treating certain objects as other categories of data in a game allows to simplify and enhance a project’s workflow. I will have a variety of different types of items in my game that will be named according to their intent. Those objects are to be:

  1. Player
  2. Opponent
  3. Ornaments

Data types/structures

Because my game is going to be relatively easy mechanically. I don’t think that I am currently gonna be using a wide range of types or structures of data. I’ve seen some tutorials of spawning items, so I thought maybe in the future i could add different power-ups. But if I was to add it right now, I’m sure it would make the game more fun, interactive and entertaining. I think I’ll use:

  • Integers
  • Boolean
  • Strings
  • Arrays
  • Classes

Methods/Procedures

Methods are often named and used chunks of code that are put under a specific name which is the name of the method. I’m trying to use them to shorten the amount of coding I’m trying to have to do to make things easy to understand and more organised. I will have a few methods, as I won’t make a menu or instruction world for now. But if I was, then I would have a lot methods.

Data Structures

Parameters passed

It is really important to pass parameters in any programme, as it allows different classes / objects and scenes / stages to communicate and exchange data. I won’t be using this as my game is continuous and endless. As there isn’t a certain objective to be completed. Due to there not being time limit or a certain amount if goals that is needed to be scored to end the game. But if there was. The person who gets 5 goals or has the most goals before the time is up. The players will be removed and the game will end, and so the main menu will be brought up, as they will transfer their data. The main game world will also save the latest score and compare it to the previous high score and give the higher rating to the main menu screen where it will be shown. However my game won’t do that. It is important in using parameters in a developing game. As players like to complete an objective or task. This will attract more people in playing your game.

Return values

Return values play a significant part in parameters passing through. If I want to move the methods in my game to another object for a certain object, I must first accept that object as a return value, and then call the return value from the other object. However I won’t be doing that, as I want my game to be endless. Therefore not having a certain objective.

Scope

This explains how often data can be exploited by any class / object. Is it only capable of communicating with its processes, should it take data from other places. I will attempt to narrow the scope of all objects and classes in my game, so that they can only communicate with the data that they are meant to have. This removes any potential for mistakes.

Visibility

Visibility is strongly linked to scope. It defines how an entity or attribute is available beyond the class in which it is defined. If an object / variable is declared with the term “public” in front of it that means all classes / objects of any particular class have access to that attribute. If it says “private” rather than public it means that it can only be accessed from within the class in which it is declared. There are also some other declaring options such as “static” which means the variable value won’t change. A friend function has the same access as methods to private and protected data. Objects are pieces of code that do a specific thing in a program.

Instantiation algorithm design

This refers to how items in a given game are introduced or made. Because I will use a lot of different objects throughout the actual game, it will be a waste of time to create them all by hand. For this reason it is necessary to design and create a smarter solution for adding the said objects to the game. In my game I intend to automate most instantiation with the “for” loops.

Development choices

Choice of language and development facilities

Since I’m going to use Greenfoot because it’s one of my assignment specifications, I’m required to use JAVA which is an object-oriented programming language. OOP languages allow the user to build objects that can be parameterised as an entity that eliminates the need for a lot of coding because one entity can be generated several times and various parameters are also provided to deal with with each development. This effectively renders any generated object distinct from each other despite being made of the same class. OOP is great for developing games, because it helps build functionality that can be managed-code that is intuitive, adaptable and configurable. This also works when using the DRY (Don’t Repeat Yourself) approach to build reusable code: write the code once and then reuse it instead of copying and pasting it.

Menus

A menu is a tool for showing information and for helping a user move through a game. In my game I won’t be using a menu. Which is really lazy from me to do. However I think that my game mechanics are very easy as well as the keys needed to move the cars. This could make some people really confused, and for some it won’t affect them. Menus are essential in developing a game, as it helps new users understand how to navigate around and play the game.

ArtStation - Game Menus, Henry Robinson

Editing techniques

The editing techniques can be methods used to alter an image’s appearance outside or within the IDE. I’ll use certain code in my programme to change the size of specific sprites in order to make them more suitable for the role they need to play in my game. Editing techniques is needed in developing a game. As you don’t want an image for example a gun to take up the whole screen, so you want to edit the size of the gun and make it smaller, so that it could look realistic in a characters hand. And not take the whole background image.

Saving files

I arrange files on which Greenfoot already has a particular form in my project folder, or copy those variables to the hard disc that can be retrieved by the system later.

How to print to PDF file in Windows 10 - SimpleHow

Building/compiling code and built-in help facilities

When saved, Greenfoot automatically creates and compiles its code, even without pressing the compile button in the application editor. Pressing the compile button tests the code for any errors, until the programme actually runs. This way the IDE debugs it before the programmer begins it telling him whether there were any errors in its code. If errors are present the IDE often refuses to build the project until it is fixed. This is useful when developing a game, because you might not see the issue but the built-in compiling might and so it will help you fix your error. So that you can continue finishing or developing your game. It sees the error you made, so it notify’s you about it and tells you how to fix it.

Invocation

Is just the expression used when a function is simply named as it is part of a specific process or function.

Consistent indentation

Coding nicely and getting relevant code together are good practises.

greenfoot | ICT in Action

Coding rules and boundaries

Good programming practises

Firstly, commenting is one of the main programming practises. After a programmer reaches and passes in his programme a certain amount of lines, it will become difficult for him to keep track of where everything is or what it is doing just by looking. That is where it is really helpful to leave messages behind for them. It is therefore helpful for someone else who wants to read the code so they don’t have to follow it out to attempt and understand what all those processes, variables and loops mean.

Secondly, consistent indentation plays a very significant role in the clarification of code. An indentation will be rendered each time a new set of curly brackets is opened. That helps to distinguish specific functions from those within the code.

Thirdly, codes kept in small blocks. It is often difficult to achieve but should be done whenever possible as it helps to clear the code. As it won’t look messy.

Lastly, descriptive identifiers when constructing variables. You can assign any name to a variable but it’s still safer to label it something that is relevant to its function. This way you won’t be going back to trying to figure out why you declared “something important” as variable.

Good use of program structures

My game shouldn’t contain any meaningless codes. All codes must be seamlessly structured to optimise the visibility, consistency and performance of both the code and the game.

Syntax rules for the language

The appropriate syntax will be used, otherwise the game won’t run because Greenfoot avoids the compiling of any code with errors. If it so happens that a syntax mistake has been made and the game is already running so it does not yield the right results.

Iteration loops

It consists of pre-conditions and post -conditions. For eg, if the player is only able to leap if he is on the ground. That is a sufficient pre — condition for the code to call the jump method. The jump method sets a post after the player jumps – condition that he is in the air and can no longer jump until he gets back on the ground again.

Building Loops Using Iteration Statements :: Chapter 5: Flow of ...

Fixed loops

Fixed loops are initiated and continue to operate until any condition is met. I will be using a little bit of fixed loops to control the objects.

Correct exit criteria

For all stages of my development, I will be giving myself the appropriate exit criteria. This means that from every stage I do, I will expect a specific outcome. This is how I decide if my game is running properly or not.

Data Representation

I’ve mentioned the data types I’m going to use before, so I’m going to do so again and offer a brief overview of what they could look like in the programme and a brief explanation of how they function and their weaknesses.

Integers

The integer could be any whole number with a fixed value of 2,147,483,647 (positive or negative). They are used to store or modify numbers that the programme needs. They are declared by using the command “int” and then giving them a name.

Real numbers

Like the integer, real numbers have a maximum value of 2,147,483,647 even though they are decimal numbers so that numbers like 1,678 can be numbers. These are also used where the author wants to simulate smoother motion or more reliable mechanics. I’m not going to use them for my software because I decided I don’t need the amount of information in my game and regular integers are going to do the job just as well. They are declared by using the command “float” and the giving them a name.

Booleans

They are used primarily for iteration loops or some basic logic tests. They are stated using the “boolean” command in Greenfoot and JAVA but in other languages it can also be stated as just “bool.”

Characters

This type of variable applies to all of the characters available on your computer. It might only be one guy. It is used anytime you want to assign a particular role in your programme to a certain character. For example, when pressing W or forward key the car should move upwards. They are declared by using the command “char” and giving them a name.

Buy Magic Keyboard with Numeric Keypad for Mac in Silver - Apple (UK)

Strings

A string is really more like an entity, even though it’s referred to as a data type. It can contain several characters without a fixed limit, and is used to view text or to store and change data using real text. They are declared by using the command “String” and giving them a name (capitalisation is important).

Variables and constant variables

The various data types listed above are all variable. They could all store data for various purposes and can also modify the data inside of them. There could also be static variables that have a fixed value and are usually declared by writing the static command, and then type of variable and name of the variable. Writing their name in full capitals is a good practise to know they are static and are only used in a class scope.

Task 4

It took me close to 25 hours to finish this game. For evidence I will paste my link for the game:

https://www.greenfoot.org/scenarios/25792

This is the main game world generator class:

White Box Testing

Before I published the finished game I went through a series of tests which I logged in a table. The purpose of those tests is to find out if all the goals that i set myself were completed.

Test 1

Test 2

Suggested improvements by players (friends)

Textures

My classmates (Eddie and Shabaz) said that I could improve my textures to make the game more appealing and pleasant when playing. As the background looks pretty dull. Therefore I could have a brighter background and a brighter ball, so that its appealing and eye catching.

Procedural texture - Wikipedia

Sound effects

Joshie (classmate) said that I could add some sound effects, like a starting count down (3,2,1,GO!) And a celebrating sound effect when a goal is scored. This will make the game more engaging and fun and a overall better user experience.

Map variety

Both Cameron and Sameer (classmate’s) said that I could add different maps (backgrounds), so that the game could be more captivating and fun. As they said that its boring to see the same map (background) over and over again. They want random maps to spawn at the start of the game.

User Documentation

Introduction:

This is a game I made for my IT courses. This is the 1st game I’ve ever made by myself.

Specified game application:

My game is a browser game, so anyone can access it and play it. However it can’t be played on a mobile phone, only on a PC or laptop or anything that has a keyboard and can access the browser. You can also download my game and play it with other people too and also share the link so others can find it.

Operation of game:

It involves the user in controlling the car and score into the opponents net. As well as trying to defend its net, so that the opponent doesn’t score and get points. The game never ends. So they can play until they get bored really.

Purpose of game:

This is a game similar to Rocket league but a 2D version of it. The game is endless, meaning that there is no objective or time limit. The players decide when they want to end the game. So who has the highest score wins, you increase your score by scoring goals. You get points by how long the ball stays into the opponents net.

FAQs

How to start game?

  1. Open Greenfoot project file
  2. Press run

How to reset game?

  1. When your in the game at the bottom of your screen press “reset”. To reset your game.

What is the aim of the game?

Score in your opponents net and do not get scored on by your opponent. Get the most points/score to win.

Technical Documentation

Data dictionary

A reference to the data dictionary helps us to store an overview of the possible field names and their different forms for the programme we will be creating.

Algorithm designs including control methods

A control variable is a variable which has a common meaning continuously. It isn’t going to change anything through the program.

Selection: That is for times where you may need to run code if the requirements are met, avoid the section of the code in any situation.

Iteration: It’s for the occasions whenever you want the programme to run several times the same pieces of code.

User interface method design

An example of this is the development that I have shown for my game.

What is User Interface (UI) Design? | Interaction Design Foundation

Action Charts and Tables

I have shown you this before in my blog. The buttons you press do different actions.

This image has an empty alt attribute; its file name is image-1.png

Data flow diagrams

It shows the development of data in any procedures. E.g:

Data Types In Java With Example

Class and instance diagrams

The diagram shows the two data types. And how they differ from one another and link with different stuff.

Greenfoot has a tool which may just help me to avoid repeating myself.

Pressing on the tools bar in the Greenfoot editor shows the user a “Project Documentation” option.

Clicking the option brings the user to a tab where they can view all classes recorded in depth by Greenfoot, their methods and their variables.

Assignment Conclusion

The way I developed and built my game at the moment provides me with an simple way to alter and adjust a lot of the objects within.

As far as adding new things to my game goes, I could of added a timer so that I could make the game end. Or when scoring to reset the players and the ball to their original position (spawn). Or make the user play against an AI, but that was too much work for me and decided to leave it with a player vs player game. Personally I think I have improved my coding (java) skills. And possibly be able to create a even better game in the future. Overall, I feel like I’ve made a game that I’m proud of and it will make me understand that I can do more coding material and learn a lot when coding the game.

Design a site like this with WordPress.com
Get started