Minor Project
Minor Project
on
“THE AVIATOR”
Submitted to
BACHELOR’S DEGREE IN
We are profoundly grateful to AJAY ANAND for his expert guidance and
continuous encouragement throughout to see that this project meets its target since
its commencement to its completion. .....................
TOOBA SULTANA
ANUSHKA SARKAR
MEDHA PRAGYA
SOMADRITA
SOUMYA STAPATHY
ABSTRACT
1. INTRODUCTION
What is game development
Steps of game development
Testing and debugging
Abstraction
2. LITERATURE SURVEY
WebGL and Web3D
3. SOFTWARE REQUIREMENTS SPECIFICATION
Coding standards
Functions
Game view
4. REQUIREMENT ANALYSIS
Working of the WebGL Pipeline
Working of Three JS
5. SYSTEM DESIGN
6. IMPLEMENTATION
7. SCREENSHOTS OF PROJECT
8. CONCLUSION
9. FUTURE SCOPE
10. REFERENCES
INTRODUCTION
Step 1:
Step 2:
• The next step is to choose a game engine.
• A game engine is a software development kit that provides the
tools and resources necessary to create a game
• There are several games to choose from, such as,
• Cryengine
• Unity
• Unreal Engine
Step 3:
• After choosing the game engine, you need to design the actual game.
• This involves the following:
• Creating a concept
• Coming up with the story
• Creating art assets
• Developing characters
• Creating environments
• Designing game mechanics
Step 4:
• Once you have designed the game, you’ll need to program it.
• This involves writing code to control the game’s logic and behavior.
Step 5:
• The game is now developed and needs to be tested.
• Testing ensures that the game plays how it was intended
• Any bugs that are found are also fixed in this stage
Choosing a Platform
• There are 4 main platforms you can choose to create your game for.
The platform you choose will dictate the type of game you can
create. Listed below are the various types of platforms
• Desktop Platforms
• Mobile Platforms
• Web Platforms
• Console Platforms
Testing and Debugging
Testing
• Testing is running the game and looking for any issues or bugs.
This can be done either manually or using automated testing
tools.
Debugging
• Debugging is the process of finding and fixing errors in the game
code. This is done by analyzing the code and looking for any errors
or bugs. Debugging can be done manually or with the help of
debugging tools.
Abstraction
Web3D, often called 3D Web, is all about bringing the magic of 3D graphics
to your web browsing experience. It started way back in 1994 with
something called VRML, which was like the granddaddy of 3D web stuff. But
back then, you needed special browser plug-ins to make it work, which kind
of slowed things down.
Then along came Adobe Flash Player in the 2000s, which let us do some
pretty cool stuff online, including 3D content. Around the same time, Google
introduced O3D, another way to bring 3D to the web using JavaScript.
But things really took off with WebGL. It's like a supercharged version of 3D
for the web that doesn't need any extra plug-ins. It works on your computer
and even on your phone, making 3D graphics a breeze to use on the web.
To make things even better, there's this thing called glTF, which is like a
special file format just for 3D stuff on the web. It's got all sorts of cool
features like making things look more realistic and even animating faces.
And get this, the future looks even brighter with something called
"WebGPU" in the works. It's like the next level of 3D graphics for the web,
being developed by big companies like Apple, Google, and Microsoft. So
soon, we might be seeing even more mind-blowing 3D stuff right in our
browsers.
REQUIREMENT ANALYSIS
4. Vertex Shader: This shader is executed for each vertex in the vertex
buffer object. It calculates vertex positions and other attributes like color
and texture coordinates.
7. Fragment Shader: Calculates color values for each pixel between vertices
based on data from the vertex shader and primitives from rasterization.
9. Frame Buffer: The frame buffer holds the scene data, including pixel
color, depth, and stencil buffers, and is the final destination of the rendering
pipeline.
Diagram 1. Working of WebGL
2) WebGL
4) ThreeJS framework
MB Memory
Coding Standards
Variables:-
1. Colors: An object storing hexadecimal color values for various colors.
8. HEIGHT, WIDTH: Variables to store the height and width of the window.
9. mousePos: Object to store the current mouse position.
11. sea, airplane: Variables representing sea and airplane objects in the
game.
Functions:-
10. loop(): Main game loop function responsible for updating game state
and rendering.
These are the variables and functions present in the provided code and their
purposes within the game implementation.
Game View
Menu View:-
Game View:-
Diagram 4. Game view
SYSTEM DESIGN
Class: AirPlane
Method Description
Class: Coins
Method Description
Class: CoinsHolder
Class: CoinsHolder
Method Description
The CoinsHolder function builds a container for holding coins. To put all the
coins in one group, it has an Object3D mesh. To handle the status of the
coins, it keeps track of the arrays coinsInUse and coinsPool. Coins are
randomly generated and positioned via the spawnCoins function. The
rotateCoins function adjusts the coins' orientation and position, detects any
collisions with the aircraft, and recycles them appropriately.
3. Breakdown of the ‘Ennemy’ and ‘EnnemiesHolder’ functions along with
their properties and methods:
Class: ‘Ennemy’
Method Description
Class:’EnnemiesHolder’
Class: ‘Particles’
Method Description
Class: ‘ParticlesHolder’
Property Type Description
Method Description
5. Breakdown of the Pilot function along with its properties and methods
Class:Pilot
Method Description
The class ‘Pilot’ creates a 3D model of the character pilot. It has various
components such as body, face, hairs, glasses, and ears that have been
created using different geometries and materials and are added to the mesh
of the pilot character.
Method: ‘updateHairs()’
This program is responsible for changing the hair movement of the driver.
AngleHairs adjusts the proportions of each hair component according to the
sine function. Therefore, the hair begins to curl. The tempo of the game and
the time increase determine how much the hair angle will be increased.
To put it all together, the Pilot category offers a way to create and watch a
pilot in a scene, complete with hair movement animation.
Class:Sea
Method Description
The Sea class is responsible for generating and animating waves. The Sea
class creates a cylindrical form that is used to depict the sea. It initializes a
mesh with a Phong material using this geometry. By changing the properties
of each vertex in the geometry, waves are created. These properties are
stored in the waves array and include the initial position (x, y, z), angle
(ang), amplitude (amp), and speed (speed) of each wave.
Method:moveWaves()
This method alters the position of each vertex in the sea geometry to
simulate the motion of waves. Update the position of each vertex iteratively
using the matching wave attributes stored in the waves array. The sine and
cosine functions are used to calculate the location in order to create a
motion that resembles waves. Each wave also experiences an increase in
angle based on its speed compounded by the delta time. In the end, it sets
verticesNeedUpdate to true to inform Three.js that the vertices of the mesh
have changed.
All things considered, the Sea class provides a systematic way to create and
animate waves in the image, giving the appearance of a real sea surface.
Class:’Sky’
Method Description
The Sky class is responsible for creating and animating clouds in the
Three.js scene. A group of cloud objects is assembled by the Sky class and
dispersed throughout the sky. By building instances of the Cloud class and
arranging them in a circle around the scene's center, it produces a given
number of clouds (nClouds). To create variation, each cloud is rotated and
scaled at random.
The clouds are animated with the'moveClouds' function. To add a rotating
effect to each cloud, it invokes the rotate method. It also rotates the whole
sky mesh around the z-axis according to the speed and delta time of the
game.
Class:’Cloud’
Method Description
The createLights function sets up these lights and adds them to the scene.
IMPLEMENTATION
Lines(1-140)
This code uses Three.js to start creating different game elements and set the
game environment:
Color definition: Use hex color codes to describe the various colors used
in the game.
resetGame() function: When called, resets the game state to the initial
value. This function is responsible for resetting speed, distance, power,
level, airspace, seaspace, temperature and enemy position and status
game related variables.
startGame() function: Start the game by setting the game to "Play" and
turning on the background music and sound effects. Additionally, all
banners displayed on the screen will also be deleted.
This policy lays out the main elements of the game environment and
prepares it for action and planning. Use Three.js for chat.
Lines(140-239)
1. Sound Setup:
This line configures the sound effect using the THREE.js Audio API.
2. Renderer Setup:
Updates the HEIGHT and WIDTH variables with the new window.
These lines define functions that handle mouse and touch input events.
If the game is "waitingForPlayer", restarts the game, starts the game and
hides the possible menu of use hideReplay (invisible function).
If the game is in the "Waiting for Replay" state, it will reload the window and
actually restart the game.
5. Logging Message:
Lines(240-476)
createPlane(): Use the AirPlane class (not shown) and the scale to create
the model plane Get it, preset place it at the set height and attach it to the
ground.
createSea(): Create a sea model using the Sea class (not shown), place it
on the sea surface (maybe below the surface) and add it to the surface.
createSky(): Create a sky model using the Sky category (not shown),
place it in the sea radius and add it to the scene (possibly as a
background). >createCoins(): Create a coin holder with the number of
coins (20) using the CoinsHolder class (invisible) and add a grid holder
to the field.
2. Game loop:
The loop function is the basis of the animation and updates the state of the
game with each frame.
Gets the current time (newTime) and calculates the time difference
(deltaTime) from the previous time.
Update level, background color gradient and target speed based on distance
and level (game .distanceForLevelUpdate).
Call the function to change the aircraft's position, distance, power, and other
aspects of the game.
"gameover": Slow down the plane, turn the plane, increase its speed and
check
Adjust the rotation of the jet fan and the rotation of the ocean net according
to the speed.
Summon the role of coins, flipping enemies, moving clouds (can be part of
the sky model) and moving waves (can be part of the ocean model).
Render the scene using a renderer and request another keyframe using
requestAnimationFrame(loop).
updateDistance():
Determines the path of the level circle based on the distance to the current
level (value of the dashoffset property).
updateEnergy():
Change the width and color of the energy bar for additional energy.
4. Plane update:
updatePlane():
Select the target Y and X position of the plane according to the normalized
position of the mouse in a specific way.
Update camera view based on mouse position (probably used for zoom
effects).
Gradually reduce the impact of the aircraft and accelerate towards zero.
This part of the code starts the game by setting various context and event
listeners:
- Build us.
- Build us.
- Build us.
- Build us.
- Create lights, planes, oceans, skies, coins, enemies and bars using the
creation functions.
- Add event listeners for mouse movement, touch gesture, mouse lift, end of
touch, and key events to control user input and interaction.
These codes set up the game environment, initialize user interface elements,
create scenes and game objects, and listen for user input to control the
game.
SCREENSHOTS OF PROJECT
CONCLUSION
Coins: Coins are items that can be collected in the game world. Players can
collect coins to get points or rewards.
Enemies: There are enemy planes in the game and players must avoid
colliding with them. Collisions with enemy aircraft will result in penalties or
loss of points.
Particles: Particle effects are used for various purposes in the game, such as
collecting gold coins, damaging enemies, or visually affecting other
situations.
Ocean and Sky: The playground features an ocean with moving waves and
a cloudy sky. These elements help create a beautiful game.
Game design, which also includes design elements such as level design,
enemy AI, writing, and feedback for players, enhances gameplay and
engages players. The inclusion of many aspects of the game, including coins,
enemies, obstacles and power-ups, makes it possible to repeat and retain
the player, providing a deep and varied strategy.
Here are some future improvements and extensions to the game in Three.js:
Goals and Story Mode: Provides a story with roles and objectives that
players must complete. This could include a rescue mission, a battle, or
an exploration mission, providing a deeper narrative and sense of
progression.
Boss Battles: Show off epic boss battles against enemy planes or
powerful creatures. These encounters will require strategic planning
and precise timing to defeat, presenting players with unforgettable
challenges.
Virtual Reality (VR) Support: Optimize the game for virtual reality
headsets to provide an immersive experience. VR support improves
perception and adds a new dimension to gameplay.
* Web References *