Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
67 views

Project Report FPS GAME Development using unity

Uploaded by

anmol.dube1112
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

Project Report FPS GAME Development using unity

Uploaded by

anmol.dube1112
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

FPS GAME DEVELOPMENT USING UNITY

WITH AI AND SIMULATION


A Project Stage2 Report
Submitted By

AAGAT DIWAN - 1914110454


MOHIT MEHTA - 1914110062
PRATIK PANDEY – 1914110073
HIMANSHU SINGH - 1914110045

In partial fulfilment of the requirement


For the degree of
BACHELOR OF TECHNOLOGY
In
COMPUTER ENGINEERING

Under the guidance of


Prof. M. H. MOLAWADE

DEPARTMENT OF COMPUTER ENGINEERING


BHARATI VIDYAPEETH (DEEMED TO BE)UNIVERSITY,
COLLEGE OF ENGINEERING, PUNE- 43

I
BHARATI VIDYAPEETH (DEEMED TO BE) UNIVERSITY,
COLLEGE OF ENGINEERING, PUNE- 43

CERTIFICATE

This is to certify that the project Stage1 report titled FPS GAME DEVELOPMENT USING
UNITY WITH AI AND SIMULATION, has been carried out by the following students in partial
fulfilment of the degree of BACHELOR OF TECHNOLOGY in Computer Engineering of
Bharati Vidyapeeth (Deemed to be) University Pune, during the academic year 2018-2019.
Team:
1. AAGAT DIWAN (1914110454)
2. MOHIT MEHTA (1914110062)
3. PRATIK PANDEY (1914110073)
4. HIMANSHU SINGH (1914110045)

Prof. M. H. Molawade Prof. Dr. S.B.Vanjale


(Project Guide) Head
Dept. of Computer Engineering

Place: Pune
Date:

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 II


ACKNOWLEDGEMENTS

Success is not only the hard work and innovation but also the inspiration and motivation.
Completing this task was never one-effort. It is the result of invaluable contribution of number of
individuals.

I feel great pleasure to submitting this project report on FPS GAME DEVELOPMENT
USING UNITY WITH AI AND SIMULATION. I wish to express my deep gratitude towards
my project guide whose untiring efforts only, to bring my best out of me. Her timely invaluable
guidance and encouragement enables me to complete this seminar with smart results. Her skillful
guidance makes me as a professional which will very beneficial for my future.

Also thanks to my father, mother, friends & last but not the least my younger sister who
always co-operated me with their ideas and suggestions to make this seminar successful

AAGAT DIWAN (1914110454)


MOHIT MEHTA (1914110062)
PRATIK PANDEY (1914110073)
HIMANSHU SINGH (1914110045)

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 III


ABSTRACT

The project was carried out to develop a 3D game that could be used for fun and as an efficient way of
teaching. The case of the project was a First-Person Shooting Game which the player had to search the
enemies on a terrain map and kill the enemies by shooting. There were a few enemies on the terrain and
they possessed four kinds of Artificial Intelligence (AI). The enemies would discover the player if the
player entered into the range of patrol or shot them, and the enemies made long-range damage to the
player. The player had to slay all enemies to win the game. If the player was slain, then the game was
over. The Health Points (HPs) were used to judge whether the player or enemies died. The player could
restore HPs according to touching the Heal Box or finishing a mission.
The game contains two main game scenes, one is the Graphic User Interfaces (GUI) scene and another
one is the game scene. The player could play on or off the Background Music, view the information of
the controller and the author and start or end this game on the GUI scene. The Skybox, Rigid body and
Terrain were applied into the game. Also an interesting way of damage calculating was used in the game.
The game engine used for the project was Unity 4. Unity 4 was developed by the Unity Technologies. It
is the synthesizing type of a game engine that the designers could use to develop a 3D video game,
visualized constructions and real-time 3D animations. As well Unity is a cross-platform game engine,
which means it supports the building of Windows OS, Mac, iOS, Android, Web, Xbox 360, PS3, Wii,
Flash Player and Google Native Client.
The project demonstrates the basic features of the First-Personal Shooting Game and the process of the
3D game designing with the Unity 4 game engine. Also all assets and scripts are flexible for future
development.

Keywords - 3D Game, First-Person Shooter Game, Unity Game

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 IV


TABLE OF CONTENTS

SR.NO. CHAPTERS PAGE NO.

TITLE PAGE I
CERTIFICATE II
ACKNOWLEDGEMENT III
ABSTRACT IV
LIST OF TABLES V
LIST OF FIGURES VI
CONCLUSION VII
REFRENCES VIII
CHAPTER 1 INTRODUCTION 1-4
1.1 Introduction 1

1.2 Unity 4 1
1.3 History of Video Games 2

1.4 Enhancing Game Experience 2


CHAPTER 2 LITERATURE SURVEY 4

2.1 Literature Review 4


CHAPTER 3 Problem Definition 6
CHAPTER 4 Proposed System 7-9
4.1 Unity 7

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 V


4.2 Prefabs 7
4.3 Observer pattern 8
4.4 Flow chart 9
CHAPTER 5 Major Concepts 10 - 12
5.1 Unity 10
5.1.1 Interface Components 10
5.1.2 Prefabs 10
5.1.3 Game Objects 10
5.1.4 Scripting 11
5.1.5 Animation 11
5.2 FPS 12
CHAPTER 6 AI and SIMULATION 13 – 15
6.1 Train AI agents with reinforcement 13
learning
6.2 Revert shaping 14
6.3 Frame skip 14
6.4 Scenario updates 15
CHAPTER 7 Implication of Game Design 16
CHAPTER 8 Testing 28 - 30
CONCLUSION 31
REFERENCES 32

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43


LIST OF FIGURES

FIG NO. TITLE PAGE NO.

4.1 Flow chart for Observer Pattern 10


7.1 Play Area 25
7.2 Enemies 25
7.3 Weapon Launcher 26
7.4 Player 26
7.5 Gameplay 27
7.6 Controls 27

LIST OF FIGURES
FIG NO. TITLE PAGE NO.

8.1 Test Case Table 30

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 VI


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

CHAPTER 1 - INTRODUCTION

