
NPC is my major project from the second year of my advanced diploma. It is a slice of a top-down, hack-and-slash adventure with a narrative element. It was created in a team of nine students, consisting of me and two other programmers over 5 months.
Throughout the project I created the dialogue and narration systems, the saving system which stores where the player is currently within the story as well as which spells and weapons the player has collected, the UI for weapon and spell selection, the introduction cutscene and subtitles, the pause menu and settings functionality and the controller support.

In NPC the player does not speak but receives story from the Innkeeper in town who both gives some context to the game as well as issuing new tasks for the player to complete in the two areas of the game. Originally this system was created with the ability for branching dialogue trees with player options however as this was not needed for this project those features were cut.

The dialogue is made up of a series of scriptable objects which contain a string for who is talking, what their dialogue is, a command string, and a link to the following dialogue node. The command string is an input that can execute a function as the line is spoken to unlock new areas, load new scenes, open UI windows, and accept and complete quests. The command string splits the command from the parameter and executes the appropriate function using the command.
Currently the game is using an XML file to save both the state of any encountered quests and whether every weapon has been collected or not. When the game starts the player has the Songster's Saber and the Magic Missile however throughout the two levels the player can collect a Woodcutter's Axe and a Fireball spell. Each time the player leaves a scene the save file is written to and each time the player loads into a scene it loads the quest data into any quests currently in the scene that match the available data. Using quests with the same names in both scenes allows us to track quest data between two scenes.

The UI for the weapon selection in NPC is fairly simple. When the window opens it loads whether each weapon has been collected or not and locks them accordingly. As the player mouses over either the weapons on the left or the current equipment on the right it displays a short description of the equipment and a highlight indicator appears behind the item. Locked items will state they are locked and will appear greyed out like the Fireball above while unlocked equipment can be clicked to be equipped. This window is opened by a dialogue command when the player speaks to the Blacksmith NPC.
The introduction cutscene just displays an image and plays the audio clips for narration along with their designated subtitle. Once the audio clip finishes playing it either proceeds to play a linked clip that follows it or loads into the hub scene if no clip is linked.

The pause menu contains buttons to access the volume settings as well as returning to the main menu and the village if you are not already at the village. The settings are linked up to the audio mixer using a custom slider class that alters the appropriate channel in the audio mixer as well as saving this value in the PlayerPrefs to store the correct level between scenes.
After alpha testing the game it was decided we should add in controller support. I decided that with the time that we had left it would be smoothest to upgrade to the new input system which can handle both the keyboard inputs and the controller inputs with ease. I went about this by creating an input manager script that the new input system would write to and then each function that used the old input system could read my new input manager instead.
The manager contains a class for an Input which stores whether the button is up or down as well as whether it was pressed during the current frame or not. This gave me enough functionality to implement the support for this input system within the timeframe we had.
Comments