Mini Project Report2
Mini Project Report2
AND UNITY
A MINI PROJECT REPORT
Submitted by
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
Dr.K.Kalaivani ,Ph.D., Dr.R.Anandan ,Ph.D.,D.Sc.,
, Associate Professor, Professor,
Head of the department, Dept of Computer science& Engineering
Dept of Computer Science &Engineering, VISTAS,
VISTAS, Chennai – 600 117Chennai – 600 117.
Submitted for the project work and viva - voice examination held on
…………… at Vels Institute of Science, Technology and Advanced Studies
(VISTAS), Chennai – 600 117.
SUDHAKAR.M(22602211)
SANTHOSH KUMAR.M.C(22602209)
SYED IRFAN(22602212)
ROHITH.K (22602207)
TABLE OF CONTENTS
CHAPTER TITLE PAGE
ABSTRACT
PG.NO
1 INTRODUCTION 1
1.1 ABOUT THE PROJECT 1
2 LITERATURE SURVEY 2
3 SYSTEM ANALYSIS 3
3.1 EXISTING SYSTEM 3
3.2 PROPOSED SYSTEM 4
4 REQUIREMENT SPECIFICATION 5
4.1 INTRODUCTION 5
4.2 HARDWARE AND SOFTWARE 5
SPECIFICATIONS
4.3 TECHNOLOGIES USED 6
5 SYSTEM ARCHITECTURE 8
5.1ARCHITECTURE DIAGRAM 8
5.3 USE CASE DIAGRAM 9
targeting core aspects of gameplay such as health management, scoring, and enemy interaction.
This mini-project leverages the Unity engine and C# scripting to bring these mechanics to life,
with an emphasis on creating a seamless, engaging, and technically robust game.We have implemented
various elements crucial to gameplay. A health bar and scoring system track player performance
, while collision mechanics allow for realistic interactions between the player and enemies. The
game’s development involved iterative testing and optimization, focusing on smooth player
approach, including data-driven design and code refinement. Scripts are tested for performance and
optimized to reduce runtime errors, ensuring a consistent gameplay experience. Key mechanics such
as health reduction upon enemy collision are meticulously integrated to provide challenge and maintain
player interest. This project transcends technical skill, reflecting a commitment to both user
engagement and smooth gameplay. Moving forward, future improvements could include more
complex AI behaviors, additional game levels, and refined visuals to enhance the player's
experience.By focusing on these fundamental aspects, this project aims to offer a practical learning
experience in game development, setting a strong foundation for building more complex, engaging
1
CHAPTER 2
LITERATURE SURVEY
Literature Survey 1:
Title: "Fox Fables: An Adventure-Based 2D Game in Unity Game Engine"
This survey explores the creation and design principles of Fox Fables, a 2D
adventure game developed using the Unity engine. The game combines
storytelling with engaging gameplay elements, focusing on a fox character's
journey through various landscapes filled with challenges and puzzles. The
authors discuss the techniques used to achieve smooth movement, collision
detection, and interactive gameplay mechanics within a 2D framework.
They analyze the strengths of Unity's asset management, scripting capabilities, and
animation tools in creating a visually appealing and interactive environment.
Key challenges identified in the development of Fox Fables include optimizing
graphics for various platforms, balancing difficulty to maintain player
engagement, and achieving responsive controls. The study highlights the
importance of cohesive level design and thoughtful character development in
fostering an immersive experience. This survey is a useful resource for
developers and designers looking to understand the intricacies of creating a
cohesive 2D adventure game in Unity, offering insights into both the creative
and technical aspects of the process.
Literature Survey 2:
Title: "The Role of Game Engines in Game Development and Teaching".
This literature survey examines the critical role game engines play in both
professional game development and educational settings. It provides an in-depth
analysis of popular game engines like Unity and Unreal Engine, focusing on their
capabilities in creating immersive 2D and 3D experiences, simplifying complex
programming tasks, and enabling rapid prototyping. The authors highlight the
accessibility and versatility of these tools, which make them invaluable for
beginners and experienced developers alike.
In addition to exploring technical benefits, the study addresses the pedagogical
advantages of using game engines in teaching environments. By providing a
hands-on approach, game engines help students and aspiring developers gain
practical experience, from scripting and asset management to gameplay testing and
iteration. Challenges discussed include the steep learning curve for beginners and the
necessity for balancing theoretical knowledge with practical application.
This survey emphasizes the transformative impact of game engines on learning and
creativity in game development, serving as a comprehensive guide for
educators and developers aiming to harness these tools effectively.
2
CHAPTER 3
SYSTEM ANALYSIS
3.1EXISTING SYSTEM
Existing 2D game development systems and frameworks provide essential insights and
serve as inspiration for our Unity-based project. Below are some of the notable tools,
platforms, and game development trends that have influenced the development of our
game:
2. Godot Engine: Godot is an open-source game engine that has gained popularity
due to its lightweight framework and user-friendly interface, especially for
2D games. While it may not have as extensive an asset store as Unity, it provides
an intuitive approach to scene management and scripting that many developers
find beneficial.
4. Popular 2D Indie Games: Games such as Celeste and Hollow Knight set
benchmarks in 2D game design by showcasing unique art styles, smooth
movement mechanics, and engaging gameplay. These games highlight the
importance of a cohesive aesthetic, well-designed levels, and finely tuned
difficulty for maintaining player engagement.
2. Health and Scoring System: Our game incorporates a health bar and scoring system
to track player progress and add challenge. The health bar decreases upon collision
with enemies, providing visual feedback on the player's status, while the scoring
system rewards progress and motivates continued play.
4. Visual and Audio Assets: The project utilizes a range of 2D assets and sound effects
that align with the game’s theme and enhance the overall ambiance. Custom sprites
and sound effects were incorporated to create a unique and engaging environment.
Through these components, the proposed system strives to provide a dynamic and
enjoyable experience for players, while also serving as a valuable learning tool for
the developers involved in creating interactive 2D games with Unity.
4
CHAPTER 4
REQUIREMENT SPECIFICATION
4.1INTRODUCTION
The requirement specifications for developing a 2D game in Unity cover both
hardware and software essentials that ensure smooth operation and efficient game
development. Since Unity is a powerful game engine, the hardware specifications
must meet a certain threshold to support rendering, scripting, and real-time game
testing. Additionally, specific software tools and frameworks are necessary for
creating, testing, and deploying the game. These requirements allow for seamless
asset handling, code management, and project scalability, ensuring that the project
runs optimally during development and on target platforms.
SOFTWARE COMPONENTS
Operating System: Windows 10 (64-bit), Windows 11, or macOS
(for compatibility with Unity)
Unity Version: Unity 2021.3 LTS or later (for stability and access to the
latest 2D development features)
Additional Tools:
5
o Unity Asset Store (for free and paid assets to aid in rapid
development)
4.3TECHNOLOGIES USED
4.3.1UNITY
Unity is a powerful, cross-platform game development engine widely used for
creating both 2D and 3D games. Released by Unity Technologies, Unity has gained
popularity due to its ease of use, vast community support, and extensive library of
assets. It empowers developers to create games quickly, with tools for rendering,
physics, and scripting. Unity’s versatility also makes it a preferred choice for VR and
AR applications, simulations, and interactive media.
6
allowing for a robust, object-oriented programming environment.
Physics and Animation: Built-in physics and animation systems allow for
Realistic game dynamics.
Why Unity?
Asset Store: Unity’s Asset Store enables developers to purchase or download free
assets, including scripts, models, and plugins.
Learning Resources: Unity offers free tutorials and courses, making it easier for
beginners to get started.
7
CHAPTER 5
SYSTEM ARCHITECTURE
5.1ARCHITECTURE DIAGRAM
A Architecture Diagram is simply a graphical representation of
steps. It shows steps in sequential order and is widely used in presenting the flow of
algorithms, workflow, or processes. Typically, a flowchart shows the steps as boxes
of various kinds, and their order by connecti
connecting them with arrows.
5.3USE DIAGRAM
A Use Case Diagram visually represents the system's functionality and the key actions
that can be performed within the system. In the context of our game, the use case
diagram outlines important game features and interactions that the player can engage
with during gameplay. These include various gameplay mechanics, menus, and triggers
that enhance the user experience.
The diagram focuses on core actions and events that take place in the game, such as
accessing the start menu, pausing the game, or interacting with game objects.
In this use case diagram, several key functionalities are illustrated to showcase how
playerss can interact with the game and trigger various events:
8
1. Start Menu:: The player can access the start menu to begin the game or
navigate to other options like settings, load game, or quit.
2. Pause Menu:: During gameplay, the player can pause the game to acceaccess the
pause menu, which includes options like resume, restart, or adjust game settings.
3. When Trigger:: This use case represents events that occur when certain
conditions are met, such as entering a new area, interacting with objects, or
completing a quest.
est. Triggers can activate dialogues, open doors, or change
the game environment.
4. Object Collection:: The player can collect items or interact with objects within
the game. This could include picking up keys, treasures, or power
power-ups, which
are essential for progressing through the game.
9
CHAPTER 6
CODING AND TESTING
6.1CODING
Once the design of the system is finalized, the next phase involves coding and testing.
This phase brings the system to life by converting the designed architecture into
executable code using the chosen programming language. It is essential to follow a well-
organized coding approach, ensuring that modifications can be easily integrated into the
system whenever required. Good coding practices make the development process
smoother and help maintain the code in the long run.
Coding Standards
Coding standards serve as guidelines for writing code in a structured and readable way.
Adhering to these standards ensures that the code is easy to understand, debug, and
maintain. Properly following coding standards during the development phase ensures
that any programmer can comprehend the code and implement changes effectively.
Essential coding standards include:
Writing simple, clear, and understandable code.
Proper naming conventions for variables, functions, and classes.
Consistent handling of error messages and exceptions.
Proper script formatting with necessary indentation and commenting.
Structured message box formats for clear communication with the user.
Naming Conventions
Following consistent naming conventions is crucial to ensure that the code is
self-descriptive and easily understandable. The names of classes, data members,
functions, and variables should indicate their purpose. For example:
Class Names: Should begin with a capital letter and use camel case (e.g.,
MainCharacter).
Member Functions and Data Members: Should begin with a lowercase letter,
and subsequent words should be capitalized (e.g., playerHealth or
moveCharacter).
Value Conventions
Value conventions focus on assigning and validating appropriate values to variables
during runtime. These conventions ensure that the system behaves as expected and
that no erroneous values are used. Key points include:
Defining proper default values for variables.
Validating input values to prevent errors.
Documenting flag values for clarity.
Testing Procedure
System Testing
Testing plays a critical role in software development as it helps identify errors and
ensures the system functions as intended. It is a quality assurance process that verifies
the system’s compliance with the design specifications. System testing aims to confirm
that the software performs as expected and adheres to the design. This process also
includes inspecting the design before coding starts, as any detected design errors are
easier to fix earlier in the process, saving time and resources.
Functional Tests
Functional testing verifies the correctness of the system’s functionality. Test cases
involve testing with standard input values, boundary values, and edge cases, such as
empty files or logically related inputs.
Performance Test: Evaluates the execution time and efficiency of the software.
Stress Test: Tests the software under extreme conditions to determine how it
handles high loads or unusual inputs.
Structure Test: Focuses on testing the internal logic of the system and ensuring
that all paths and decision points within the code are properly executed.
Integration Testing
Integration testing focuses on combining individual modules and verifying their
interaction and communication. This helps uncover errors that occur when different
parts of the system interact with each other. Modules are tested incrementally to identify
and fix issues early. The goal is to detect interface errors and ensure seamless module
integration before proceeding to the user acceptance stage.
Security Testing
Security testing ensures the system is protected against potential vulnerabilities. This
involves verifying the protection mechanisms of the system to prevent unauthorized
access or breaches. During security testing, the tester simulates attacks to check how the
system defends itself against them.
Validation Testing
At the culmination of integration testing, the software undergoes validation testing. The
goal is to ensure that the software functions as expected from the user's perspective.
Validation testing checks whether the system’s behavior aligns with the user’s
requirements. If any discrepancies are found, they are corrected before final
delivery.
12
CHAPTER 7
RESULT AND OUTPUT
7.1OUTPUT
The game application begins by loading the main menu, where players can
start the game, access the pause menu, or adjust settings. The input system is
designed to handle various actions such as player movement, interactions with
enemies, and triggering events. The key mechanics such as health bars, scoring,
and game events are dynamically updated as the game progresses.
START MENU:
13
BASIC GAMEPLAY:
PAUSE MENU:
In the game, player interactions with different in-game objects trigger actions like
health reduction, triggering animations, or updating the score. For instance,
when the player collides with an enemy, the health bar decreases accordingly.
The game is built to allow fluid transitions between different game states such as
start, in-game, and pause menus, ensuring a seamless experience for the user.
14
GAMEPLAY MECHANICS:
7.2RESULT
The performance of the game has been tested by running several simulations,
including scenarios where the player interacts with various game objects.
The response times for actions like health bar updates, score updates, and menu
transitions have been within acceptable limits. Most of the time spent in the game is
during the actual gameplay when the player engages in combat with enemies or
navigates through different levels. The game handles inputs such as
movement and interactions with minimal delay, providing a responsive and engaging
player experience.
The game is optimized for smooth performance, with minimal lag during the core
gameplay. The pause menu, start menu, and event triggers all work as expected,
and the overall flow of the game is stable. Minor bugs and glitches observed during
testing have been addressed, ensuring a polished final product.
15
CHAPTER 8
CONCLUSION AND FUTURE WORKS
8.1CONCLUSION
Looking forward, several areas hold promise for expanding and refining our project.
Future developments could involve incorporating more complex animations,
enhanced AI for NPCs, and additional levels to increase player engagement and
challenge. Integrating multiplayer functionality would broaden the game's appeal,
while cross-platform compatibility could make it accessible to a wider audience.
Additionally, we aim to explore more advanced game mechanics, such as
procedurally generated content and more dynamic in-game environments. Through
these improvements, we strive to create an even more immersive and versatile
gaming experience, keeping pace with industry advancements and player
expectations..
16
CHAPTER 9
REFRENCES
• Rollings, A., & Adams, E. (2003). Andrew Rollings and Ernest Adams on Game
Design. New Riders.
• Juul, J. (2011). Half-Real: Video Games between Real Rules and Fictional Worlds.
MIT Press.
17
CHAPTER 10
SAMPLE SOURCE CODE
CameraFollow.cs
using UnityEngine;
void LateUpdate()
{
// Update the camera's position to follow the player with the specified offset
transform.position = target.position + offset;
}
}
Enemy.cs
using UnityEngine;
if (playerHealth != null)
{
// Deal damage to the player
playerHealth.TakeDamage(playerHealth.damageAmount);
18
}
}
}
}
MainMenu.cs
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
Movement.cs
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
Vector2 movement;
animator.SetFloat("Horizontal",movement.x);
animator.SetFloat("Vertical",movement.y);
animator.SetFloat("Speed",movement.sqrMagnitude);
movementDirection = new Vector2(Input.GetAxis("Horizontal"),
Input.GetAxis("Vertical"));
if (Input.GetKeyDown(KeyCode.Space))
{
ShootProjectile();
}
}
void ShootProjectile()
{
if (movementDirection != Vector2.zero)
{
// Create the projectile at the fire point
GameObject projectile = Instantiate(projectilePrefab, firePoint.position,
Quaternion.identity);
PlayerHealth.cs
using UnityEngine;
using UnityEngine.UI;
void Start()
{
// Initialize current health to max health at the start
currentHealth = maxHealth;
healthBarSlider.maxValue = maxHealth;
healthBarSlider.value = currentHealth;
gameOverPanel.SetActive(false); // Hide Game Over panel at the start
}
Projectile.cs
using UnityEngine;
22
CHAPTER 11
Base Papers
23
24
25
26
27
28
29
30
31
32
33
34
35