0% found this document useful (0 votes)
501 views52 pages

BSC CSIT Final Year Project Report On Sword of Warrior Game Project Report

BCS CSIT Final Year Project Report of "Sword of Warrior" 2D Action-Adventure platformer video game.

Uploaded by

Grey Old
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
501 views52 pages

BSC CSIT Final Year Project Report On Sword of Warrior Game Project Report

BCS CSIT Final Year Project Report of "Sword of Warrior" 2D Action-Adventure platformer video game.

Uploaded by

Grey Old
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 52

Acknowledgement

The success and final outcome of this project required a lot of guidance and assistance
from many people, and we feel extremely fortunate to have got all this along the
completion of our final year project. Whatever we have done is only due to such guidance
and assistance and we would not forget to thank them. We could not have completed this
project without help from our college “NIST COLLEGE” which gave the supportive
hands before us academically, also regarding other activities related to Information
Communication Technology as well as extra curriculum activities that we got to
participate in. It gave us family like environment.

We take this opportunity to express our profound gratitude and deep regards to our
supervisor Mr. Samish Shrestha for his exemplary guidance, monitoring, and constant
encouragement throughout the course of this thesis.

We could also like to appreciate the help of various people for providing us essential data
required for our project as well as their time in guiding us so to how our project will be
more effective in users prospective. We are also grateful to our teachers for their constant
support and guidance.

Finally, we would like to express our sincere thanks to all the friends and others who
helped us directly or indirectly during this project work. This project has been a wonderful
experience where we have learnt and experienced many beneficial things.

Ishwor Prasad Dhungana (21281/075)

Sushanta Dhungel (21291/075)

Saroj Gurung (21288/075)

iii
Abstract

The 2D action-adventure platformer game is a genre of video game that combines


elements of action, adventure, and platforming to create a unique gaming experience. In
this type of game, players control a character who must navigate through levels, defeat
enemies, and solve puzzles to progress through the game. The game typically features a
mix of combat, exploration, and platforming challenges, and often includes a variety of
player reward system as coins, treasure chest etc. The genre has a long and storied history,
with classic titles like Super Mario Bros., MET, and Castlevania and with modern titles
like Hollow Knight, Celeste and Sword of Xolan inspiring countless imitators and
innovators over the years. With its classic gameplay mechanics and modern design, this
2D action-adventure platformer is the perfect game for anyone who loves a good old-
fashioned adventure.

iv
Table of Contents

Acknowledgement iii

Abstract iv

Table of Contents v

List of Figures vii

List of Tables viii

List of Abbreviations ix

Chapter 1: Introduction 1
1.1. Introduction 1
1.2. Problem Statement 2
1.3. Objectives 2
1.4. Scope, Goals and Limitation 2
1.5. Development Methodology 3
1.6. Report Organization 4
Chapter 2: Background Study and Literature Review 5
2.1. Background Study 5
2.2. Literature Review 6
Chapter 3: System Analysis 8
3.1. System Analysis 8
3.1.1. Requirement Analysis 8

i. Functional Requirements 8
ii. Non-Functional Requirements 12
3.1.2. Feasibility Analysis 13

i. Technical Feasibility 13
ii. Operational Feasibility 14
iii. Economic Feasibility 14
iv. Schedule Feasibility 15

v
3.1.3. Analysis 16

• Sequence Diagram 16
• Activity Diagram 16
• State Diagram 18
Chapter 4: System Design 19
4.1. System Design 19
• Class Diagram 21

• Component Diagram 22

• Deployment Diagram 23

4.2. Algorithm Details 24


Chapter 5: Implementation and Testing 26
5.1. Implementation Overview 26
5.1.1. Tools Used 27

5.1.2. Implementation Details of Modules 29

5.2. Testing 31
5.2.1. Test Cases for Unit Testing 31

5.2.2. Test Cases for System Testing 33

5.3. Result Analysis 35


Chapter 6: Conclusion and Recommendation 36
6.1. Conclusion 36
6.2. Future Recommendation 36
References 37

Appendices 38

vi
List of Figures

Figure 1. 1: Iterative Development Process 3


Figure 3. 1: Use Case Diagram 10
Figure 3. 2: Gantt Chart 15
Figure 3. 3: Sequence Diagram 16
Figure 3. 4: Activity Diagram 17
Figure 3. 5: State Diagram 18
Figure 4. 1: Model Implementation 19
Figure 4. 2: Class Diagram 21
Figure 4. 3: Component Diagram 22
Figure 4. 4: Deployment Diagram 23
Figure 4. 5: A* Algorithm Component 24
Figure 4. 6: Enemy Eagle and Enemy Skull Fire 25
Figure 5. 1: Iterative Development Model in Implementation 26
Figure 5. 2: Implementation of A* Path Finding Algorithm 31

vii
List of Tables

Table 3. 1: Main Menu Fully Dressed Use Case Description 11


Table 3. 2: Level Select Fully Dressed Use Case Description 11
Table 3. 3: Project Scheduling 15
Table 5. 1: Test Case for Player Controller and Animations 32
Table 5. 2: Test Case for Player Combat and Animation 32
Table 5. 3: Test Case for Selecting Level 33
Table 5. 4: Test Case for Algorithm module 33
Table 5. 5: Test Case for Game Start 34
Table 5. 6: Test Case for Main Menu 34
Table 5. 7: Test Case for Checkpoint and Respawn System 34