1.1 Introduction
The project was carried out of out to develop a 3D game that could be used for fun and as an
efficient way of teaching. The case of the project was a First-Person Shooting Game which the
player had to search the enemies on a terrain map and kill the enemies by shooting. There were a
few enemies on the terrain and they possessed four kinds of Artificial Intelligence (AI). The
enemies would discover the player if the player entered into the range of patrol or shot them, and
the enemies made long-range damage to the player. The player had to slay all enemies to win the
game. If the player was slain, then the game was over. The Health Points (HPs) were used to judge
whether the player or enemies died. The player could restore HPs according to touching the Heal
Box or finishing a mission. The game contains two main game scenes, one is the Graphic User
Interfaces (GUI) scene and another one is the game scene. The player could play on or off the
Background Music, view the information of the controller and the author and start or end this game
on the GUI scene. The Skybox, Rigid body and Terrain were applied into the game. Also an
interesting way of damage calculating was used in the game.

1.2 Unity 4
The game engine used for the project was Unity 4. Unity 4 was developed by the Unity
Technologies. It is the synthesizing type of a game engine that the designers could use to develop a 3D
video game, visualized constructions and real-time 3D animations. As well Unity is a cross-platform
game engine, which means it supports the building of Windows OS, Mac, iOS, Android, Web, Xbox
360, PS3, Wii, Flash Player and Google Native Client.
The project demonstrates the basic features of the First-Personal Shooting Game and the process of the
3D game designing with the Unity 4 game engine. Also all assets and scripts are flexible for future
development.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 1


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

1.3 History of Video Games


As the U.S enters into the 21st century, the sources of entertainment ranging from music,
sports, and movies have all been expanding in support of consumerism culture . One of the major
industries that have prospered in this time of competition are video game companies. Due to the
global pandemic, more people have been spending their time indoors and subsequently video game
industry giants such as Riot Games, Blizzard, and Epic games have all tried to produce new games
for its audiences in order to maximize their profit . Connected via gaming platforms, the video
game industry is reaching its peak of prosperity generating explosive numbers of concurrent
players and breaking historical records; the scariest thing being that this trend does not seem to be
slowing down anytime soon.
One of the most popular categories of video games that have been played by millions of people
around the world are “FPS''s, or First-Person-Shooter, which are popular among those who enjoy
the combat experience of playing in the 3-dimensional world through the eyes of the character
model. While it is included in part of the sub-genre of shooter games, developers are free to shift
away from the traditional path that focuses solely on combat with a set of firearms and specific
objectives to achieve. They can incorporate their own ideas into the game. Throughout the
development of “Maze Escape'', the game explores the wide range of tools that are available for
developing AIs in video games in an attempt to select the best solutions for recreating multiplayer
experiences.

1.4 Enhancing Game Experience


