Project Report
Project Report
Project Report
submitted to
by
e are pleased to present the "Golf" game and take thisopportunityto
W
express our profound gratitude to all those people whohelpedusinthe
completion of this game. We are thankful to The Head of Department,
InformationTechnology,Dr.DaleeshaMVishwanathan,forgivingusall
the support. We express our sincere thanks to our Game Coordinator,
xxxx,forgivinguspropersupport,innovativesuggestions,timelyadvice,
andsuggestionsduringthisendeavour.Last,butnotleast,weexpressour
gratitudetoalltheclasscoordinator,Dr.ShelbiThomas,andgameguide
xxxxfortheirvaluableadviceandtimelysuggestions.Wewouldalsolike
to thank the faculties of School of Engineering, CUSAT for their
encouragement.
dnan Kuthradan
A
Amarantha Soniya Sherry
Fimil Faneea
Hisham V P
Jeremy Varughese
2
DIVISION OF INFORMATION TECHNOLOGY
CHOOL OF ENGINEERING
S
OCHIN UNIVERSITY OF SCIENCE & TECHNOLOGY
C
CERTIFICATE
his is to certify that the project report entitled "GOLF"
T
submitted by Fimil Faneea, Amarantha Soniya Sherry,
Adnan Kuthradan, Jeremy Varughese, Hisham VP to the
CochinUniversityofScience&Technology,Kochi,Kerala,in
partial fulfilment for the award of the Degree of Bachelor of
TechnologyinInformationTechnologyisabonafiderecordof
the project work carried out by them under my supervision
during March 2023 - July 2023.
r. Daleesha M Viswanathan
D Dr. Shelbi Thomas
Head
Division Of Information Technology Project Guide
3
ABSTRACT
4
Title Page
ACKNOWLEDGEMENT 2
ABSTRACT 4
CHAPTER 1 INTRODUCTION
CHAPTER 2 REQUIREMENTS
REFERENCE 43
5
CHAPTER 1
INTRODUCTION
6
1.1 PROBLEM STATEMENT
ddressing these issues is crucial to enhancing the appeal and
A
accessibility of golf games, ensuring a more enjoyable experience
forplayersofallskilllevels.Thegoalistorevolutionisethegaming
landscape by introducing an innovative approach that prioritises
user-friendly controls and an immersive, yet accessible, gameplay
experience.
7
1.2 OBJECTIVES
8
1.3 ADVANTAGES AND DISADVANTAGES
1.3.1ADVANTAGES
● E
ffortless Gameplay: The "Golf" game provides players
withaneffortlessgamingexperiencebyofferinganintuitive
control system. Players can navigate through the game
seamlessly, eliminating complexities and enhancing overall
enjoyment.
● A
ccessible User Interface: The project is committed to
creating an accessible user interface that simplifies the golf
gaming process. The game's design prioritizes
user-friendliness, ensuring smooth navigation and a
hassle-free experience for players of varying skill levels.
● S
ecure Gaming Environment: With a focus on secure
gaming, "Golf" integrates reliable measures to safeguard
player data and ensure a secure gaming environment. This
includes secure handling of in-game transactions, fostering
player confidence.
● T
ime-Optimised Gameplay: "Golf" optimises the gaming
experience by providing players with a set numberofshots
per level, promoting strategic decision-making andefficient
gameplay. This design minimises time spent on each level,
enhancing the overall gaming flow.
9
● E
ngagement without Environmental Impact: The project
aligns with eco-conscious principles by reducing the
environmental impact associated with traditional gaming
methods."Golf"eliminatestheneedforphysicalaccessories
or excessive resource consumption, contributing to a
sustainable gaming environment.
1.3.2 DISADVANTAGES
● T
echnologyDependency:The"Golf"gamereliesonmobile
devices, internet connectivity, and digital payment systems,
making it vulnerable to disruptions caused by technical
issues.
● U
ser Adoption and Familiarity: Users who are less
tech-savvy or unfamiliar with mobile apps may struggle to
adopt and use the game, leading to a learning curve and
potential resistance to change.
10
● D
evice Compatibility: Compatibility issues may arisewith
older devicesoroperatingsystems,limitingaccessforusers
with outdated or incompatible devices.
● L
imited Availability and Accessibility: The game's
usefulness may be restricted to specific platforms or
locations, while individuals without smartphonesorreliable
internet access may face difficulties in utilising its features.
11
CHAPTER 2
REQUIREMENTS
2.1.2.Diverse Courses:
I f the allowed shots per round finish then a screen which shows
retry pops up.
12
2.2 NON-FUNCTIONAL REQUIREMENTS
2.2.1Availability
The game will be available and run withoutany errors.
2.2.2 Security
Users can have secured access. There are no
restrictions in use of this game.
2.2.3 Maintainability
The admin doesn't have to maintain the game regularly.
3.2.4 Reliability
The game can be used by PC users.
13
CHAPTER 3
DESIGN
USER INTERFACE
Fig. 3.1
Fig. 3.2
14
Fig. 3.3
Fig. 3.4
15
Fig. 3.5
Fig. 3.6
16
CHAPTER 4
sing UnityEngine;
u
/// <summary>
/// Script responsible for managing level, like spawning level, spawning
balls, deciding game win/loss status and more
/// </summary>
public class LevelManager : MonoBehaviour
{
public static LevelManager instance;
17
/// <summary>
/// Method to spawn level
/// </summary>
public void SpawnLevel(int levelIndex)
{
//we spawn the level prefab at required position
Instantiate(levelDatas[levelIndex].levelPrefab, Vector3.zero,
Quaternion.identity);
shotCount = 8; //set the available shots
UIManager.instance.ShotText.text = shotCount.ToString();
//set the ShotText text
//then we Instantiate the ball at
spawn position
GameObject ball = Instantiate(ballPrefab, ballSpawnPos,
Quaternion.identity);
CameraFollow.instance.SetTarget(ball); //set the
camera target
GameManager.singleton.gameStatus = GameStatus.Playing;
//set the game status to playing
}
/// <summary>
/// Method used to reduce shot
/// </summary>
public void ShotTaken()
{
if (shotCount > 0) //if shotcount is more
than 0
{
shotCount--; //reduce it by 1
UIManager.instance.ShotText.text = "" + shotCount; //set the
text
18
}
}
}
/// <summary>
/// Method called when player failed the level
/// </summary>
public void LevelFailed()
{
if (GameManager.singleton.gameStatus == GameStatus.Playing)
//check if the gamestatus is playing
{
GameManager.singleton.gameStatus = GameStatus.Failed; //set
gamestatus to failed
UIManager.instance.GameResult(); //call GameResult method
}
}
/// <summary>
/// Method called when player win the level
/// </summary>
public void LevelComplete()
{
if (GameManager.singleton.gameStatus == GameStatus.Playing)
//check if the gamestatus is playing
{ //check if currentLevelIndex is less than total levels available
if (GameManager.singleton.currentLevelIndex <
levelDatas.Length)
{
GameManager.singleton.currentLevelIndex++; //increase the
count by 1
}
else
{
//else start from level 0
GameManager.singleton.currentLevelIndex = 0;
}
19
ameManager.singleton.gameStatus = GameStatus.Complete;
G
//set gamestatus to Complete
UIManager.instance.GameResult(); //call
GameResult method
}
}
}
using UnityEngine;
/// <summary>
/// Class which store level data
/// </summary>
[System.Serializable]
public class LevelData
{
public int shotCount; //maximum shot player can take
public GameObject levelPrefab; //reference to level prefab
ublic LevelData()
p
{
shotCount = 5;
}
}
/// <summary>
/// Script which controls the ball
/// </summary>
[RequireComponent(typeof(Rigidbody))]
public class BallControl : MonoBehaviour
{
public static BallControl instance;
20
[ SerializeField] private LineRenderer lineRenderer; //reference to
lineRenderer child object
[SerializeField] private float MaxForce; //maximum force that
an be applied to ball
[SerializeField] private float forceModifier = 0.5f; //multipliers of
force
[SerializeField] private GameObject areaAffector; //reference to
sprite object which show area around ball to click
[SerializeField] private LayerMask rayLayer; //layer allowed to
be detected by ray
21
}
22
rivate void OnTriggerEnter(Collider other)
p
{
if (other.name == "Destroyer") //if the object name
is Destroyer
{
LevelManager.instance.LevelFailed(); //Level Failed
}
else if (other.name == "Hole") //if the object name
is Hole
{
LevelManager.instance.LevelComplete(); //Level
Complete
}
}
23
IManager.instance.PowerBar.fillAmount = force / MaxForce;
U
//set the powerBar image fill amount
//we convert the endPos to local pos for ball as lineRenderer is child
of ball
lineRenderer.SetPosition(1,
transform.InverseTransformPoint(endPos)); //set its 1st position
}
/// <summary>
/// Method used to convert the mouse position to the world position in
respect to Level
/// </summary>
Vector3 ClickedPoint()
{
Vector3 position = Vector3.zero; //get a new
Vector3 varialbe
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
//create a ray from camera in mouseposition direction
RaycastHit hit = new RaycastHit(); //create a
RaycastHit
if (Physics.Raycast(ray, out hit, Mathf.Infinity, rayLayer)) //check
for the hit
{
position = hit.point; //save the hit point in
position
}
return position; //return position
}
24
#if UNITY_EDITOR
#endif
}
using UnityEngine;
/// <summary>
/// Script which detect mouse click and decide who will take input Ball
or Camera
/// </summary>
public class InputManager : MonoBehaviour
{
[SerializeField]
private float distanceBetweenBallAndMouseClickLimit = 1.5f;
//variable to decide who will take input Ball or Camera
25
if (Input.GetMouseButtonDown(0) && !canRotate) //if
mouse button is clicked and canRotate is false
{
GetDistance(); //get the distance between
mouseClick point and ball
canRotate = true; //set canRotate to true
CameraRotation.instance.RotateCamera(Input.GetAxis("Mouse X"));
}
}
26
canRotate = false; //canRotate is set false
//if distance is less than the limit
allowed
if (distanceBetweenBallAndMouseClick <=
distanceBetweenBallAndMouseClickLimit)
{
BallControl.instance.MouseUpMethod(); //call ball
method
}
}
}
}
/// <summary>
/// Method which give us distance between click point in world and
ball
/// </summary>
void GetDistance()
{
//we create a plane whose mid point is at ball position and whose
normal is toward Camera
var plane = new Plane(Camera.main.transform.forward,
BallControl.instance.transform.position);
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
//create a ray
float dist; //varibale to get ditance
if (plane.Raycast(ray, out dist))
{
var v3Pos = ray.GetPoint(dist); //get the point
at the given distance
//calculate the distance
distanceBetweenBallAndMouseClick = Vector3.Distance(v3Pos,
BallControl.instance.transform.position);
}
}
}
27
4.1.5 GAME MANAGER
using UnityEngine;
[ HideInInspector]
public int currentLevelIndex;
[HideInInspector]
public GameStatus gameStatus = GameStatus.None;
[ System.Serializable]
public enum GameStatus
{
None,
Playing,
Failed,
Complete
}
28
4.1.6 CAMERA FOLLOW
sing System.Collections;
u
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Script which makes camera follow ball
/// </summary>
public class CameraFollow : MonoBehaviour
{
public static CameraFollow instance;
/// <summary>
/// Method to set target from other scripts
/// </summary>
public void SetTarget(GameObject target)
{
followTarget = target; //set the target
offset = followTarget.transform.position - transform.position; //set
the offset
29
c hangePos = transform.position; //set the
changePos
}
/// <summary>
/// Unity method, we use lateUpdate as we want to change our camera
position after Update method
/// </summary>
private void LateUpdate()
{
if (followTarget) //if target is present
{
if (activeVectors.x) //if x axis is allowed
{ //set the changePos x
changePos.x = followTarget.transform.position.x - offset.x;
}
if (activeVectors.y) //if y axis is allowed
{ //set the changePos y
changePos.y = followTarget.transform.position.y - offset.y;
}
if (activeVectors.z) //if z axis is allowed
{ //set the changePos z
changePos.z = followTarget.transform.position.z - offset.z;
}
transform.position = changePos; //set the
transform of camera
}
}
}
[ System.Serializable]
public class ActiveVectors
{
public bool x, y, z;
}
30
4.1.7 UI MANAGER
sing UnityEngine;
u
using UnityEngine.UI;
using UnityEngine.SceneManagement;
/// <summary>
/// Script to control game UI
/// </summary>
public class UIManager : MonoBehaviour
{
public static UIManager instance;
void Start()
31
{
if (GameManager.singleton.gameStatus == GameStatus.None) //if
gamestatus is none
{
CreateLevelButtons(); //create level buttons
} //we check for game status, failed or complete
else if (GameManager.singleton.gameStatus == GameStatus.Failed ||
GameManager.singleton.gameStatus == GameStatus.Complete)
{
mainMenu.SetActive(false); //deavtivate
main menu
gameMenu.SetActive(true); //activate game
menu
evelManager.instance.SpawnLevel(GameManager.singleton.currentLevelIndex
L
); //spawn level
}
}
/// <summary>
/// Method which spawn levels button
/// </summary>
void CreateLevelButtons()
{
//total count is number of level datas
for (int i = 0; i < LevelManager.instance.levelDatas.Length; i++)
{
GameObject buttonObj = Instantiate(lvlBtnPrefab,
container.transform); //spawn the button prefab
buttonObj.transform.GetChild(0).GetComponent<Text>().text = "" +
(i + 1); //set the text child
Button button = buttonObj.GetComponent<Button>();
//get the button componenet
button.onClick.AddListener(() => OnClick(button));
//add listner to button
}
}
32
/// <summary>
/// Method called when we click on button
/// </summary>
void OnClick(Button btn)
{
mainMenu.SetActive(false);
//deactivate main menu
gameMenu.SetActive(true); //activate
game manu
GameManager.singleton.currentLevelIndex =
btn.transform.GetSiblingIndex(); ; //set current level equal to sibling index on
button
evelManager.instance.SpawnLevel(GameManager.singleton.currentLevelIndex
L
); //spawn level
}
/// <summary>
/// Method call after level fail or win
/// </summary>
public void GameResult()
{
switch (GameManager.singleton.gameStatus)
{
case GameStatus.Complete: //if completed
gameOverPanel.SetActive(true); //activate game finish
panel
nextBtn.SetActive(true); //activate next button
SoundManager.instance.PlayFx(FxTypes.GAMECOMPLETEFX);
break;
case GameStatus.Failed: //if failed
gameOverPanel.SetActive(true); //activate game finish
panel
retryBtn.SetActive(true); //activate retry button
SoundManager.instance.PlayFx(FxTypes.GAMEOVERFX);
break;
}
33
}
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}
34
4.2 FUNCTIONAL TESTING
• Testthemainmenuscreenensuringtheavailabilityof
the desired levels.
• Verified that the selected level is loaded and readyto
play.
• On asuccessfulputt(puttingthegolfballinthehole),the
game complete screen appears and offers the option to proceed to
the next course/level .
• Whenthegolfballhasbeenhitoutoftheboundsof
the golf course, the retry screen appears.
• When nomoreshotsareavailabletotheplayer,the
retry screen appears.
35
4.3 SOFTWARE TESTING
hese testing activities aim to ensure that the "Mini-Golf" app
T
performs optimally,maintainssecurity,functionsseamlesslyacross
different platforms, and provides a user-friendly experience for its
users.
36
CHAPTER 5
ithin this section, we will delve into the examination of our
W
game’s testing phase. This phase was conducted to assess the
effectivenessofourgame’scorefunctionalities,gaugetheireaseof
use, and ascertain whethertheymetourperformancecriteria.Let's
delve into the discoveries we made, address any obstacles
encountered, and explore the implications of these findings onthe
overall achievement of our game.
37
Fig. 5.1
.2.Diverse levels/courses
5
Upon successful selection of the level, the level is loaded and ready
to play.
Fig 5.2
Level screen
38
.3.Game complete screen
5
When the player successfully putts the ball, the game complete
screen is displayed. The player can proceed to the next level by
clicking on the “next” button.
Fig. 5.3
.4.Retry Screen
5
In the casethataplayerhitstheballoutofthelevelboundsorthe
player exhausts their available shots left, the game ends and the
player is presented with the option to retry the level.
39
Fig. 5.4
Retry screen
● RESULTS:
40
CHAPTER 6
6.1 CONCLUSION :
41
ame. Moreover, the addition of a mini golf course design feature
g
will empower players to create and share their unique courses,
fostering creativity and community engagement.
urthermore, the future iterations of the project could delve into the
F
integration of augmented reality (AR) and virtual reality (VR)
technologies, elevating the immersive experience for players by
blending the virtual and real worlds. The inclusion of customizable
avatars, equipment, and virtual environments will contribute to a
more tailored and interactive gaming experience.
42
REFERENCES:
Youtube video:https://youtu.be/dIGJ_ltO1Q0?feature=shared
●
● Unity Documentation:
- URL:[UnityOfficialDocumentation](
https://docs.unity3d.com/)
- URL:[UnityCommunityForums]
https://forum.unity.com/
43