viii
List of Abbreviations

AA Action-Adventure

AP Adventure Platformer

PLAT Platform

MET Metroidvania (a genre of platformer game inspired by the Metroid


and Castlevania series)

2D Two-Dimensional

GUI Graphical User Interface

UX User Experience

C# C Sharp

ix
Chapter 1: Introduction

1.1. Introduction
The 2d platformer video game genre is the genre of video games, consisting of action-
adventure platformer, side scrolling role playing platformer, player controller platformer.
The core objective of this genre is to move the player character from A to B points through
obstacles and enemies in each stage. A platformer games have levels that consists
platforms, game environment, coins, enemies, obstacles, weapons and many more. On
game environment player can jump through platforms, climb to platforms, collect the
coins as reward, fighting with enemies, explore the environment, tackles the obstacle,
fighting with boss enemy, completing the present level-go to next level.

In this domain we developed 2D platformer action-adventure video game included with


A* path finding Algorithm for some enemy AI which is pc/desktop and laptop based.
Our video game title is “SWORD OF WARRIOR”. The system is developed in Unity
Editor Software and the programming language used is C# script. Idea for this video game
is came from games like Super Mario, Hollow Knight, Limbo etc. Our game is story
based so there is a village full of joy and happiness. One night the evil wizard came and
destroy everything from this village. Now the village is full of sadness and darkness only
the young warrior (Fire Warrior) which is player can save the village from evil wizard.

The Unity Editor enables you to create 2D and 3D games, apps and experiences. It is
very popular game engine and also many game developers used it for completing their
handy projects. So that we created our game by using this software. Human Interaction
is the major part of any system. Project look and feels are designed and created so that
every player can easily be interacted with system.

A lot of work was done on it. This project covers the area of Graphics, Physics, Audio,
User Interface, Animations, Scripting, Unity Services.

1
1.2. Problem Statement
Design a 2D platformer game that offers engaging gameplay mechanics, challenging
level designs and an immersive visual and audio experience. The game should allow
players to control a character that can jump, run and interact with the game environment
to navigate through various levels, overcome obstacles, defeat enemies and ultimately
reach the end goal. The game should also offer collectibles, some puzzles, challenges and
rewards to keep players motivated and engaged. The game must be designed to provide
a fair level of challenge while avoiding frustration for the players. The game should be
optimized for desktop/pc and should be enjoyable for players of all ages and skill levels.

1.3. Objectives
The objective of “Sword Of Warrior” can be summarized into following points:

• To create a 2D Platformer AA game that will have all the functionality of


traditional Platformer games.
• To implement sword attack and fire ball projectile as the ability.
• To implement various kinds of enemies that have the purpose to simply attack
and damage the player until the death of the player.
• To learn and understand the working of Unity game engines.
• Implementation of level Selection.

1.4. Scope, Goals and Limitation


Scope

Our project has made it easier for everyone to create their own digital games. Playing
video games fulfills a purpose in their lives. This could include gaming for: relaxation,
opportunities to exert control, enjoyment, creativity, socialization, prevent boredom,
challenges, and achievement. Main purpose of video games is for entertainment.

Goals

This final project report is designed to build a 2D game for entertainment and for practice
purpose.

2
Limitation

• Single Player
• May not have appropriate Sound Effects
• Risk of copyright claim on Music
• Required to improving the details in Level Design

1.5. Development Methodology


The software process methodology to be used would be “Component-based” since the
IDE or Game Engine which would be used is Unity 3D. Unity 3D uses component-based
programming and supports C# or JavaScript as a scripting language. Although C# is an
object-oriented language, Unity 3D uses it as a scripting language and combines it with
the game components to complete the component-based method.

Even if one can prepare a well-thought -out design document, some features do not give
the same effect in gameplay as on the paper. During implementation phase many features
are added, removed, or modified. Accordingly, one needs to make some modifications on
game design and requirement analysis. Thus, one of the most suitable development
methodologies for game development is iterative development process. Most of game
developers have the same idea about the advantages of iterative development process for
game developers.

Figure 1. 1: Iterative Development Process

3
1.6. Report Organization
Chapter 1: Consists of overview, introduction, problem statement, objectives, scope,
goals and limitation, development methodology of the proposed system.

Chapter 2: Covers background study and literature review.

Chapter 3: Covers requirement specification, feasibility study and object-oriented


approach on System Analysis.

Chapter 4: Design of Sword of Warrior project is explained in detailed with all the
necessary diagrams and brief functionality.

Chapter 5: Process of implementation and testing is described along with all the tools
used for the development.

Chapter 6: Conclusion and future work of the system are explained.

4
Chapter 2: Background Study and Literature Review

2.1. Background Study


“From Playing to Programming: The Effect of Video Game Play on Confidence with
Computers and an Interest in Computer Science” research was done by Rebecca Sevin
and Whitney DeCamp at Western Michigan University on 2016. This research has shown
that video games can have positive effects on young player’s social lives. The type of
scientific thinking encouraged by video games and the technological abilities needed to
play video games is suggested to result in an increase in players confidence with
computers and interest in computer science.