Reactive systems allow the AI to interact with the player’s decisions and take different actions to
create different experiences for the player. Finite state machines (FSMs) achieve this by having different
states the AI can be in to match different existing scenarios in the game while Behavior tree archives this
by having a set of rules and conditions to guide the decision making process. These systems have allowed
developers to make more complex AI for their games and focus on crafting experiences that are more
interactive. Developers have the ability to create AI experiences equivalent to that of other players.
However, a bad version of AI can often lead to AI taking away the overall enjoyment of the game rather
than adding to it. [Example of a game that has weak AI compared to their multiplayer system. Thus,
developers need good tools to allow them to make good AI.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 2


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

For instance, Unity provides a built-in nav-mesh system for path finding. Pathfinding is the idea in which
the player is able to determine the ideal traveling route to take during the navigational processes that
takes the least amount of time between two points. The Unity Asset stores would be another case in point.
It contains many reactive system tools like
FSMs and Behavior Trees. For example, Candice AI has components for handling player detection and
combat systems for the game AI. Another example would be Breadcrumbs AI . There are also non
character-based AI like Procedural Level Generator, which creates the level around the player
themselves.
Our goal is to create a game in which AI can match up to the experience of multiplayer. The current
methods that are currently available in the game include Navmesh systems and way point systems. First,
there are some good features of the Navmesh system which allows for pathfinding inside the level
generator which prevents the player from walking straight through walls and objects in the environment.
Second, some good features of the way point system is that it allows for the escaper bot to have an
unpredictable route for reaching the end goal which would imitate that of a real player style of playing
the game; filled with randomness and does not conform to a fixed way of playing the game. The way
point systems generate different routes for the escaper AI bot to take to reach the end goal. When the
game starts the way point system will randomly choose a path for the AI to take out of the many the
developers had encoded into the system. Thus, we believe that using these simple tools we can at least
get close to emulate multiplayer experience in a single player environment. Our system is a synthesis of
the Nav-mesh system and the way point system allowing them to work together for pathfinding while
other tools keep them separated.
In two application scenarios, we demonstrate how the above combination of techniques increases the
accuracy or the imitation for the ability of the AI to mimic the multiplayer experience.
First, we demonstrate the usefulness of our approach by a comprehensive case study on the competitive
AI compared to the competitive player in which the player has to play against one other opponent either
AI or another player in a 1v1 game mode of Maze Escape in which one act as the “Defender” and the
other as the “Escaper”. Second, we try to analyze the result of our 1v1 competitive AI to a competitive
player with a cooperative AI compared to a cooperative player.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 3


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Chapter 2 - Literature Survey

2.1 Literature Review


FPS (First-Person Shooter) games have gained immense popularity in the gaming industry,
providing players with immersive experiences and challenging gameplay. As the demand for more
realistic and engaging AI opponents in FPS games grows, developers have turned to advanced
techniques and tools to create intelligent and dynamic virtual adversaries. This literature review
explores the existing research and developments in FPS game development using Unity with a
focus on AI and simulation.

• AI in FPS Games:
The incorporation of AI in FPS games has been a critical aspect of creating engaging and
challenging gameplay experiences. AI opponents are expected to exhibit intelligent behavior,
adapt to player actions, and provide a level of challenge comparable to human players.
Researchers have explored various approaches to achieve this, including reactive systems, finite
state machines (FSMs), behavior trees, and machine learning algorithms.
• Reactive Systems:
Reactive systems allow AI opponents to interact with player decisions and take
different actions to create diverse experiences. By leveraging reactive systems, developers
can design AI opponents that respond dynamically to changing circumstances and provide a
more immersive gameplay experience. These systems often utilize FSMs or behavior trees
to govern AI decision-making processes.
• Finite State Machines (FSMs):
FSMs have been widely used in game development to model AI behavior. FSMs
consist of different states representing various scenarios or actions, enabling AI opponents
to transition between states based on predefined conditions. This approach provides
developers with a structured framework to create AI behaviors that align with specific
gameplay situations, such as combat, exploration, or evasion.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 4


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

• Unity as a Development Framework:


Unity, a popular game development platform, provides a range of tools and features that aid
in FPS game development. The built-in nav-mesh system offered by Unity allows for
efficient pathfinding, ensuring AI opponents navigate the game environment without
colliding with obstacles. Additionally, the Unity Asset Store provides a vast collection of
resources, including AI packages, FSMs, behavior trees, and procedural level generators,
enabling developers to enhance their game's AI capabilities.
• Simulation and Realism:
Simulation plays a crucial role in FPS game development, allowing developers to create
realistic virtual environments and AI opponents. Advanced physics engines, realistic
animations, and dynamic AI behaviors contribute to an immersive and authentic gameplay
experience. Researchers have focused on integrating simulation techniques to enhance the
AI opponents' realism, including advanced perception systems, strategic decision-making
algorithms, and natural language processing for communication.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 5


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Chapter 3 - Problem Definition

FPS (First-Person Shooter) games are highly popular in the gaming industry, offering players
immersive and thrilling experiences. However, one common challenge faced by developers is
creating AI opponents that can match the complexity and enjoyment provided by multiplayer
gameplay. While multiplayer modes allow for dynamic interactions between human players, the
AI opponents in single-player modes often lack the same level of adaptability and unpredictability.
The existing AI systems used in FPS games, such as reactive systems, finite state machines
(FSMs), and behavior trees, have significantly improved the intelligence and decision-making
capabilities of AI opponents. These systems enable AI opponents to interact with player decisions
and take different actions, creating diverse experiences. However, the effectiveness of these AI
systems varies, and in some cases, they can take away from the overall enjoyment of the game
rather than enhancing it. In addition, the current tools and techniques available for AI development
in Unity, a widely used game development platform, often require significant manual effort and
expertise. While Unity provides a built-in nav-mesh system for pathfinding and the Unity Asset
Store offers various AI packages and tools, developers still face challenges in creating AI
opponents that can mimic the multiplayer experience in single-player environments.
Therefore, the problem addressed in this study is the need for improved AI systems and tools in
FPS game development using Unity to enable AI opponents that match the experience and
complexity of multiplayer gameplay. This includes the need for AI opponents that exhibit adaptive
and unpredictable behaviors, enhance player engagement, and provide challenging encounters in
single-player modes. Additionally, there is a need for more efficient and user-friendly tools within
Unity to facilitate the development of intelligent and dynamic AI opponents, reducing the manual
effort and expertise required. Addressing this problem will not only enhance the gameplay
experience for single-player FPS games but also provide developers with better tools and
techniques to create immersive and engaging AI opponents. By bridging the gap between single-
player and multiplayer experiences, players can enjoy challenging encounters and dynamic
gameplay, even in the absence of human opponents.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 6


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Chapter 4 - Proposed System

To address the challenges outlined in the problem statement, we propose the development of an
enhanced AI system for FPS games using Unity. The proposed system aims to provide AI
opponents in single-player modes that can closely match the experience and complexity of
multiplayer gameplay. The system will leverage existing AI techniques and tools, while also
introducing novel approaches to enhance the adaptability, unpredictability, and engagement of AI
opponents.

4.1 Unity
Unity is a cross-platform game engine initially released by Unity Technologies, in 2005. The focus
of Unity lies in the development of both 2D and 3D games and interactive content. Unity now
supports over 20 different target platforms for deploying, while its most popular platforms are the
PC, Android and iOS systems. Unity features a complete toolkit for designing and building games,
including interfaces for graphics, audio, and level-building tools, requiring minimal use of
external programs to work on projects. To create content with Unity, the main requirement is to
download the Unity engine and development environment. Along with the core engine, you may
also download optional modules for deploying to various different platforms, as well as tools for
integrating Unity scripting into Visual Studio. Unity is equally suited for both 2D and 3D games.
All games made in Unity start out as Projects from the Startup Screen.

4.2 PREFABS
Prefab is short for “prefabricated,” which means “made beforehand,” and not “before fabulous.”
Prefab things are made in sections that can be easily shipped and put together to form a finished
product. Some buildings and houses are prefab. Prefab can be used as a noun or adjective. When
you talk about a cool prefab you saw downtown, you mean a prefabricated building, one that was
built from parts that were shipped and quickly assembled. Prefab shelters have been made from
converted shipping containers. Some furniture is sold this way, too, like a prefab bookshelf in flat
box that contain sections you can take home and put together easily. Or so say the directions.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 7


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

4.3 Observer Pattern


In software design and engineering, the observer pattern is a software design pattern in which an
object, named the subject, maintains a list of its dependents, called observers, and notifies them
automatically of any state changes, usually by calling one of their methods. It is often used for
implementing distributed event-handling systems in event-driven software. In such systems, the
subject is usually named a "stream of events" or "stream source of events" while the observers are
called "sinks of events." The stream nomenclature alludes to a physical setup in which the
observers are physically separated and have no control over the emitted events from the
subject/stream source. This pattern thus suits any process by which data arrives from some input
that is not available to the CPU at startup, but instead arrives seemingly at random (HTTP requests,
GPIO data, user input from peripherals, distributed databases and blockchains, etc.).
Most modern programming languages comprise built-in event constructs implementing the
observer-pattern components. While not mandatory, most observer implementations use
background threads listening for subject events and other support mechanisms provided by the
kernel.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 8


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

4.4 Flow Diagram

Figure 4.1 Flow chart for Observer Pattern

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 9


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Chapter 5 – MAJOR CONCEPTS

5.1 UNITY
Unity is a cross-platform game engine initially released by Unity Technologies, in 2005. The focus
of Unity lies in the development of both 2D and 3D games and interactive content. Unity now
supports over 20 different target platforms for deploying, while its most popular platforms are the
PC, Android and iOS systems.

5.1.1 INTERFACE COMPONENTS


When designing your interface, try to be consistent and predictable in your choice of interface
elements. Whether they are aware of it or not, users have become familiar with elements acting
in a certain way, so choosing to adopt those elements when appropriate will help with task
completion, efficiency, and satisfaction.

5.1.2 PREFABS

Prefab is short for “prefabricated,” which means “made beforehand,” and not “before
fabulous.” Prefab things are made in sections that can be easily shipped and put together to
form a finished product. Some buildings and houses are prefab

5.1.3 GAME OBJECTS


• Pickup launcher
• Anime hoverbot
• Anime purret
• Pickup health
• Pickup shotgun
• Loot jet pack
• Player
• Room 1
• Room 2
• Opening 1
• Opening 2

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 10


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

5.1.4 SCRIPTING

Scripting is an essential ingredient in all applications you make in Unity. Most applications
need scripts to respond to input from the player and to arrange for events in the gameplay
to happen when they should. Beyond that, scripts can be used to create graphical effects,
control the physical behavior of objects or even implement a custom AI system for
characters in the game. Scripting tells our GameObjects how to behave; it’s the scripts and
components attached to the GameObjects, and how they interact with each other, that
creates your gameplay. Now, scripting in Unity is different from pure programming. If
you’ve done some pure programming, e.g. you created a running app, you should realize
that in Unity you don’t need to create the code that runs the application, because Unity does
it for you. Instead, you focus on the gameplay in your scripts. Unity runs in a big loop. It
reads all of the data that’s in a game scene. For example, it reads through the lights, the
meshes, what the behaviors are, and it processes all of this information for you.

5.1.5 ANIMATION
Unity’s Animation features include retargetable animations, full control of animation weights
at runtime, event calling from within the animation playback, sophisticated state machine
hierarchies and transitions, blend shapes for facial animations, and much more. Animation is
one among the two components of a game, which brings it to life (the other being audio).
Unity’s animation system is called Mechanism, and its power lies in bring humanoid models
to life. In previous versions, another component called “Animation” was used, but it has now
been depreciated in the recent versions of Unity.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 11


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

5.2 FPS
The first-person shooter genre has been traced back to Wolfenstein 3D (1992), which has been
credited with creating the genre's basic archetype upon which subsequent titles were based. One
such title, and the progenitor of the genre's wider mainstream acceptance and popularity, was
Doom (1993), often considered the most influential game in this genre; for some years, the term
Doom clone was used to designate this genre due to Doom's influence. Corridor shooter was
another common name for the genre in its early years, since processing limitations of the era's
hardware. meant that most of the action in the games had to take place in enclosed areas, such as
in cramped spaces like corridors and tunnels. 1998's Half-Life—along with its 2004 sequel Half-
Life 2—enhanced the narrative and puzzle elements. In 1999, the Half-Life mod Counter-Strike
was released and, together with Doom, is perhaps one of the most influential first-person shooters.
GoldenEye 007, released in 1997, was a landmark first-person shooter for home consoles, while
the Halo series heightened the console's commercial and critical appeal as a platform for first-
person shooter titles. In the 21st century, the first-person shooter is the most commercially viable
video game genre, and in 2016, shooters accounted for over 27% of all video game sales. The
early FPS games were developed in the early 1970s. Some of the first FPS games were Maze War,
Far Cry. They are unlike third – person shooters in which the player can see (usually from behind)
the character they are controlling.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 12


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Chapter 6 - AI AND SIMULATION

The most challenging task of all was figuring out how to have the AI behave and have objectives similar
to those of a real player. Despite the inclusion of the random way points that were intended to prevent
fixed AI behaviour from happening, there was a problem with the escaper bots not heading toward the
ultimate objective and also picking the same course. Furthermore, we had trouble adding the "wandering"
feature to have the defender bots move around the level because they were unresponsive and remained
stationary the entire time the game was played. The latter two problems were caused by the escapees not
attempting to flee from the defender when it widened its field of vision and just stood there.

6.1 TRAIN AI AGENTS WITH REINFORCEMENT LEARNING


Reinforcement learning is a subfield of machine learning that you can use to train a software
agent to behave rationally in an environment. The agent is rewarded based on the actions it
takes within the environment. One example of learning comes from 1992, when IBM's Gerry
Tesauro used reinforcement learning to build a self-learning backgammon player. This article
explores reinforcement learning, some problem areas to which you can apply it, and
demonstrates the technology by using a simple simulation. Many algorithms in machine
learning fall into one of two categories: unsupervised or supervised learning. In unsupervised
learning, an algorithm separates the unlabeled data into groups based on their underlying
structure, which makes the data understandable. An example of unsupervised learning is the
k-means clustering algorithm, which partitions data into clusters with the nearest mean. On
the other side of the spectrum is supervised learning. In supervised learning, a set of input
variables is mapped to a predefined set of output variables through a mapping function (with
the goal of approximating new input data for prediction). This process is categorized as
supervised because an algorithm uses the input data and output data to train a mapping
function. Neural networks are an example of supervised learning.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 13


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

6.2 Revert Shaping


The revert Shaping CSS keyword reverts the cascaded value of the property from its current
value to the value the property would have had if no changes had been made by the current
style origin to the current element. Thus, it resets the property to its inherited value if it inherits
from its parent or to the default value established by the user agent's stylesheet (or by user
styles, if any exist). It can be applied to any CSS property, including the CSS shorthand
property all.

