Muder Mansion is mystery detective game where you are the detective. Your job is to figure out what have happened and who have done it by talking to all of the witnesses and suspects. But be aware, the criminal will use lies and decite in order to persieve as innocent.
Muder Mansion is a project for the course DD1367 (KTH) requested the company Folke&Partner. Folke&Partner have agreed to make us developers the product owners, meaning that we collectivly own all of the code and not Folke&Partner, although they are free to use it how ever they seem fitingly.
This project uses the following resources: ChatGPT.
The ChatGPT API, powered by Azure AI within Azure OpenAI Studio, is a cutting-edge tool for integrating natural language understanding and generation into applications. Leveraging state-of-the-art machine learning models, such as GPT (Generative Pre-trained Transformer), this API enables developers to build chatbots, virtual assistants, and other text-based AI applications with ease. By sending text inputs to the API endpoint, users receive coherent and contextually relevant responses generated by the AI model. With Azure AI's robust infrastructure, the ChatGPT API ensures scalability, reliability, and security for diverse use cases across industries.
-- ChatGPT
In order for you (the user) to play this game, you will need to copy this repository to your device, with C# installed, so that it has access to C#. If the machine does not have C# installed then we recommend the installation guide provided by Microsoft official website regardless of the operating system.
Note: This project was made using SDK .NET 7.0.116. Please confirm that your version of C# is compatible with the projects version.
After having installed this repository, open up a terminal and change the directory to the correct path address. This can be done by typing the following command in the terminal: cd murder-mAInsion/src. All that is left to do is to build an C# enviroment (type dotnet build in the terminal) and run it (type dotnet run in the terminal). All that is left is to play and enjoy, if you are unsure about the controlls, try to follow the instructions under How to play.
Note: This was made using Azure.AI.OpenAI --version 1.0.0-beta.5.
We recommend to install the .NET library via NuGet. This can be done by typing the following into the terminal: dotnet add package Azure.AI.OpenAI --version 1.0.0-beta.5. Make sure that your version of C# is allegable to run and compile the program as well as use the Azure.AI.OpenAI library.
Once the game is up and running, then all you have to do is follow the instructions in the menu and thereafter find who dunnit.
- A video game designed to showcase the use of AI for NPC interaction.
- AI (ChatGPT) must be used to generate most of the story.
- ChatGPT should be accessed through the ChatGPT API.
- The playtime should be around 15 minutes.
- The dialogue has to affect the game state and the game should progress from playing and interacting with the NPCs.
- NPC agency.
- The NPCs should be capable of doing more than just giving answers to questions.
- A clear victory condition is needed.
- The NPCs should be the key to reaching that goal.
- It should be possible to analyze if the NPCs behave in the correct manner.
- It should follow the identity stated by the programmer.
- NPCs and story should be defined in a readable file format (e.g. JSON)
- The game should be turn-based, meaning there is some waiting time between actions.
- This is because the current state of the ChatGPT API doesn’t allow for real-time responses.
Following these business requirements, stated above, a concept game is conceived. The current name is Murder Mansion and follows a murder mystery-type game where players are confined to a select few locations with no external factors. At the beginning of the game, someone is murdered and it’s up to the player to gather clues from the NPCs about who the culprit is. One further addition that isn’t required, but that could propel the game further is to have an assistant NPC that also can ask questions and interrogate the suspects.
The minimal viable product will be a terminal (text based) murder mystery game which is turn based (business requirement 7a). Where each playthrough is relatively similar since key points of the story and method of the murder will be selected beforehand (business requirement 1a). However, the majority of the story will be generated through the use of AI (business requirement 1b). Each iteration/playthrough of the game will take around 15 minutes of consistent game time (business requirement 2).
The NPCs will have memories of the story, both before the day of the murder as well as from the day of the murder (business requirement 3). These memories are in their entirety enough to solve the mystery. Individually none of the innocent NPCs will have enough information (evidence/memories) to definitely pinpoint who the killer is, but they will be able to do it collectively (business requirement 5a). The NPC murderer will use lies and deceits in order to be perceived as innocent from the player/detective's perspective (business requirement 4a). When the player interacts with the NPCs as intended (like a detective) they should respond as the characters from the story. Each character has their own quirkiness and personality generated by AI, e.g nervous Larry or defensive Tom. They should be able to speak coherently about their own memories and perspective, but not have access to other NPCs' memories. The game's victory condition is based on the player's final guess, which is determined by ChatGPT.
One requirement from Folke&Partners is that all the information regarding the game (story, NPCs, possible items, etc.) must be in files, for example a JSON-file. A storage file enables for testing of the generated content. That makes it possible to compare game scenarios, NPCs and events so that they differentiate from each other with each playthrough (business requirement 6). Furthermore it allows for project scalability. The game/project can be scaled and developed further once the MVP is achieved.
These specified requirements can satisfy all of the business requirements stated above. The requirements are functional as they describe how the system should act. One of the requirements (business requirement 6b) is a data requirement since the ChatGPT API has to generate data which has to be used in the MVP. The MVP and its requirements have been confirmed by Folke&Partners. They also fit the criteria for validity, consistency, completeness, and realism.
Folke&Partners want us to develop the project further than the MVP, where the finished product should have ChatGPT generate the NPCs' personalities and descriptions as well as the entire mystery: who and how an NPC will murder someone. The NPC will decide on the method of the murder which can be influenced by the location of the murder. As an example: if the murder occurs in a kitchen, the method could include a kitchen knife. Other NPCs can then find physical clues about the murder or they can remember details as to whom the victim was last seen with or if they talked about something. This will allow for a more versatile gameplay within the predefined confines of the game, taking into account both development time and playtime.
Furthermore, the NPCs should have more agency than just talking to the player, they should be able to make decisions. This can be done through multiple ways that are up to the discretion of the development team. One possible way to include this is through an assistant NPC that can ask questions and make their own deductions to who the killer is. Another possibility is to have the NPCs either alter evidence or, if there are multiple killers, conspire with each other based on how the player acts. To clarify, the goal is to have the NPCs be able to do more than just respond to the player. To expand on this as a so-called need (something that is required, but expand on the MVP), each NPC can have a different agenda which will make the story more intricate.
Something that is not required, but that should still be implemented if time allows for it (want) is to have a graphical interface, which would allow the player to interact with the NPCs in a more immersive way. Because of the limited time and scope, it can only use simple two-dimensional graphics with a top-down view. This will also allow for physical clues to be inserted into the game. In order to limit both the actions of the NPCs and time spent both on developing the graphics and on playing the game, it should be placed in a confined place with only a few rooms/locations.
A final want is a system being scalable through adding more NPCs without sacrificing the coherency of the story. The system should work even when the number of NPCs exceeds five or even ten.
We strive to follow the official C# coding convention provided by Microsoft. For further information regarding the convention as well as guidlines, check out the official guidlines.
Comments: All of the comments should describe the code that it follows, i,e comments should be placed either above or to the right of the code.
Variables: All of the variables should follow the standard naming convention for C#, which is a combination of primarly PascalCasing and CamelCase when naming private or internal fields as well as local variables, including instances of a delegate type.
Files: All of the files should be named and located in the correct folder according to its purpose. Look at the currently avialable files and folders, and try to follow their example.
Branches: The branches should either be named after issues or features. The branch name it self should start with a lowercase letter. if the branch is focused on features then it should follow CamelCase otherwise it should use a variation of snake_case that uses either hypten or backwards slashes depending on the branch purpose. For further information checkout the current and closed branches and try to follow their convention.
Issues: The name of the issue should try to clearly distinguish itself from others. They can be implemented manually or from the project board which is the prefered way in order to connect issues with branches. Labels and assigness isn't mandatory but they are greatly appreciated.
Projects: The project board should be updated continously throughout the project. When a feature is succesfully implemented, check it off in the project board and if changes are needed or bugs appear uncheck it.
The project was created and originated by:
- Fredrik Magnevill (Github: Alucad0, Email: fredrik.magnevill@gmail.com)
- Eddie Kero (Github: eddiekero, Email: eddie.k.a.kero@gmail.com)
- Bernard Rumar (Github: Bern4rdR, Email: rumarbernard@gmail.com)
- Mandi Liu (Github: M4nd1L, Email: mmanddii@gmail.com)
- Eskil Gunnarsson (Github: EskilGunnarsson, Email: Eskil.ca.gunnarsson@gmail.com)
- Haiyue Zhang (Github: yuenj-z, Email: haiyuenj@gmail.com)
- Edwin Wästlund (Github: edwinpedwin, Email: edwin@wastlund.net)
- Adam Viberg (Github: adam-viberg, Email: adam.viberg@gmail.com)
We would like to give a special thanks to Folke&Partner for providing us with the neccesary resources and as well as our mentor Roberto Guanciale
Preferably contact us developers via Github or mail.