In 1980, Thomas W. Malone states: “In some senses, computer programming itself is one
of the best computer games of all. In the ‘Computer programming game,’ there are
obvious goals, and it is easy to generate more. There is unique relationship between
digital games and Computer science since computer science is the foundation of such
games. But more than that, the programming process itself contains many of the same
elements found in games.

Terminologies related to our project

Sword of Warrior is 2D Action-Adventure PLAT game which has five main parts:

a) Game Mechanics
Our game has various actions that the player can perform such as jumping,
climbing, attacking, throwing projectiles etc. It is essential to study popular
action-adventure games to understand how they use these mechanics to create
engaging gameplay.

b) Level Design
Our game level design offers a balance of exploration, combat, puzzles, and
platforming. It is essential to understand how to create diverse and challenging
levels that keeps the player engaged.

5
c) Story Telling
Our game has simple and sweet story which motivate players to play.

d) Art Style
Our game art style complement the gameplay and storytelling.

e) Audio Effects
Background music, Sfx, Voice over are may be used to enhance the players
experience and create an immersive environment.

2.2. Literature Review


Hollow Knight, Shovel Knight, Sword of Xolan and Celeste are one of the major Games
or most popular Games in the category of 2D Action-Adventure Platformer have different
story, gameplay, graphics and functionalities.

Hollow knight is a challenging 2D action-adventure game. You’ll explore twisting


caverns, battle tainted creatures and escape intricate traps, all to solve an ancient long-
hidden mystery. This game meta critic rating is 87, steam rating is 10 out of 10 and 97%
user of steam gives the positive review on this game. The world of hollow knight is
animated by hand in a traditional 2D style.

Shovel Knight is a platform video game developed and published by Yacht Club Games.
The game received critical acclaim, with critics considering it one of the greatest “one of
the greatest video games ever made”. This game meta critic rating is 85 and steam rating
is 10 out of 10.

Sword of xolan is an action platformer game that includes the juice of pixel art style.
Xolan is a young and brave man who fight for justice no matter what the cost. This game
apple app store rating is 4.6 out of 5 and have positive reviews, google play store rating
is 4.5 out of 5.

Celeste is a 2D platform game developed and published by indie studio Matt Makes
Games. This game is based on player controller. This game meta critic rating is 88 and
steam rating is 10 out of 10.

6
Some theories, articles and their conclusion

“The Design and Play of Platform Games” by Jesper Juul: This paper examines the
mechanics of platform games, including character movement, level design, and enemy
behavior. The author argues that the player’s interaction with the game environment is
key to the success of the game.

“Building Successful 2D Action Games” by Dave Voyles: This article provides tips and
best practices for designing and developing 2D Action Games. It covers topics such as
game mechanics, level design, art style and sound design.

“The Design of Super Mario Bros.” by Shigeru Miyamoto: In this article, the creator of
Super Mario Bros. discusses the design philosophy behind the game’s mechanics and
level design. He emphasizes the importance of creating a game that is easy to understand
but difficult to master.

7
Chapter 3: System Analysis

3.1. System Analysis


System analysis is a process of collecting and interpreting facts, identifying the problems
and decomposition of a system into its components. It specifies what the system should
do.

A system analysis for a 2D Action-Adventure platform game would involve analyzing


the various components and systems that make up the game. These include:

• Player Controls
• Game Physics
• Level Design
• Enemy AI
• User Interface
• Audio and Visuals

3.1.1. Requirement Analysis


Requirement analysis involves identifying and analyzing the functional and non-
functional requirements that are necessary to create a successful game or system.

i. Functional Requirements
Very beginning of the game, there is Game Intro and scene transit to the Main
Menu. Details of the menu are listed below:

• Main Menu
• Level Selection
• Pause Menu
• Gameplay Module

Following are the requirements which must be performed by the proposed


system on the basis of menus and module:

8
1. Main Menu
• Player should be able to start the game.
• Player should be able to exit the game.
• Player should be able to continue the game from where he left.

2. Level Select
• Player should be able to select the next level after completing the
previous one.
• Player should be able to see the progress of their gameplay on each
level.

3. Pause Menu
• Player should be able to resume the game.
• Player should be able to go to level select menu.
• Player should be able to go to main menu.

4. Gameplay Module
• Player should be able to run/walk, jump, double jump, climbing the
ladder.
• Player should be able to attack the enemies, damaging their health
and kill them through the sword attack and fire ball as projectile.
• Player can die and respawn at various checkpoints available.

9
Use Case Diagram

Figure 3. 1: Use Case Diagram

10
Use Case Diagram Description

Table 3. 1: Main Menu Fully Dressed Use Case Description

Use Case-ID UC_01


Use Case Name Main Menu
Primary Actor Player
Stakeholders and Interests Player:
Player View the Main Menu
Pre-Condition Game Must be Launched
Post-Condition Options Display
Main Success Scenario • Player Launch the Game
• Game Intro
• View Main Menu
• Menu Display Successfully
Special Requirements • User friendly UI and game
should be played easily in
landscape mode.
• Language should be
international (English)
Open Issues • Low RAM can Crashed the
Game.
Technology and Data Variations List • Game should be played on
Desktop/Pc and OS must be
Windows.