6.3 Frame skip


Frame skip is the number of frames an action is repeated before a new action is selected.
Existing reinforcement learning (RL) approaches use static frame skip: HNEAT (Hausknecht
et al. 2013) uses a frame skip of 0; DQN (Mnih et al. 2013) uses a frame skip of 2-3; SARSA
and planning approaches (Bellemare et al. 2013) use a frame skip of 4. When action selection
is computationally intensive, setting a higher frame skip can significantly decrease the time it
takes to simulate an episode, at the cost of missing opportunities that only exist at a finer
resolution. A large frame skip can also prevent degenerate super-human-reflex strategies, such
as those described by Hausknecht et al. for Bowling, Kung Fu Master, Video Pinball and Beam
Rider. We show that in addition to these advantages agents that act with high frame skip can
actually learn faster with respect to the number of training episodes than those that skip no
frames. We present results for six of the seven games covered by Mnih et al.: three (Beam
Rider, Breakout and Pong) for which DQN was able to achieve near- or superhuman
performance, and three (Q*Bert, Space Invaders and Seaquest) for which all RL approaches
are far from human performance. These latter games were understood to be difficult because
they require ‘strategy that extends over long time scales.’ In our experiments, setting a large
frame skip was critical to achieving state-of-the-art performance in two of these games: Space
Invaders and Q*Bert. More generally, the frame skip parameter was a strong determinant of
performance in all six games.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 14


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

