First-person shooter (FPS) Video Game Using Ray Casting Algorithm

A personal computer has evolved where it can be used to perform various tasks such as 3D design, video rendering, and other similar activities. Video games are not an exception, and many individuals are turning to YouTube or Twitch streaming to earn money while playing video games on their computers. Developing a video game is not a simple task since the game's developer requires specific expertise to produce them. Without this knowledge, the developer would be unable to develop the video game. This project focuses on the application of the ray-casting algorithm. Ray casting is one of the algorithms that is frequently utilised in the construction of video games, particularly in shooting games. This is because the algorithm is straightforward and does not necessitate the use of high-end technology to conduct the ray casting algorithm. It will be necessary to construct a 3D shooting game for the ray casting technique to function well since this will allow for easier analysis of the accuracy of the bullet hitbox. This project demonstrates how ray casting works based on all the results made while developing the game prototype. This project focuses on becoming an example for other video game developers to develop video games using the ray casting algorithm.


Introduction
and other applications rely on ray casting, which is the most fundamental type of raytracing available.When compared to other forms of ray-tracing, in which rays start from a light source and bounce off objects before reaching the observer, ray casting is distinguished by the fact that rays are "cast" straight from the viewpoint during the process.In the ensuing image, each time one or more cast rays intersect an object, the colour and brightness of the object at that precise point determine the value of one pixel in the final picture.It is represented as a direction vector that extends ahead in time, which represents the observer's orientation which has been stated by Computer Hope (2019).As an Vol 12, Issue 3, (2023) E- ISSN: 2226-6348 To Link this Article: http://dx.doi.org/10.6007/IJARPED/v12-i3/19205DOI:10.6007/IJARPED/v12-i3/19205 Published Online: 20 September, 2023 additional need for almost all methods of ray casting, a "camera plane" that is perpendicular to the direction vector and represents the geometry of the final displayed image must be used in conjunction with the ray casting.Figure 1 shows the example of ray-casting scenario pointof-view in the algorithm.
Figure 1 Ray casting scenario view (Source: ComputerHope.com,2019) It is possible to create three-dimensional images from a restricted set of data by tracing rays from the viewpoint into a viewing volume, which is achieved by ray casting techniques.It is important to understand that rays can be cast and traced in groups based on geometric limitations, which is the fundamental notion of ray casting stated by Techopedia (2019).The intersection of all objects in the picture is computed by casting a ray from the pixel through the camera in the ray casting process.Following that, the pixel value from the nearest intersection is acquired and used as the foundation for the projection.When compared to ray tracing, ray casting is a rendering method that never recursively traces secondary rays, whereas ray tracing is a rendering approach that can recursively trace secondary rays.In addition, when compared to other rendering methods such as ray tracing, ray casting is extremely simple to implement and operate.It is simple and quick to use ray casting since only a single computation is required for each vertical line of the screen.Ray casting is faster than ray tracing because it is constrained by one or more geometric restrictions, as opposed to ray tracing.Another reason why ray casting was the most common rendering technology in early 3-D video games is that it allows for more realistic lighting effects by Techopedia (2019).This project studies the application of the ray casting algorithm to see how it can be developed and applied in a first-person shooter video game development.The current graphical processing technology for computers focuses on ray casting technology and therefore, it is imperative to have an academic understanding of how ray casting algorithm works.This project is important for students of multimedia discipline where they will have an insight into ray casting technology and the opportunity to further explore the application of ray casting in video game development.

Objectives
• To design a video game prototype that can be used to test the selected algorithm by using the ray casting algorithm.• To develop the ray casting algorithm based on how the aiming hit box bullet shot on an object in the prototype game.• To test the functionality of the proposed aiming game.

Problem Statement
An issue that arises is when choosing which aiming detection algorithms are the best ones and how we best use them.If the game developer did not concern about the accuracy of the bullet that is being shot using a certain detection algorithm, then players will not be interested in playing that game.Jung (2019) has concluded that there are too many algorithms for bullets to be detected when hitting an object.As an example, when players shoot their gun to hit another player/object in front of them, which algorithm is the best to choose to detect the bullet hitbox is still open to debate.Another obvious issue is the cost of the required hardware to implement this project since new technology in algorithms is best to run with the latest hardware technology to properly produce the best results (Anik et al., 2019).