Table 3. 2: Level Select Fully Dressed Use Case Description

Use Case-ID UC_02


Use Case Name Level Select
Primary Actor Player

11
Stakeholders and Interests Player:
Player can Select the Specific Level
after completing the Previous One.
Pre-Condition Game Must be in running mode.
Post-Condition Specific Level Selected
Main Success Scenario • Player Start New Game
• Player Complete the Level-1
• Level Select Menu Display
Successfully
• Player Select the Next Level
• Player Selected the level
successfully
Special Requirements • User friendly UI and game
should be played easily in
landscape mode.
• Language should be
international (English)
Open Issues • Low RAM can Crashed the
Game.
Technology and Data Variations List • Game should be played on
Desktop/Pc and OS must be
Windows.

ii. Non-Functional Requirements


Following are the non-functional requirements for Sword of Warrior.

1. Usability
The usability requirements for Sword of Warrior are following:
• All the elements of the games must be designed in accordance to a
naïve user’s perspective; however, the gameplay is required
beginner level knowledge of platformer games.

12
• The game should provide key points or instruction how to play the
game.
• This game can be played by all types of gamers so the game will be
easy to learn and play.

2. Performance
The performance requirements for the game are:
• The game should run at minimum of 30 frames per second.
• The latency overall should be less than 200 milliseconds.

3.1.2. Feasibility Analysis


Feasibility study is defined as evaluation or analysis of the potential impact of the
proposed project or program. The objective is to determine whether the proposed system
is feasible.

The scope of this project is to build pc game application which can be accessed by user
through at any time, from any place (if device is available). In feasibility study phase of
this Unit 2D game we had undergone through following steps:

i. Technical Feasibility
Technical feasibility assess whether the current technical resources are
sufficient for the new system. The tools and technology that will be used in
making the Sword of Warrior are Unity game engine, Microsoft visual studio,
programming language C#, Adobe Photoshop, Audacity, Adobe Premiere Pro
are completely free for students.

Unity itself also has animation editor which can be used to make simple
animation that is related to moving objects, changing sprites, and sprite editor
which can separate sprites which is good enough for our game.

The simplicity of the project along with the facts mentioned above proves that
this software is also technically feasible.

13
Hardware Specification

• Laptop, Desktop
• 2GB RAM, 1GB ROM/SSD

Software Specification

• Windows OS

The tools and technology that where used in the making of the Sword of
Warrior are:

Game Engine: Unity 2021.3.16f1

Image Editor: Adobe Photoshop 2020

Audio Editor: Audacity

Video Editor: Adobe Premiere Pro 2020

Code Editor: Visual Studio 2020

Programming Language: C#

ii. Operational Feasibility


Our team is consist of three members all members have some knowledge of
Software Engineering, Game Developing, Audio and Video Editing. We will
prepare this system with full documentation. So that there will be no problem
for any person operating this system. Its user interface will be GUI based so
user and stakeholder will very comfortable in handling this system.

iii. Economic Feasibility


Economic feasibility determines whether the time and money are available to
develop the system. There is no cost associated for using this system. Hence,
the system is economically feasible.

14
iv. Schedule Feasibility
Time is important and most valuable factor. The completion of this project with
the cooperation of team members and resources within time. Schedule
feasibility is a measure of how reasonable the project timetable is. So, our
project feasible schedule had been managed through proper time schedule.

Table 3. 3: Project Scheduling

S. No. Task Start Date End Date Duration (Days)


1 Planning and Prototyping 10/24/2022 11/25/2022 32
Core Features
2 Development 11/26/2022 1/11/2023 46
Secondary Features
3 Development 1/12/2023 2/21/2023 40
4 Polish and Final Testing 2/22/2023 3/22/2023 28
5 Report Writing 3/23/2023 4/4/2023 12

24-Oct 13-Nov 3-Dec 23-Dec 12-Jan 1-Feb 21-Feb 13-Mar 2-Apr 22-Apr

Planning and Prototyping

Core Features Development

Secondary Features Development

Polish and Final Testing

Report Writing

Figure 3. 2: Gantt Chart

15
3.1.3. Analysis
Using Object-Oriented Approach

• Sequence Diagram
Sequence diagram shows the sequence of object interactions. It represents the flow
of messages in the system and is also termed as an event diagram. It helps in
envisioning several dynamic scenarios

Figure 3. 3: Sequence Diagram

The above sequence diagram shows the player start the game, main menu showed
up. Player play the game, he can pause and continue the game, he can also go to
level select map and can exit the game.

• Activity Diagram

Activity diagram are graphical representations of workflows of stepwise activities


and actions with support for choice, iteration and concurrency. It represents a flow
from one activities to another.

16
.

Figure 3. 4: Activity Diagram

Above activity diagram shows the internal working of our project.

17
• State Diagram
A state diagram is a type of diagram used in computer science and related fields to
describe the behavior of systems. State diagrams require that the system described
is composed of a finite number of states; sometimes, this is indeed the case, while
at other times this is a reasonable abstraction.

Figure 3. 5: State Diagram

Above diagram shows the state of game play after player load the game.

18
Chapter 4: System Design

4.1. System Design