6.4 Scenario Updates


Scenario’s are long-term tests comprised of several tasks. They are usually explicitly stated to
a player, whether through story or as formal win conditions. Some games only have one
scenario, such as Scrabble or Space Invaders. However videogames often have several
scenarios, which are collectively grouped as campaigns. God of War places the player in
several settings, each with a scenario to overcome before a cut scene moves the story to a new
location. Winning a match in tennis or completing a series of connected goals in CityVille are
others examples of scenarios. Games use many names to describe scenarios such as mission,
quest, episode, stage, world or chapter.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 15


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Chapter 7 - Implication of game design

Code –
using System.Collections.Generic;
using Unity.FPS.Game;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;

namespace Unity.FPS.AI
{
[RequireComponent(typeof(Health), typeof(Actor), typeof(NavMeshAgent))]
public class EnemyController : MonoBehaviour
{
[System.Serializable]
public struct RendererIndexData
{
public Renderer Renderer;
public int MaterialIndex;

public RendererIndexData(Renderer renderer, int index)


{
Renderer = renderer;
MaterialIndex = index;
}
}

[Header("Parameters")]
[Tooltip("The Y height at which the enemy will be automatically killed (if it falls off of the level)")]
public float SelfDestructYHeight = -20f;

[Tooltip("The distance at which the enemy considers that it has reached its current path destination point")]
public float PathReachingRadius = 2f;

[Tooltip("The speed at which the enemy rotates")]


public float OrientationSpeed = 10f;

[Tooltip("Delay after death where the GameObject is destroyed (to allow for animation)")]
public float DeathDuration = 0f;

[Header("Weapons Parameters")] [Tooltip("Allow weapon swapping for this enemy")]


public bool SwapToNextWeapon = false;

[Tooltip("Time delay between a weapon swap and the next attack")]


public float DelayAfterWeaponSwap = 0f;

[Header("Eye color")] [Tooltip("Material for the eye color")]


public Material EyeColorMaterial;

[Tooltip("The default color of the bot's eye")] [ColorUsageAttribute(true, true)]


public Color DefaultEyeColor;

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 16


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

[Tooltip("The attack color of the bot's eye")] [ColorUsageAttribute(true, true)]


public Color AttackEyeColor;

[Header("Flash on hit")] [Tooltip("The material used for the body of the hoverbot")]
public Material BodyMaterial;

[Tooltip("The gradient representing the color of the flash on hit")] [GradientUsageAttribute(true)]


public Gradient OnHitBodyGradient;

[Tooltip("The duration of the flash on hit")]


public float FlashOnHitDuration = 0.5f;

[Header("Sounds")] [Tooltip("Sound played when recieving damages")]


public AudioClip DamageTick;

[Header("VFX")] [Tooltip("The VFX prefab spawned when the enemy dies")]


public GameObject DeathVfx;

[Tooltip("The point at which the death VFX is spawned")]


public Transform DeathVfxSpawnPoint;

[Header("Loot")] [Tooltip("The object this enemy can drop when dying")]


public GameObject LootPrefab;

[Tooltip("The chance the object has to drop")] [Range(0, 1)]


public float DropRate = 1f;

[Header("Debug Display")] [Tooltip("Color of the sphere gizmo representing the path reaching range")]
public Color PathReachingRangeColor = Color.yellow;

[Tooltip("Color of the sphere gizmo representing the attack range")]


public Color AttackRangeColor = Color.red;

[Tooltip("Color of the sphere gizmo representing the detection range")]


public Color DetectionRangeColor = Color.blue;

public UnityAction onAttack;


public UnityAction onDetectedTarget;
public UnityAction onLostTarget;
public UnityAction onDamaged;

List<RendererIndexData> m_BodyRenderers = new List<RendererIndexData>();


MaterialPropertyBlock m_BodyFlashMaterialPropertyBlock;
float m_LastTimeDamaged = float.NegativeInfinity;

RendererIndexData m_EyeRendererData;
MaterialPropertyBlock m_EyeColorMaterialPropertyBlock;

public PatrolPath PatrolPath { get; set; }


public GameObject KnownDetectedTarget => DetectionModule.KnownDetectedTarget;
public bool IsTargetInAttackRange => DetectionModule.IsTargetInAttackRange;
public bool IsSeeingTarget => DetectionModule.IsSeeingTarget;
public bool HadKnownTarget => DetectionModule.HadKnownTarget;
public NavMeshAgent NavMeshAgent { get; private set; }
public DetectionModule DetectionModule { get; private set; }

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 17


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

int m_PathDestinationNodeIndex;
EnemyManager m_EnemyManager;
ActorsManager m_ActorsManager;
Health m_Health;
Actor m_Actor;
Collider[] m_SelfColliders;
GameFlowManager m_GameFlowManager;
bool m_WasDamagedThisFrame;
float m_LastTimeWeaponSwapped = Mathf.NegativeInfinity;
int m_CurrentWeaponIndex;
WeaponController m_CurrentWeapon;

WeaponController[] m_Weapons;
NavigationModule m_NavigationModule;

void Start()
{
m_EnemyManager = FindObjectOfType<EnemyManager>();
DebugUtility.HandleErrorIfNullFindObject<EnemyManager, EnemyController>(m_EnemyManager, this);

m_ActorsManager = FindObjectOfType<ActorsManager>();
DebugUtility.HandleErrorIfNullFindObject<ActorsManager, EnemyController>(m_ActorsManager, this);

m_EnemyManager.RegisterEnemy(this);

m_Health = GetComponent<Health>();
DebugUtility.HandleErrorIfNullGetComponent<Health, EnemyController>(m_Health, this, gameObject);

m_Actor = GetComponent<Actor>();
DebugUtility.HandleErrorIfNullGetComponent<Actor, EnemyController>(m_Actor, this, gameObject);

NavMeshAgent = GetComponent<NavMeshAgent>();
m_SelfColliders = GetComponentsInChildren<Collider>();

m_GameFlowManager = FindObjectOfType<GameFlowManager>();
DebugUtility.HandleErrorIfNullFindObject<GameFlowManager, EnemyController>(m_GameFlowManager,
this);

// Subscribe to damage & death actions


m_Health.OnDie += OnDie;
m_Health.OnDamaged += OnDamaged;

// Find and initialize all weapons


FindAndInitializeAllWeapons();
var weapon = GetCurrentWeapon();
weapon.ShowWeapon(true);

var detectionModules = GetComponentsInChildren<DetectionModule>();


DebugUtility.HandleErrorIfNoComponentFound<DetectionModule,
EnemyController>(detectionModules.Length, this,
gameObject);
DebugUtility.HandleWarningIfDuplicateObjects<DetectionModule,
EnemyController>(detectionModules.Length,
this, gameObject);
// Initialize detection module
DetectionModule = detectionModules[0];
DetectionModule.onDetectedTarget += OnDetectedTarget;
DetectionModule.onLostTarget += OnLostTarget;
onAttack += DetectionModule.OnAttack;

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 18


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

var navigationModules = GetComponentsInChildren<NavigationModule>();


DebugUtility.HandleWarningIfDuplicateObjects<DetectionModule,
EnemyController>(detectionModules.Length,
this, gameObject);
// Override navmesh agent data
if (navigationModules.Length > 0

{
m_NavigationModule = navigationModules[0];
NavMeshAgent.speed = m_NavigationModule.MoveSpeed;
NavMeshAgent.angularSpeed = m_NavigationModule.AngularSpeed;
NavMeshAgent.acceleration = m_NavigationModule.Acceleration;
}

foreach (var renderer in GetComponentsInChildren<Renderer>(true))


{
for (int i = 0; i < renderer.sharedMaterials.Length; i++)
{
if (renderer.sharedMaterials[i] == EyeColorMaterial)
{
m_EyeRendererData = new RendererIndexData(renderer, i);
}

if (renderer.sharedMaterials[i] == BodyMaterial)
{
m_BodyRenderers.Add(new RendererIndexData(renderer, i));
}
}
}

m_BodyFlashMaterialPropertyBlock = new MaterialPropertyBlock();

// Check if we have an eye renderer for this enemy


if (m_EyeRendererData.Renderer != null)
{
m_EyeColorMaterialPropertyBlock = new MaterialPropertyBlock();
m_EyeColorMaterialPropertyBlock.SetColor("_EmissionColor", DefaultEyeColor);
m_EyeRendererData.Renderer.SetPropertyBlock(m_EyeColorMaterialPropertyBlock,
m_EyeRendererData.MaterialIndex);
}
}

void Update()
{
EnsureIsWithinLevelBounds();

DetectionModule.HandleTargetDetection(m_Actor, m_SelfColliders);

Color currentColor = OnHitBodyGradient.Evaluate((Time.time - m_LastTimeDamaged) /


FlashOnHitDuration);
m_BodyFlashMaterialPropertyBlock.SetColor("_EmissionColor", currentColor);
foreach (var data in m_BodyRenderers)
{
data.Renderer.SetPropertyBlock(m_BodyFlashMaterialPropertyBlock, data.MaterialIndex);
}

m_WasDamagedThisFrame = false;
}

void EnsureIsWithinLevelBounds()

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 19


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION
{
// at every frame, this tests for conditions to kill the enemy
if (transform.position.y < SelfDestructYHeight)
{
Destroy(gameObject);
return;
}
}

void OnLostTarget()
{
onLostTarget.Invoke();

// Set the eye attack color and property block if the eye renderer is set
if (m_EyeRendererData.Renderer != null)

{
m_EyeColorMaterialPropertyBlock.SetColor("_EmissionColor", DefaultEyeColor);
m_EyeRendererData.Renderer.SetPropertyBlock(m_EyeColorMaterialPropertyBlock,
m_EyeRendererData.MaterialIndex);
}
}

void OnDetectedTarget()
{
onDetectedTarget.Invoke();

// Set the eye default color and property block if the eye renderer is set
if (m_EyeRendererData.Renderer != null)
{
m_EyeColorMaterialPropertyBlock.SetColor("_EmissionColor", AttackEyeColor);
m_EyeRendererData.Renderer.SetPropertyBlock(m_EyeColorMaterialPropertyBlock,
m_EyeRendererData.MaterialIndex);
}
}

public void OrientTowards(Vector3 lookPosition)


{
Vector3 lookDirection = Vector3.ProjectOnPlane(lookPosition - transform.position,
Vector3.up).normalized;
if (lookDirection.sqrMagnitude != 0f)
{
Quaternion targetRotation = Quaternion.LookRotation(lookDirection);
transform.rotation =
Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * OrientationSpeed);
}
}

bool IsPathValid()
{
return PatrolPath && PatrolPath.PathNodes.Count > 0;
}

public void ResetPathDestination()


{
m_PathDestinationNodeIndex = 0;
}

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 20


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

public void SetPathDestinationToClosestNode()


{
if (IsPathValid())
{
int closestPathNodeIndex = 0;
for (int i = 0; i < PatrolPath.PathNodes.Count; i++)
{
float distanceToPathNode = PatrolPath.GetDistanceToNode(transform.position, i);
if (distanceToPathNode < PatrolPath.GetDistanceToNode(transform.position,
closestPathNodeIndex))
{
closestPathNodeIndex = i;
}
}

m_PathDestinationNodeIndex = closestPathNodeIndex;
}
else
{
m_PathDestinationNodeIndex = 0;
}

public Vector3 GetDestinationOnPath()


{
if (IsPathValid())
{
return PatrolPath.GetPositionOfPathNode(m_PathDestinationNodeIndex);
}
else
{
return transform.position;
}
}

public void SetNavDestination(Vector3 destination)


{
if (NavMeshAgent)
{
NavMeshAgent.SetDestination(destination);
}
}

public void UpdatePathDestination(bool inverseOrder = false)


{
if (IsPathValid())
{
// Check if reached the path destination
if ((transform.position - GetDestinationOnPath()).magnitude <= PathReachingRadius)
{
// increment path destination index
m_PathDestinationNodeIndex =
inverseOrder ? (m_PathDestinationNodeIndex - 1) : (m_PathDestinationNodeIndex + 1);
if (m_PathDestinationNodeIndex < 0)

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 21


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION
{
m_PathDestinationNodeIndex += PatrolPath.PathNodes.Count;
}

if (m_PathDestinationNodeIndex >= PatrolPath.PathNodes.Count)


{
m_PathDestinationNodeIndex -= PatrolPath.PathNodes.Count;
}
}
}
}

void OnDamaged(float damage, GameObject damageSource)


{
// test if the damage source is the player
if (damageSource && !damageSource.GetComponent<EnemyController>())
{
// pursue the player
DetectionModule.OnDamaged(damageSource);

onDamaged?.Invoke();
m_LastTimeDamaged = Time.time;

// play the damage tick sound


if (DamageTick && !m_WasDamagedThisFrame)
AudioUtility.CreateSFX(DamageTick, transform.position, AudioUtility.AudioGroups.DamageTick, 0f);

m_WasDamagedThisFrame = true;
}
}

void OnDie()
{
// spawn a particle system when dying
var vfx = Instantiate(DeathVfx, DeathVfxSpawnPoint.position, Quaternion.identity);
Destroy(vfx, 5f);

// tells the game flow manager to handle the enemy destuction


m_EnemyManager.UnregisterEnemy(this);

// loot an object
if (TryDropItem())
{
Instantiate(LootPrefab, transform.position, Quaternion.identity);
}

// this will call the OnDestroy function


Destroy(gameObject, DeathDuration);
}

void OnDrawGizmosSelected()
{
// Path reaching range
Gizmos.color = PathReachingRangeColor;
Gizmos.DrawWireSphere(transform.position, PathReachingRadius);

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 22


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

if (DetectionModule != null)
{
// Detection range
Gizmos.color = DetectionRangeColor;
Gizmos.DrawWireSphere(transform.position, DetectionModule.DetectionRange);

// Attack range
Gizmos.color = AttackRangeColor;
Gizmos.DrawWireSphere(transform.position, DetectionModule.AttackRange);
}
}

public void OrientWeaponsTowards(Vector3 lookPosition)


{
for (int i = 0; i < m_Weapons.Length; i++)
{
// orient weapon towards player
Vector3 weaponForward = (lookPosition - m_Weapons[i].WeaponRoot.transform.position).normalized;
m_Weapons[i].transform.forward = weaponForward;
}
}

public bool TryAtack(Vector3 enemyPosition)


{
if (m_GameFlowManager.GameIsEnding)
return false;

OrientWeaponsTowards(enemyPosition);

if ((m_LastTimeWeaponSwapped + DelayAfterWeaponSwap) >= Time.time)


return false;

// Shoot the weapon


bool didFire = GetCurrentWeapon().HandleShootInputs(false, true, false);

if (didFire && onAttack != null)


{
onAttack.Invoke();

if (SwapToNextWeapon && m_Weapons.Length > 1)


{
int nextWeaponIndex = (m_CurrentWeaponIndex + 1) % m_Weapons.Length;
SetCurrentWeapon(nextWeaponIndex);
}
}

return didFire;
}

public bool TryDropItem()


{
if (DropRate == 0 || LootPrefab == null)
return false;
else if (DropRate == 1)
return true;

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 23


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

else
return (Random.value <= DropRate);
}

void FindAndInitializeAllWeapons()
{
// Check if we already found and initialized the weapons
if (m_Weapons == null)
{
m_Weapons = GetComponentsInChildren<WeaponController>();
DebugUtility.HandleErrorIfNoComponentFound<WeaponController,
EnemyController>(m_Weapons.Length, this,
gameObject);

for (int i = 0; i < m_Weapons.Length; i++)


{
m_Weapons[i].Owner = gameObject;
}
}
}

public WeaponController GetCurrentWeapon()


{
FindAndInitializeAllWeapons();
// Check if no weapon is currently selected
if (m_CurrentWeapon == null)
{
// Set the first weapon of the weapons list as the current weapon
SetCurrentWeapon(0);
}

DebugUtility.HandleErrorIfNullGetComponent<WeaponController, EnemyController>(m_CurrentWeapon,
this,
gameObject);

return m_CurrentWeapon;
}

void SetCurrentWeapon(int index)

{
m_CurrentWeaponIndex = index;
m_CurrentWeapon = m_Weapons[m_CurrentWeaponIndex];
if (SwapToNextWeapon)
{
m_LastTimeWeaponSwapped = Time.time;
}
else
{
m_LastTimeWeaponSwapped = Mathf.NegativeInfinity;
}
}
}
}

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 24


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

SCREENSHOTS

Figure 7.1 Play Area

Figure 7.2 Enemies

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 25


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Figure 7.3 Weapon Launcher

Figure 7.4 Player

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 26


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Figure 7.5 Gameplay

Figure 7.6 Controls

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 27


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Chapter 8 – TESTING

Testing of the FPS shooting game involved a comprehensive evaluation of its functionality, performance,
and user experience. The testing process aimed to identify and address any bugs, glitches, or design flaws
that could affect the game's stability and gameplay.

1. Functionality Testing:

• Game Mechanics: Testers ensured that all game mechanics, such as player movement, enemy
AI behaviour, shooting accuracy, and health point calculation, worked as intended.
• Object Interactions: Interactions between the player and various in-game objects, such as heal
boxes and mission triggers, were tested to ensure they functioned correctly.
• Enemy AI: The behaviour of enemies in different scenarios, such as patrolling, detecting the
player, and engaging in combat, was tested to verify the AI's effectiveness and responsiveness.
• Game Progression: Testers verified that the game progressed appropriately based on the player's
actions, such as defeating enemies and completing missions.

2. Performance Testing:
• Frame Rate: The game's frame rate was measured to ensure smooth and consistent gameplay
across different hardware configurations.
• Memory Usage: Testers monitored the game's memory usage to identify any excessive memory
leaks or inefficient resource management.
• Loading Times: Loading times for different game scenes and assets were evaluated to ensure
optimal performance and minimise player frustration.

3. User Experience Testing:


• Controls and Input: Testers assessed the responsiveness and intuitiveness of the game's controls,
including keyboard/mouse or gamepad inputs, to ensure a smooth and enjoyable gameplay
experience.
• Graphics and Visuals: The quality and visual appeal of the game's graphics, including textures,
lighting, and visual effects, were evaluated to enhance immersion and overall player satisfaction.
• Audio: Testers checked the audio elements, including background music, sound effects, and
voiceovers, to ensure they were synchronised correctly and contributed to the game's
atmosphere.
• User Interface: The usability and clarity of the game's GUI scene, including menu navigation,
settings options, and information displays, were tested for ease of use and understanding.

4. Compatibility Testing:
• Platforms: The game was tested on various target platforms (e.g., Windows, Mac, iOS, Android)
to ensure compatibility and functionality across different devices and operating systems.
• Hardware Configurations: Testers validated the game's performance on different hardware
setups to identify any issues related to specific graphics cards, processors, or other hardware
components.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 28


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

Test Test Test Steps Expected Actual Result Pass/Fail


Case Description Result
ID
TC001 Player 1. Move the player Player moves Player moves Pass
Movement character using smoothly and smoothly and
different input methods accurately accurately

TC002 Enemy AI 1. Observe enemy AI Enemies patrol, Enemy AI Pass


Behavior behavior in different detect player, and functions as
scenarios engage in combat expected

TC003 Shooting 1. Shoot enemies from Bullets hit the Bullets hit the Pass
Accuracy varying distances and target accurately target accurately
angles

TC004 Health Point 1. Player takes damage Player health Player health Pass
Calculation from enemy attacks decreases based points decrease
on the damage as expected
received

TC005 Interacting 1. Player character Player's health Player's health Pass


with Heal Box touches the Heal Box points increase points increase

TC006 Mission 1. Player completes a Mission status Mission Pass


Completion mission updates, progress completes
to next mission successfully

TC007 Game 1. Defeat all enemies Game ends with Game ends with Pass
Progression required to win the victory screen victory screen
game

TC008 Game 1. Test various GUI GUI elements GUI elements Pass
Mechanics - elements and options function correctly function
GUI and provide correctly and
desired options provide desired
options

TC009 Frame Rate 1. Monitor and record Game runs Game maintains Pass
game's frame rate smoothly with consistent frame
consistent frame rate
rate
TC010 Loading Times 1. Measure loading Reasonable Loading times Pass
times for different loading times for within
game scenes smooth transition acceptable range

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 29


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

TC011 Controls and 1. Test game Controls are Controls are responsive Pass
Input controls with responsive and and intuitive
different input intuitive
devices
TC012 Graphics and 1. Evaluate Graphics are Graphics are visually Pass
Visuals the quality visually appealing appealing and enhance
and visual and enhance immersion
appeal of immersion
game graphics
TC013 Audio 1. Test Audio elements Audio elements Pass
background synchronized and synchronized and
music, sound contribute to game contribute to game
effects, and atmosphere atmosphere
voiceovers
TC014 User 1. Navigate GUI is user- GUI is user-friendly and Pass
Interface GUI, access friendly and provides necessary
settings, and provides necessary information
view information
information
TC015 Platform 1. Test game Game runs Game runs smoothly Pass
Compatibility functionality smoothly and and functions correctly
on different functions correctly on all tested platforms
platforms on all tested
platforms
TC016 Multiplayer 1. Test Multiplayer Multiplayer features Pass
Stability and multiplayer features work well work well with minimal
Experience functionality, with minimal latency
(if observe latency
applicable) network
stability

Table 8.1 Test Case Table

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 30


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

CONCLUSION

Here in this report we are mentioning different options like artificial intelligence to give our game upper-
hand in terms of advancement compared to old video games where those options are hard to find or even
if they were used, the old game engine does not give freedom which comes along with those options.
Pawn sense, certain death animation, collider adjustment they were not been found in old games. Sound
plays a great role in shooting games; user can understand certain action with the help of sound used in
our game which was not been found in old video games. 3D Animation effect is the one which generally
get gamer attention, in this paper we are mentioning the different animation made in our game to the
characters which will choose proper actions according to a certain event takes place in game. In today’s
world, the game is showing great advancement in terms of graphics, physics, etc. and game play
perspective is also changing according to the player because of which we created FPS version of game
where it gives gamer a proper experience of a virtual world of video game.
Now there is still so many upgradations can be done in FPS game because there is still some restraint
that is suppressing potential of our game like in the upcoming time there is a concept called FULL DIVE
IMMERSION which will truly defines FPS in their actual means. Physics in game animation is still not
that smooth enough to make player not just to give him proper game experience but also to make them
understand and feel that game concept. The use of AI in real-time task and first-person shooter games
concerns the proposal of concepts that can be used to improve and further develop the use of artificial
intelligence in computer games. there isn’t a very high pace in improving the artificial intelligence in
games is perhaps because the enemy or NPC characters in video game is not challenging enough
compared to online multiplayer games. Either way, game AI is an area that is open for new developments.

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 31


FPS GAME DEVELOPMENT USING UNITY WITH AI AND SIMULATION

REFERENCES

[1] Buro, M. (2003). Real-Time Strategy Gaines: a replacement AI Research Challenge. IJCAI'03
Proceedings of the 18th international joint conference on computing (pp. 1534-1535).

[2]MorganKauffman.Booth,M.(2009).
TheAISystemsofLeft4Dead.computingandInteractiveDigitalEntertainment. Valve.

[3] ValveSoftware.2004.Half-Life2[Computerprogram].ElectronicArts.
IJSDR2009091 International Journal of Scientific Development and Research (IJSDR)

[4] Chen, X., Xu, L., Li, T., & Wang, Y. (2018). “AI techniques for game playing: a survey.”
International Journal of Computer Games Technology, 2018

[5] Gaudl, S., & Hlavac, V. (2018). “AI in first-person shooter games: survey.” Journal of Artificial
Intelligence and Soft Computing Research, 2018

[6] Yannakakis, G., & Hallam, J. (2007). “AI methods for game development.” IEEE Transactions on
Computational Intelligence and AI in Games

BHARATI VIDYAPEETH (DEEMED TO BE UNIVERSITY), COLLEGE OF ENGINEERING, PUNE- 43 32

You might also like