Escape Area 51 is one of the group projects that I have done in my second year of college. I was the main programmer/developer of the team and most of the code is written by me. It is an up-down view, stealth style 2D game. You will become an alien who crashed your aircraft in Area 51. Of course, your first task is keeping yourself alive and escaping from the lab!
Although I have given some suggestions when designing the game, I was not the one who designed the entire game, so I won’t mention a lot about the design work. Instead, I would like to talk about the development work I have done mainly.
The feature that I am most proud of is the AI of the guards. When the player throws an item and it hits the wall/stops (hits that ground, but hard to show in 2D), the guard will be attracted by the “sound”. So, the player can use this to distract the guard from his position. But those guards are not good-for-nothing, once they saw the player, they will chase him closely and it is difficult to get rid of them.
Besides, there are light in each room. If the player turns off the light, one of the guards will go and turn it on again. In the darkness, they can hardly see you. Use this smartly!
After showing off of all these features, I can’t wait to keep going how I made all of these. But before that, I think I should clarify that I didn’t code the pathfinding of the AI. I used A* Pathfinding Project to achieve all these cool features. Thank you A*!
To simulate the perceptions of human, especially visual perception and auditory perception, I used some tricks.
Firstly, for both perceptions, there is a collider that simulates the area that they can hear and see. For the visual one, of course, is the area that in fronts of them. And auditory one is, in this case, a big circle area.
When the player enters the collider for visual perception, a ray will be shot from the guard to the player. And it returns if there’s a wall (tilemap collider) between the guard and the player. I guess you know what happens next if you are also a developer. Yes, if there’s no wall between, the guard will get the position of the player character, and A* will take over the job: chase the player!
For auditory perception is a bit more complex. When an item is thrown away and stoped, it makes “sound”. In this case, it creates a game object of a sound source. In reality, the sound goes into peoples ear so can people hear. Thus, the human body receives sound passively. But I made a mistake here, in my code, the collider for auditory perception will detect if there’s any sound source object colliding with itself. Aha! Probably these guards have some gene from bats? Who knows?
Who turned off the light?!
Talk about the light, there’s a different way to achieve that. Since the game map is divided into [rooms], there a manager that manages everything that is inside the current room, including the guards. When the light of this room is turned off, it calls a method that informs the nearest guard to turn on the light. This manager also manages the rendering of all game objects inside the room. But sadly, the version we used for this project doesn’t have 2D light feature, so I have to use 3D light plus changing materials to achieve this.
Of course, until I demonstrated our game in the class, there were still some bugs that I couldn’t solve.
For example, the light system looks cool but sometimes the guard won’t go to turn on the light. When a guard needs to turn around, it acts clumsy and looks like a kid that gets lost in a theme park. And there are more bugs that I couldn’t remember. But for all, I and my team are pretty satisfied with what we have done, I can still remember they called me a magician when I demonstrate the guard AI to my teammates, my highlight moment! We also got a nice grade for this course. So I hope you will like it as well.
Please pull from the [master] branch.
Recommended Unity Version: 2018.4.8f1
Open the scene called [Final] in [Scenes] folder for demonstration in Unity Editor/Run the executable file called [GDY2P1Group1] to run the demo build.
How to play[W], [A], [S], [D] to move. [Mouse] to aim and [Mouse Left Button] to throw the item you are holding. , ,  to switch items. [E] to interact with items (pick up an item, turn of the light).
A* Pathfinding Project Retrieved from https://arongranberg.com/astar/#