System Design is the process of creating a design for the system to meet the requirements.
System design is the process of designing the architecture, components, modules,
interfaces, and data for a system to satisfy the specified requirements. It involves the
design of the system architecture, components, modules, interfaces, and data.

System Architecture and Overview

The System consists of many Modules that work simultaneously with each other. The
User interacts with the program with the help of an Environment (Interface). The
Environments is Rendered using the Rendering modules with gets most of its information
from Collision and Physics module while rendering as well as in-game play. When the
player interacts the environment other modules also start to pitch in inputs such as
movement modules moves the player character and due to this interaction, the
environment changes accordingly.

Main Menu

Player

Environment/In
Game

Physics

Game State
Collision
Movement Rendering

Figure 4. 1: Model Implementation

19
Object Oriented Approach

Object-oriented programming (OOP) can be applied to game development projects to


create a more organized and efficient codebase, improve code reusability, and increase
scalability. Here's an example of how an object-oriented approach can be used in a game
development project:

Define game entities and behaviors: Start by identifying the game entities and their
behaviors, such as the player character, enemies, items, and obstacles. Define their
attributes and methods that describe their behavior and how they interact with each other.

Create game classes: Create classes for each game entity that encapsulate their behavior
and attributes. For example, create a Player class with attributes such as health, speed,
and position, and methods such as move(), jump(), and attack(). Create similar classes for
other game entities such as enemies and items.

Implement game mechanics: Use the classes and their methods to implement game
mechanics such as movement, collision detection, combat, and scoring. Use design
patterns such as the observer pattern to create event-based mechanics such as triggering
an action when a specific event occurs in the game.

Test and iterate: Test the game mechanics and the classes, and iterate on the
implementation based on feedback from testing. Refactor the code to improve
performance and maintainability.

Implement graphical user interface: Create a user interface to display game


information such as health, score, and time. Use graphics libraries such as OpenGL or
DirectX to render the game assets and animations.

Implement game levels: Create game levels and use the classes and their methods to
implement the game logic for each level. Use scripting languages such as Lua or Python
to create level-specific behaviors such as spawning enemies, triggering events, and
setting the level objectives.

Polish and deploy: Polish the game by adding sound effects, music, and additional
assets. Deploy the game on various platforms such as desktop, mobile, and consoles.

20
• Class Diagram
The class diagram depicts a static view of an application. It shows the attributes,
classes, functions, and relationships to give an overview of the software system. It
constitutes class names, attributes, and functions in a separate compartment that
helps in software development. Since it is a collection of classes, interfaces,
associations, collaborations, and constraints, it is termed as a structural diagram.

Figure 4. 2: Class Diagram

21
• Component Diagram
A component diagram is used to break down a large object-oriented system into the
smaller components, so as to make them more manageable. It models the physical
view of a system such as executables, files, libraries, etc. that resides within the
node.

Figure 4. 3: Component Diagram

Above diagram shows the components of our project as Game Play, Player Records,
Level Map, Main Menu etc. This helps project more manageable.

22
• Deployment Diagram
The deployment diagram visualizes the physical hardware on which the software
will be deployed. It portrays the static deployment view of a system. It involves the
nodes and their relationships.

Figure 4. 4: Deployment Diagram

Above Deployment diagram consist client as PC/Laptop devices which is used to


play the game. It request to the Game Application then Game Application response
so that player can play the game.

23
4.2. Algorithm Details
• Information

In this project we implemented A* search Algorithm for enemy AI to find and


damage the player by using the shortest path.

A* search Algorithm is a simple and efficient search algorithm that can be used to
find optimal path between two nodes in a graph. It will be used for the shortest path
finding. It is informed search using heuristic function h(n), and cost to reach the
node n from the start state g(n). This search algorithm expands less search tree and
provides optimal result faster.

In A* search algorithm, we use search heuristic as well as the cost to reach the node.
Hence, we can combine both costs as following, and this sum is called as a fitness
number.

F(n) = G(n) + H(n)

Cost to reach
from node n to
Estimated cost Cost to reach goal node
of the cheapest node n from
solution start state
Cost to reach
Estimated cost from node n to
Figure Figure
4.5: A* 4. 5:
Algorithm Component
goal node
of the cheapest
Enemy Eagle
solution
and Enemy
FireCost to
Algorithm reach node n
from start state
Step 1: Place the starting node in the OPEN list.

Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure
and stops.

Step 3: Select the node from the OPEN list which has the smallest value of
evaluation function (g + h), if node n is goal node then return success and stop,
otherwise

24
Step 4: Expand node n and generate all of its successors, and put n into the closed
list. For each successor n, check whether n is already in the OPEN or CLOSED list,
if not then compute evaluation function for n and place into Open list.

Step 5: Else if node n is already in OPEN and Closed, then it should be attached to
the back pointer which reflects the lowest g(n) value.

Step 6: Return to Step 2.

• Using Algorithm in project


We implement this algorithm in two enemy AI, they’re:
1. Enemy Eagle
2. Enemy Skull Fire

They follow the player in game after game starts and damage the health of the
player. They choose the shortest path to reach the destination. They ignore the
unnecessary collisions towards the game objects, so this helps them to reach
their destination optimally.

Enemy Eagle Enemy Skull Fire

Figure 4. 6: Enemy Eagle and Enemy Skull Fire

