Foreward
This was a outdated project that I made for my Final Year Project. At that time, I was not so good at Unity3D, so many things looked so ridiculous from present perspective view. But I still wanted to introduce this project because I put a lot of my passions and efforts into this project, and it improved my Unity skills a lot at the same time.
Introduction:
Prisonland is a first-person strategy adventure game, who assumes the role of a prisoner, must escape the prison in 7 days. In any single day, the player is required to do everyday events, for example, sleep, roll call, wash, work, and so on.
During the routine, players may acquire different tools, keys to aid in their escape. What’s more, some accident events may happen accidentally or advisedly caused by the player, like riot and power cut, in that disorder situation, it is the best chance to run away.
The player can also talk to other NPCs to acquire information about critical items, and the defects of the prison. A single prison should have more than one way to escape out of prison.
The player must avoid discovery by the correctional officers when doing wrong. Therefore, the player needs unique ways of movement, like moving in the vent, or moving at night with the flashlight. Patrol guards will patrol among several points and keep inspecting surroundings. If they catch player violating rules, they will give the player penalty. To protect themselves, players can use the Taser gun to overload the robot guard temporarily.






My Contribution:
I was the only programmer in this game, so I did all the programming task. Also I was responsible to build the level; Setting lighting and post-processing; Writing Narratives and design the User interface.
The following block will introduce the implementation of the whole game.
Implementation and technical stuffs
1. Player vs Environment
This part introduces how the player interacts with Environment and AI.
In Unity3D, any script that inherited from MonoBehaviour can be attached in a Unity GameObject, else other a regular class, which need a constructor to create an instance.

The Interactable class defines the object that the player can interact with. The script manages the Player UI to show/hide the hint UI when the player can / cannot interact with the object. Also, the player can add additional pre-request in its child class, who inherits from Interactable by overriding the virtual [Interact ()] function in Interactable class. So, the programmer can call the public Interact function in an upper class and also check restricted request in the child class.
What’s more, another advantage of the design is the AI can interact with the Interactable object as well. For example, the door; Player can open it by pointing to the handle and press keyboard. But the AI do the same thing by calling the AIInteract() in Interactable class, no need to rewrite another script to control the door.

That’s how the player interacts with the environment, and the similar way also applies to the interaction to item and equipment.
2. Player vs System

Although the outcome did not show too many event and mission system, I want to talk about it. In our game, the player should follow the prison time-table to do routine events, like roll call, having lunch, doing work. Moreover, how can those kinds of abstract behaviors combine with the game situation? I classify the behavior into 3 genres.
- Interaction mission: the player needs to interact with specific objects, like NPC, some environments, like a bed. E.g. In the lunch events, the player need to interact with the food, so the mission finished.
- Movement mission: the player needs to move to a certain area. E.g., When the player needs to sleep, he should go to his cell room first.
- Status mission: some statuses of some object need to be changed, like to knock down someone, changing their health points.
After having this 3-basic type, I can create a new class to inherit from them and create a specific restriction on them.
The prison Event is a parent class, including all primary Evaluation function and parameters to define the property of a Prison event. Any single routine event inherits from it.

The example is a Sleep routine, it inherits from PEvent (Prison Event), and initializes many parameters, creating two new missions and updating the UI.

Inside the PEvent, it keeps updating the remaining time, when the time is up, and the player still not yet finished all missions, it regards it as fail.
The remaining time shows up in the task list UI.
Floor map


The labeled colors are regions that I define for the player like the red one is the toilet area, to fulfill the Move Mission requirement. When the player goes to another region, something may happen or can happen, which can be defined easily by the programmer.
What’s more, the map is also an item that the player can pick and equip. When the player equip the map, the player’s position shows on the relative position in the map.

Additionally, in the story, the map is offered by Leon’s buddies, so some critical item, password, the item is marked in the map. So, this item is essential for promoting the main storyline.
Day-Night Shift
Since the player can move at night, so the lighting problem has to be solved.
The baking area light can give a good shadow, ambient occlusion, and detail indirect reelection. However, it is not real-time; I cannot control the intensity in run-time.
The solution is that I use low-intensity area light as the night-light and use the point as daylight. When the night is coming, I turn off the point light.

Also, the left-hand figure shows the simulating sun in the scene. The time changes relatively comparing to real-time, and the rotation of the directional light may change according to the game time.

By the way, the time table in prison or station also bases on the global Prison time.
GUARD AI
I classified the Guard into two types, the moving one, and static one. However, they share similar properties.

The Guard is the top parent class; their class defines the specific guard.
There four important function script that can attach any guard.
Patrolling.cs

Guard patrols among several points. It can be any number, as small as 3 up to 20.
(I should have get the object by type in the start rather than drag objects into the scene, which was a stuip way to do this.)
When the guard arrives at one point, it has chances to stop and look around with its head. Then go to the next point.
Since there is a setting about the robot guard need to charge, so I make a rule that any guard needs to sleep should go to the charging place and stop functioning when it is time to sleep.

In the next day, they go back to work again. However, sometimes there is a kind of robot that patrols the whole day, even at night. This setting makes sure that they should also be careful when moving at night.
Aerting.cs

The alert range contains two parts: the self-sphere and the front-view. If the player is in those areas, and the ray casting from guard’s head can hit on player’s body, the player is in alert range. The alert level keeps going up until the guard notice the player. The reduce the level, the player need to leave the range.
(I realized that what I designed before was so similar to pawn-sensing in Unreal4 Engine for AI movement and detection. I did not know that before)

The guard UI is to tell the player how much the guard is alerting.
When the alert bar is full, which means that the guard is alerted, it gives a chance for the player to surrender.

If the player moves out of the blue circle, the guard will treat it as resisting, and chase, fire to the player.
Chasing.cs and GuardShoot.cs

When chasing the player, the guard will speed up, and keep a certain distance to the player to shoot the player.
The guard shoot is a standard shooting script. The diffuse level is to control the accuracy of the shooting: the higher the value, the lower the accuracy.
LoseSight:
If the guard can not see the player for certain seconds, it will think that the player has gone, and stop the chasing, reset to work.

This UI helps to let the player know if he ran away.
Once the guard sees the player again, the loose sight time goes back to 0, the player need to hide another second.
The moving guard will send 25% of max Hp of player damage to the player, but the static guard will kill the player in one shot, and this shoot has no diffuse.

If the player get close to them, they will raise a dialogue warning, and if the player moves further closer, they will start to shoot.
Gameplay video and presentation material
Presentation