Methodology
Unlike Software Development products, which are always developed in response to a problem that has already been identified and for the purpose of providing an answer, Game Development products are developed for entertainment purposes to engage people in having fun, learning, and spending quality time with one another.This will demand the development of an original concept, a storyline, and writing ability in addition to technical competence to complete the product.Since developers must contend with a variety of obstacles during the development of the project, including artwork, visuals, animations, character interactions, collisions, physics, and sounds, among other things, we must use a specialized approach known as the Game Development Life Cycle (GDLC) (Jain, 2017).There are 6 stages in the game development life cycle (GDLC): Idea & story, Conceptualize & Design, Technical Analysis, Development, Testing and Deployment.These stages are crucial to follow when game developers want to develop a new game in their workspace.The GDLC is being applied in a waterfall model paradigm.As (Game Development Lifecycle Models, 2021) stated, this paradigm was particularly popular during the early years of video game production (from the 1980s to the mid-1990s), when the requirements remained unchanged throughout the development process.It is suitable for usage in modest game development projects.To conceptualize and realize the prototype for this project, the system design and the physical design will be combined to provide a more comprehensive picture of how the proposed application would function.This step is critical because it allows for the incorporation of information gained from a collision detection algorithm study into the design of the physical system.There are three main system design activities: a) FPS Game Asset Requirement Acquired It is necessary to download the asset to be used from the Unity Asset Store, which is completely free before the video game can be developed.This is necessary because the project's goal is to test the efficiency of bullet hitbox detection by using the gyroscope, rather than the graphical design, of the video game.One FPS Asset on Unity Asset Store can be downloaded, regarding which pack is used (Stenfors, 2019).3, there are many FPS packs that can be downloaded free in Unity Assets Store, regarding which platform you want to use, it got all platforms available.From FPS pack to 3D character can also be got from that store.b) Character Customization After the FPS Pack Asset has been downloaded, the move set for the character is defined.This is critical since it has a direct impact on the bullet path and hitboxes that will be used to offer effects to the activities that are being performed (Unity, 2019).For example, if the player starts shooting, the hitbox detection will only apply to the bullet that travels through the target and not the rest of the projectile.Another example is that when a player throws an explosive, the dynamics of the explosive dropping will be implemented.Looking at Figure 4, we can see that when a character fires a gun at the target, the following happens: It is planned to use the ray cast technique to fire the bullet, which will hit the designated target.The term "frame and recovery" refers to the amount of time that passes before the hitbox appears, the amount of time that it remains as a hitbox, and the amount of time that it takes to return to the idle state.Factors like this also have an impact on how well the fluency of the bullet hits the target and can have an impact on how much fun you have while playing the game.Based on Figure 5 shows the flowchart of the attack animation that's going to be implemented in this project.A flowchart is an important thing to check whether the animation or the attack animation of the character in the game is a success or a failure.The ray casting algorithm was used in the development of the game, and it was put through its paces numerous times to ensure that the ray cast functioned as intended.
Figure 5 The cycle of attack animation on First Person Shooter games

Results and Discussions
This section discussed the system's design, development and testing in designing and developing a "First-Person Shooter (FPS) Video Game Using Ray Casting Algorithm": a) System Design A good game design system reflects how the system will deliver the overall content of the system without letting the user interfere with any of the technical defects.This subsection will further be explained the details of the game design starting with the game flow.Figure 6 below shows the overall flow chart of the game flow for "First-Person Shooter (FPS) Video Game Using Ray Casting Algorithm".The flowchart also tells how the gameplay starts from the beginning until the game is ended.The system development can only be started after the design works were completed.During this phase, a step-by-step development and implementation would be performed on the system.The activities involved are developing an application system.Table 1 shows the description of the user interface design of the proposed game.
Table 1 Final version of the user interface description Interfac e

Description
After pressing play, the player will respawn at this area, which is where they started from when they pressed play.
This is where the player leaves the spawn room and begins their trip.
The player must pick whether or not to go forward or to the right room in the building in this section.This is the point at which players stop progressing and instead visit the model and material room where they may view the models and materials used in the project.This is the point at which the players move forward to the front room.The shooting room is divided into three sections: an explosive barrel, a dummy target, and an explosive gas tank.c) Functionality Testing Functionality testing is performed against test cases to validate the requirements of the system and to examine the outcome based on the input that has been specified.The crosshair cannot work properly because it was invisible, after using IsCrosshairVariable function to make the crosshair visible Testing Result Crosshair functioning as well

Conclusion
In conclusion, the first goal of the project was to design a video game prototype that could be used to test the selected ray casting algorithm within the video game.This was the method by which the design for this project was created, using a variety of models and materials.The project will make use of a 3D model to ensure that the design is visually appealing and of high quality, as well as to make it more realistic for users to play the game while participating in it.

Figure 2
Figure 2 Game Development Life Cycle on Waterfall Model (Source: Game Development Lifecycle Models, 2021) Prototype Conceptualization and Realization

Figure 3 FPS
Figure 3 FPS Pack at Unity Assets Store (Source: Stenfors, 2019) Based on Figure3, there are many FPS packs that can be downloaded free in Unity Assets Store, regarding which platform you want to use, it got all platforms available.From FPS pack to 3D character can also be got from that store.

Figure 4
Figure 4 Overview of the character shooting a bullet at the target (Source: Unity, 2019)

Figure 6
Figure 6 Overall game flow chart for First-Person Shooter (FPS) Video Game Using Ray Casting Algorithm Every test case will be tested and explained in each subtopic below: i. Character Movement Test Objective To test the Movement of the character's fluidness.
Test Procedure Actual Test ResultThere are some bug in the process with the making using the current code but have been fixed with movement variable First when data has been input, the ray casting cannot be detected but with tweak and using physics function, Ray cast detect normallyTesting ResultRay casting of the bullet successfully functioniii.Testing Crosshair Implementation Test ObjectiveTo test the crosshair of the weapon for ray casting development