25
Chapter 5: Implementation and Testing

5.1. Implementation Overview


Iterative Development process is a methodology that involves breaking down a large
project into smaller chunks and then developing each chunk through a series of iterations
until it meets the desired outcome.

The iterative development process is an effective way to develop a 2D action-adventure


platformer game. Here are the steps you can follow to implement this process:

Figure 5. 1: Iterative Development Model in Implementation

Define the game concept and create a prototype:

Before starting the development process, you need to have a clear idea of the game
concept. Create a prototype that includes the basic features of the game, such as character
movement, level design, and enemy behavior. This prototype will help you identify any
potential issues and adjust your development plan accordingly.

Identify the features and prioritize them:

Once you have a prototype, you can identify the features that you want to add to the game.
Prioritize the features based on their importance and feasibility. Focus on implementing
the core features first and then move on to the secondary ones.

26
Develop the core features:

Start developing the core features of the game, such as player movement, level design,
and enemy behavior. Implement these features and test them thoroughly to ensure that
they are working correctly.

Test and iterate:

Test the game regularly to identify any bugs or issues that need to be fixed. Address these
issues promptly and iterate on the game design as necessary. Keep testing and iterating
until you have a solid foundation for your game.

Add secondary features:

Once you have the core features in place, start adding the secondary features, such as
power-ups, collectibles, and boss battles. These features can enhance the gameplay
experience and make the game more enjoyable.

Test and iterate again:

Test the game again after adding the secondary features. Make sure that everything is
working as intended and iterate on the game design as necessary.

Polish the game:

After all the features are in place and working correctly, it's time to polish the game. Add
sound effects, music, and visual effects to enhance the game's overall quality.

Final testing and release:

Test the game thoroughly one last time before releasing it to the public. Make any final
adjustments and fixes as necessary. Once everything is working correctly, release the
game to the public.

5.1.1. Tools Used


Front End

• Unity GUI library


1. Unity UI: used to create User Interfaces. It offers wide range of features,
including text, images, buttons, sliders, and more.

27
2. TextMeshPro: is a powerful text rendering tool that offers advanced
typography, text styling, and layout control.

Back End

• C#
C# (pronounced C sharp) is a general-purpose high-level programming
language supporting multiple paradigms. C# encompasses static typing, strong
typing, lexically scoped, imperative, declarative, functional, generic, object-
oriented (class-based), and component-oriented programming disciplines.

Features
1. Simple
2. Modern Programming Language
3. Object oriented
4. Type safe
5. Interoperability
6. Component oriented

Integrated Development Environment (IDE)

• Unity 2021.3.16f1
The Unity Editor enables you to create 2D and 3D games, apps and
experiences. It is very popular game engine and also many game developers
used it for completing their handy projects. So that we’re going to create our
game by using this software. Human Interaction is the major part of any system.
Project look and feels are designed and created so that every player can easily
be interacted with system.

28
Code Editor

• Microsoft Visual Studio 2020


Visual Studio is an Integrated Development Environment(IDE) developed by
Microsoft to develop GUI(Graphical User Interface), console, Web
applications, web apps, mobile apps, cloud, and web services, Games etc.

Audio Editor

• Audacity

Image Editor

• Adobe Photoshop

Video Editor

• Adobe Premiere Pro

5.1.2. Implementation Details of Modules


A modularization consists of well-defined manageable units with well-defined interfaces
among the units. Different modules are design so that debugging and other development
phases get the easiest implementation.

The different modules of the system are:

1. Physics engine: This module is responsible for simulating the physical


interactions between objects in the game world, such as gravity, collisions, and
movement.
2. Character controller: This module is responsible for controlling the movement
of the player character, including jumping, running, and attacking.

29
3. Enemy AI and NPC system: If your game includes non-player characters, you
would need an AI system to control their behavior and interactions with the
player.
4. Level Design: This module would allow you to design and create the levels for
your game, including terrain, obstacles, and enemies.
5. Audio engine: This module would handle the game's sound effects and music.
6. User interface: This module would handle the game's menus, HUD, and other
user interface elements.
7. Animation system: This module would handle the animation of characters and
objects in the game world, bringing them to life and adding visual flair to the
game.
8. Special effects system: This module would handle the game's special effects,
such as explosions, particle effects, and lighting.
9. A* Search Algorithm for Enemy AI: The A* search algorithm is a popular
choice for implementing enemy AI in games because it allows the enemy to
make intelligent decisions about how to move and attack in order to reach their
target, while avoiding obstacles and other hazards.

Steps to implement A* Path Finding Algorithm for Enemy AI


Step 1: Define the game world.
Step 2: Create a game object named it, “A*” and attach the Path Finder script
component for setting the heuristic function.
Step 3: Attach the seeker script component for enemy game object.
Step 4: Create the custom Script for enemy AI and it must have reference of
Path class to generate the path.
Step 5: Move the Enemy AI.
Step 6: Update the Path.

30
Figure 5. 2: Implementation of A* Path Finding Algorithm

Advantages of A* Path Finding Algorithm in Game Development


