Introduction
Our final project introduces an immersive VR game with a thrilling hostage rescue theme. Upon entering the game, the player is transported into a dungeon environment, armed with a gun equipped with 50 bullets. With 100 hit-points at their disposal, the player's mission is to eliminate all incoming enemies that stand in the way.
To navigate through the virtual world, the player can utilize the joystick on the left-hand controller, allowing fluid movement and use the left index trigger to fire their weapon. Furthermore, players have the ability to jump as they would in the real world, enhancing the sense of realism within the game.
Each enemy also possesses 50 hit-points of their own, making it imperative for the player to ensure the elimination of all enemies before the hostage can be rescued. Scattered throughout the dungeon, health kits offer a lifeline to the player, and with a simple button press, they can retrieve these kits to replenish their health.
A timer ticks for 3 minutes. Once the time is up, the game is over and the hostage is killed. This impending threat constantly weighs on the player's mind, heightening the adrenaline rush.
With limited resources, formidable enemies, health kits to discover, and a relentless countdown, players must strategize and act swiftly to succeed in their mission and emerge victorious!
Obey the Law
Background
Tactical shooting games have gained popularity as competitive sports because they offer users a thrilling and immersive experience. The strategic aspects, such as navigating game environments, executing precise attacks, and outsmarting opponents, contribute to their appeal. Games like Into the Radius, Obey the Law, and Crashland, available on the Oculus Quest 2, have expanded into the realm of virtual reality (VR) and attract a significant following [1].
Our motivation for this project stems from the widespread appeal of shooting games and the noticeable absence of VR games with a hostage rescue theme. While games like Onward and Resident Evil 4 have survival themes, they don't specifically focus on saving a hostage [1]. Furthermore, this project presents a fantastic opportunity to incorporate the graphics, audio, animation and locomotion concepts we have learned in this course. Lastly, there is significant potential for creativity in terms of defining the gameplay, which we aim to showcase in our final demo.
Resident Evil 4
State-of-the-art
Our project draws inspiration from the popular game Resident Evil 4 on Oculus Quest 2. This highly acclaimed game has garnered popularity among Oculus Quest 2 gamers, primarily due to its realistic combat mechanics, immersive weapons, and captivating animations. Players have expressed that the VR version surpasses the PC counterpart in terms of enjoyment and engagement, as the VR accurately captures the fear-inducing moments from the original game. The detailed environments, character models, atmospheric effects, and sound design contribute to an even more thrilling experience, and the ability to physically look around and interact with the in-game environment adds a new level of immersion and tension, enhancing the overall gameplay experience [2], [3]. These strong aspects of Resident Evil 4 serve as the foundation for our project's implementation.
However, it is important to acknowledge some of the common issues associated with VR experiences, which also apply to Resident Evil 4. Motion sickness has been reported by users, as the game's movement mechanics can be disorienting and cause nausea. Prolonged gameplay sessions may lead to eye strain due to the game's multiple levels and intense visual stimuli [2], [3]. With these considerations in mind, our project aims to address and mitigate some of these issues, ensuring a more comfortable and enjoyable experience for users.
Implementation
In our proposal report, we outlined the minimum tasks required for the project, and we were able to implement all of them. Here is a summary of the tasks:
Game Mechanics:
Developed a single player game where the player's objective is to eliminate terrorists and rescue the hostage.
Implemented logical behavior for the terrorists, creating dynamic and challenging encounters.
Established the logic for gunshot mechanics, hit registration, and management of the player's health.
Included collectible health kits throughout the virtual environment to allow for health regeneration.
Graphics:
Created a visually immersive virtual environment consisting of multiple rooms with interactive targets for the player to shoot at.
Designed and incorporated high-quality 3D models for the counter-terrorists, terrorists, hostage, and weapons.
Developed a user-friendly graphical user interface (GUI) featuring a timer, health bar, and bullet count
Audio:
Implemented realistic and immersive audio effects, including authentic gunshots and footstep sounds, to enhance the overall gaming experience.
Locomotion:
Integrated a joystick-based locomotion system, allowing players to move around the virtual environment with ease and precision.
The player can move in the environment using the left joystick.
The locomotion was made more realistic by allowing variable speeds for different types of motion.
Forward: The fastest way to move
Moving left or right, when looking forward: Slower than forward motion
Moving backward when the camera is looking forward: Slowest amongst the three modes
Locomotion also incorporates tunable acceleration and deceleration values to mimic delayed starts and stops.
The above changes mitigated the problem of feeling nausea since it is more natural to the human body.
Combat: If player is in attack range or if they have been attacked by the player, then the enemy automatically starts shooting bullets
Gun logic: Physics based which adds set amount of force to the bullet game object in the direction of player's transform
Benefit: Easier to visualize the bullet coming towards you. Player has a chance to dodge it.
Since there are multiple enemies being spawned, raycasting could have been an expensive option to add for all them.
Unlimited bullets
Can’t dodge player’s bullets
Health: Starts at 50 decrements by 10
Combat: Player can shoot bullets whenever they want
Gun Logic: Raycasting to check if the enemy's collider has been hit when player presses the trigger
Benefit: Raycasting has more precise hit detection, and we have rendered a line for visualization so that player knows where it is aiming.
50 bullets plus the health kits for regeneration
Can dodge enemy’s bullets by moving using joystick or jumping
Health: Starts at 100 decrements by 10
AI Enemy
To make encounters more realistic in our game, we have implemented intelligent behavior for our enemies. By adding a Nav Mesh Agent to the enemy, we enable the enemy to navigate through the scene efficiently. We define walkable and non-walkable areas which prevents the enemy from unintentionally colliding with walls or other objects. The agent has a set destination property, which allows it to move towards specific target locations. Further, we can adjust the agent's speed, acceleration, braking and other properties as depicted in the image on left.
Initially, the enemy operates in a patrolling mode, actively scanning its surroundings for the presence of the player. Using Physics.CheckSphere, we determine if the player's collider overlaps with a sphere centered at the enemy's position. A variable called playerInSightRange determines the radius of this sphere. If the player is within this range, the enemy transitions from patrolling to chasing mode, employing the set destination property to move closer to the player's location.
Furthermore, we have another variable playerInAttackRange, which assesses whether the player is within the radius of the attack range. If the player is within this range, the enemy stops chasing and shifts its focus to attacking by shooting bullets at the player.
The main hall where the player spawns
The basement that can be reached upon taking the spiral stairs
Sandbags to take cover for the player
We created a low-poly dungeon map using the Broken Vector assets pack
The map consists of two floors, including a basement which is connected using a set of spiral stairs.
The enemy spawns were tactically chosen such that the player needs to be able to position themselves tactically so that they don't get shot at easily, and at the same time it's not impossible for a casual player to win.
Sandbag assets were spawned all throughout the map which can be used by the player as cover to tactically approach the enemy, which they can utilize to avoid getting shot at by crouching.
We streamlined the map of the dungeon by blocking off unnecessary rooms with walls and other assets to prevent users from getting lost in the dungeon.
We used the royalty-free website to source the animations and the character models (Mixamo.com).
We used a soldier character model for the terrorists and a civilian model for the hostage.
For the enemy, we had a number of states, each triggering an animation. The transitions between each is controller via the Animation Controller in Unity.
The hostage had only one looping animation, which is "terrified".
The Animation Controller in Unity is a state machine-based tool used to manage and control animations within a game or application.
It allows developers to create complex animation behaviors through transitions between states and blending of animation clips.
Parameters can be defined to influence transitions and animations can be layered for more advanced character movements or object behaviors.
The Animation Controller can be edited visually and scripted to enable dynamic and runtime animation changes based on game logic or user input.
For the enemy, we had 4 flags that are controlled by the scripts, which in turn trigger transitions in the animation state machine.
isStand: The default state for the enemy. Triggers an idle animation where the enemy breaths and looks around
isShooting: Triggered if the enemy "sees" the user, i.e. the user is in the sphere of awareness of the enemy. The enemy starts to shoot the player
isHit: Triggered if the user shoots the enemy. The enemy stops shooting and reacts to the bullet impulse. We found that this animation improved the immersion since the enemy is virtually life-sized.
isDead: set if the enemy's health is zero or below. Triggers a death animation.
The Animation Controller allowed for smooth transitions between different animations.
Top: Hostage animation
Bottom: Enemy animation
We have enriched the game experience by incorporating ambient music using the Steam Spatialized audio plugin. The selected soundtrack is designed to evoke a sense of energy and urgency.
We added gunshot audio to the enemy and player's gun which is played every time a bullet is shot.
The acceleration based locomotion mentioned above was leveraged to make the footsteps sound more natural.
A single footstep audio is played whenever the player covers a distance x, which is tracked by a distance travelled counter. This enabled in faster motion generating faster sounding footsteps (mimicking running) and slower motion generating much slower footsteps.
Audio was optimized to play only when the player's foot is in contact with the ground or any solid object, hence avoiding playing of the audio while jumping and other maneuvers, adding to the realism.
We've improved the player's immersion in the game by incorporating haptic feedback to gun shots.
A Unity OVRHapticClip is created and inferred from the audio clip for gun shots.
We chose a short and internse sound so the vibration can be likewise.
Special Effects
We implemented special effects to elevate the gameplay and heightened the sense of realism.
Gets triggered when enemy is shot
Gets triggered when enemy or player shoots
Gets triggered when bullets collide with objects in the scene like chair, tables, walls, boxes, etc.
The image on the top left shows the various UI elements we have incorporated.
Timer: Located at the top which runs for 3 minutes. Once the time is up, the game ends and player or enemy cannot move.
Player's health bar: Located next to timer. Player has 10 lives and once it gets hit 10 times it dies.
Enemy's health bar: Located above the enemy. Enemy has 10 lives and once it gets hit 10 times it dies.
Bullet counter: Located next to the gun. Once player runs of 50 bullets and all the enemies are not dead, the game ends.
The image on the bottom left shows health kits. Each kit adds 2 more lives for the player. These health kits are generated at random spawn points, prompting the player to actively search for them. However, we have ensured that the spawn locations are reasonably visible and players can locate them without undue difficulty.
Demo
Future Work
In our future work, we plan to introduce exciting additions to enhance the overall gameplay experience. One of the key features we aim to implement is multiplayer functionality, allowing players to engage in both player-versus-environment (PvE) and player-versus-player (PvP) modes. This will bring a new level of excitement and competition as players can team up to overcome challenges together.
To further immerse players in the virtual world, we intend to incorporate rigid bodies into various objects within the environment like the chairs, table, sacks, etc. This addition will provide realistic physics interactions and add authenticity to the gameplay. Additionally, we plan to introduce a player avatar, allowing individuals to have a virtual representation of themselves and enhance their sense of presence in the game.
To make the gunplay mechanics more captivating, we want to explore additional utilities like drones that players can deploy strategically to gain tactical advantages like scanning the area for enemies and gun shields to provide protection from enemy's bullets.
In order to elevate the overall storytelling, we will focus on improving the animations and incorporating immersive cutscenes. By refining character movements and actions, we can create more lifelike interactions. Additionally, carefully crafted cutscenes like hostage getting executed by enemy or getting saved by the player will help convey important narrative moments and provide players with a cinematic experience.
Lastly, we plan to implement an interactable user interface (UI) that will enable players to easily navigate through the main menus and access vital information at their disposal. We aim to enhance the overall user experience through it.
With these developments, we hope our project will evolve into an even more captivating and immersive VR experience, providing players with better gameplay features, visual fidelity, and opportunities for multiplayer engagement.
Contributions
Ahmed:
Soldier and Hostage animations
Locomotion - basic locomotion using joystick
Haptics
Sanjali:
AI Enemy
Enemy and player shooting and heath logic
Special effects
UI - Logic for health, timer and bullet counter
Shyam:
Audio
Setting up and integrating environment
UI - changing health and timer from numbers to bars
Locomotion - optimizing locomotion, adding jump
Please check the README file on our GitHub repository. It provides a detailed log documenting the specific actions and achievements of each team member during the project's timeline.
References
[1] A. Walia, “The best VR shooter games for the Meta Quest 2 (aka the Oculus Quest 2),” Game Rant, https://gamerant.com/oculus-quest-2-best-vr-shooter-games/ (accessed May 15, 2023).
[2] D. Flynn, “Resident evil 4 VR review --- dream girl evil,” GAMING TREND, https://gamingtrend.com/feature/reviews/resident-evil-4-vr-review-dream-girl-evil/ (accessed May 15, 2023).
[3] T. Lyles, “Resident evil 4 VR review,” IGN, https://www.ign.com/articles/resident-evil-4-vr-review (accessed May 15, 2023).
This report has been enhanced with the help of ChatGPT to improve the phrasing and wording of certain ideas and concepts for better clarity and brevity.