• A* pathfinding algorithm is popular for game development.
• Advantages include: efficiency, flexibility, real-time performance, scalability,
dynamic obstacle avoidance, path smoothing, accessibility.
• A* can find optimal paths quickly in complex game environments.
• A* is widely used and well-documented, making it easy to implement and
troubleshoot.

5.2. Testing
Testing is the process of determining whether the system works effectively and
efficiently. Testing does not only include debugging. It also checks for quality assurance,
validation and verification, reliability and estimation.

5.2.1. Test Cases for Unit Testing


Unit Testing is the process of checking small pieces of code to ensure that the individual
parts of a program work properly on their own.

Unit Testing 1: Player Controller and Animations

Objective: To ensure that the Player Controller is working as intended and the animations
are running smoothly.

31
Table 5. 1: Test Case for Player Controller and Animations

No. Test Case/Test Script Attribute and Value Expected Result Result
1. Player controller such as Using input manager Player will move Pass
Movement, jumping, to use input keys to according to the
running, and other thing move the player Keys: input provided to
related are working W,A,S,D the input manager
correctly. by the user
2. Player movement such as Using input manager Player movement Pass
movement body, jumping, to determine which feels much more
climbing. animation to play. realistic and natural

Unit Testing 2: Player Combat and Animation

Objective: To ensure that the Player Combat is working as intended and the animation is
running smoothly.

Table 5. 2: Test Case for Player Combat and Animation

No. Test Case/Test Attribute and value Expected Result Result


Script
1. Player Sword Using input manager Player will swing the Pass
attack working to use the mouse sword according to the
correctly. button to swing the input provided to the input
sword. manager by the user.
2. Player Sword Using input manager Sword attack feels much Pass
Attack Animation to determine which more realistic and natural.
working correctly. animation to play.

Unit Testing 3: Selecting Level

Objective: To ensure that the selected level runs, and no error is encountered.

32
Table 5. 3: Test Case for Selecting Level

No. Test Case/Test Script Attribute and value Expected Result


Result
1. Selecting next level from Using input manager to Successfully Pass
level map after completing use the space key to load the level.
the previous one. enter the level.

Unit Testing 4: A* Path Finding Algorithm module

Objective: To ensure that the A* Path Finding Algorithm works properly in Enemy AI,
and no error is encountered.

Table 5. 4: Test Case for Algorithm module

No. Test Case/Test Script Attribute Expected Result Result


and value
1. After game starts Enemy AI Player enters Successfully Pass
consisting A* Script component the level. follow the target.
will follow the target.

5.2.2. Test Cases for System Testing


System Testing is a level of testing that validates the complete and full integrated software
product. It’s purpose is to evaluate the end to end system specification.

System Testing 1: Game Starting

Objective: To verify that the game starts without any errors or crashes.

33
Table 5. 5: Test Case for Game Start

No. Test Case/Test Expected Result Observed Result Result


Script
1. Player load the Game will start without Successfully starting Pass
game. any errors. the game.

System Testing 2: Game Main Menu

Objective: To ensure that the game’s main menu is user friendly and easy to navigate.

Table 5. 6: Test Case for Main Menu

No. Test Expected Result Observed Result Result


Case/Test
Script
1. Game’s main Main menu will have Main menu has user Pass
menu user friendly UI friendly and animated UI
component. component.

System Testing 3: Game’s Checkpoints and Respawn System

Objective: To ensure that the game’s Checkpoint and Respawn System works without
any errors.

Table 5. 7: Test Case for Checkpoint and Respawn System

No. Test Case/Test Expected Result Observed Result Result


Script
1. Game’s After player collides with the Player Pass
Checkpoint checkpoints it will turn to green. successfully get
the checkpoints.

34
2. Respawn Player get the checkpoints and Player respawn Pass
System he died at some point, he will be successfully.
respawn at recent checkpoint.

5.3. Result Analysis


• All the modules of the system are working as expected and the output of the
system is up to expectations.
• Developed game has following features:
1. First level is tutorial based which provide effective tutorial about “How to
play the game”.
2. Further levels introduce new game mechanics, complex Enemy Behavior,
some puzzles, mini bosses etc.
3. Collectibles, obstacles, visual effects, particle system also have been
introduced.
4. Music and SFX also introduced, this help the game environment more
engaging for the player.
• All features are working correctly as expected.
• A* path finding algorithm working as expected on enemy AI.
• All the functional requirements of the proposed system is working as expected.
• User friendly UI helps player to navigate from one scene to another.
• Game Environment has features that provides more engaging and realistic
gameplay for the player.

35
Chapter 6: Conclusion and Recommendation

6.1. Conclusion
In this game, we have implemented Responsive character controlling system, various
types of Enemies AI with different behavior and activities, Checkpoints and Respawn
system, Health system for both enemies and player so they can receive damage, engaging
and realistic Level design, Player reward system like treasure chest and collectibles, Level
Selection System, adding different effects to most of the player’s intractable objects and
also added animations to all of the possible game objects including the user interface.

This game is solely made for the user’s entertainment purpose and it’s principle objective
was to make a game that is similar to old Pixel Art Action-Adventure games but yet to
have modern vibe.

Better user experience is the go-to-goal for every industry related to computer science
including the computer gaming industry of the World. The game will provide the user
with an immersive user interface and a better gameplay.

6.2. Future Recommendation


This game is made for PC/Laptop at the present. There are many scopes available for the
improvement of this game including the additions of other functionalities.

Some of the plans for the future of this application could possibly be:

• To make an Android version.


• Add New levels and introduce new game mechanics.
• To add proper Music, SFX, and VFX.
• Adding NPCs and dialogue system.
• Adding Combo melee attack system for player.
• Adding Evil Wizard as main boss and suitable
• Adding more different enemies in the game.

36
References

[1] K. Eby, “The Power of Iterative Design and Process” January 2, 2019[Online].

Available: https://www.smartsheet.com/iterative-process-guide

[2] J. Jul, “The Design and Play of Platform Games” published in 2010 by MIT Press.

Available: https://www.jesperjuul.net/text

[3] Unity Learn, “Platformer Microgame Template”

Available: https://learn.unity.com/project/2d-platformer-template

[4] Youtube Channels: “gamesplusjames”, “brackeys”, “pandemonium”

Available: https://www.youtube.com/@gamesplusjames

https://www.youtube.com/@PandemoniumGameDev

https://www.youtube.com/@Brackeys

[5] Unity Documentation

Available: https://docs.unity.com/

[6] Sword of Xolan: https://www.alpersarikaya.com/swordofxolan/

[7] Shovel Knight: https://www.yachtclubgames.com/games/shovel-knight-treasure-


trove

[8] Super Mario world – 1990 Developer Interview

Available: https://shmuplations.com/supermarioworld/

37
Appendices

Appendix 1: Screenshots

38
39
Appendix 2: Source Code

MainMenu.cs

void Start()
{
if (PlayerPrefs.HasKey(startScene + "_unlocked"))
{
continueButton.SetActive(true);
}
else
{
continueButton.SetActive(false);
}
}
// Update is called once per frame
void Update()
{

}
public void StartGame()
{
SceneManager.LoadScene(startScene);
PlayerPrefs.DeleteAll();
}
public void ContinueGame()
{
SceneManager.LoadScene(continueScene);
}
public void QuitGame()
{
Application.Quit();
Debug.Log("Quiting Game");

40
}

PlayerCombat.cs

void Start()
{
anim = GetComponent<Animator>();
}
void Update()
{
if (!PauseMenu.instance.isPaused)
{
if (Time.time >= nextAttackTime)
{
if (Input.GetMouseButtonDown(0)&&!PlayerController.instance.OnLadder)
{
//isAttacking = true;
Attack();
nextAttackTime = Time.time + 1f / attackRate;
}
}
}
/*if (!anim.GetCurrentAnimatorStateInfo(0).IsName("Attack"))
{
isAttacking = false;
}*/
}
void Attack()
{
//play an attack animation
anim.SetTrigger("Attack");
AudioManager.instance.PlaySFx(5);

41
//detect all enemies in range of attack
Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position,
attackRange, enemyLayers);
//damage enemy
foreach (Collider2D enemy in hitEnemies)
{
//Debug.Log("We hit" + enemy.name);

// bool facingRight = (transform.position.x < enemy.transform.position.x);


enemy.GetComponent<EnemyHealth>().TakeDamage(attackDamage/*,facingRight,kno
ckbackForce*/);
}
Collider2D[] hitDestructibles = Physics2D.OverlapCircleAll(attackPoint.position,
attackRange, destructibleLayers);
foreach (Collider2D destructible in hitDestructibles)
{
destructible.GetComponent<DestructibleHealth>().TakeDamage();
}
}

42
Enemy AI with A* Path Finding Algorithm (Custom Script that use the reference of
Path.cs)

EnemyAI.cs

using Pathfinding;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyAI : MonoBehaviour


{
public Transform target;
public Transform enemySprite;
public float speed = 200f;
public float nextWayPointDistance = 3f;

Path path;//take the reference from Path Class

int currentWaypoint = 0;
bool reachedEndOfPath = false;

Seeker seeker;//seeker instance for showing the green connector between the source
and target game object
Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
seeker = GetComponent<Seeker>();
rb = GetComponent<Rigidbody2D>();
//reachedEndOfPath = false;
InvokeRepeating("UpdatePath", 0f, .5f);
}
void UpdatePath()

43
{
if (seeker.IsDone())
seeker.StartPath(rb.position, target.position, OnPathComplete);
}
void OnPathComplete(Path p)
{
if (!p.error)
{
path = p;
currentWaypoint = 0;
}
}
// Update is called once per frame
void FixedUpdate()
{
if (path == null)
return;
if (currentWaypoint >= path.vectorPath.Count)
{
reachedEndOfPath = true;
return;
}
else
{
reachedEndOfPath = false;
}
Vector2 direction = ((Vector2)path.vectorPath[currentWaypoint] -
rb.position).normalized;
Vector2 force = direction * speed * Time.deltaTime;
rb.AddForce(force);
float distance = Vector2.Distance(rb.position, path.vectorPath[currentWaypoint]);
if (distance < nextWayPointDistance)

44
{
currentWaypoint++;
}
if (force.x >= 0.01f)
{
enemySprite.localScale = new Vector3(-1f, 1f, 1f);
}
else if (force.x <= -0.01f)
{
enemySprite.localScale = new Vector3(1f, 1f, 1f);
}

45

You might also like