Dev Log - Multiplayer Social-Deduction Game #3
third in a series of dev logs for my connected games module.
🎮 Introduction
In this third update I’ll be focusing on the data design for the game. For those of you just joining, you can catch up on our initial steps and challenges in Dev Log #1 & Dev Log #2. I set out to create a functional data structure for the cases in our game. Let’s get into the details.
📋 Requirements
The objects are composed of a series of ScriptableObject classes. These would all be organised under a collective namespace CGD.Case. The game was designed to introduce unique or randomised cases on each playthrough, with the goal being to solve the crime before the other players. With that there were 3 requirements which I set out:
💾 Serializable
the aim was to make the entire system serializable. One of the considerations for the game was live-ops in the form of periodical new case updates. By designing it this way, it enables us to store these objects in an SQL database and retrieve them on the clients on startup.
🎭 Random Case Generator
One of the stretch goals was to create a case generator with the aid of AI tools like ChatGPT. To get consistent/repeatable results, we needed to have a robust structure with a focus on delivering narrative elements through text.
🛠️ Custom Editors
As a lot of the data would be interlinked we needed a custom editor for editing a ‘case file’ from a single window. This would allow designers to create new cases without having to manually create each object. It also provides a streamlined way of editing AI-made cases by automatically compiling all of the data into the case file window.
📐 Data Design
With the requirements set out there were 2 distinct data systems to create.
📦 Items
To begin with, I created the models for the persistent data. Inspired by Cluedo each case features 3 key elements the player needs to uncover; Motive, Weapon & Suspect. These data assets would be carried over to all cases and would be stored in a central item collection.
Alongside these, I also created custom editor scripts to display the properties clearly. In these editors I’ve also linked the icon dropdown to a specific sprite folder. The name of the suspect for example is then automatically set from the icon.
This also provides us with a foundation for designing AI prompts: “generate a clue for [Motive], [Suspect], [Weapon]”
🗂️ Case Data
The next step was design the models for the case data. These objects would be unique to each case
The core of the structure is the CaseData model. this is an abstract class which all the other models are derived from. Every object has a unique ID which will identify it on the database and links it to other objects. Every object also has a short, analysed and full description. This is where the majority of the AI generation will take place.
The composition of a case in game goes as follows:
- A master object called the CaseFile. A CaseFile holds a collection of CaseElement id’s. Cases are designed as having 1 weapon, 1 motive and 1 suspect.
- Each CaseElement (W, M, S) has a collection of clue Ids that point towards it.
- Each Clue contains the CaseElement id which it refers to. It can also be marked as false/irrelevant and holds a reference to the tools needed to collect it.
- Clues are scattered around the map for players to collect. gathering enough clues reveals the major CaseElement to the player.
🛠️ Case File Editor
The final part was to create an editor window for this. In the left panel, the dev’s can create new case files and edit their properties. the editor automatically handles the creation and organisation of all the objects.
The right panel holds a drop down for each element added to the case file. The suspect is selected from the dropdown displaying the data from them, allowing designers to write narratively coherent descriptions that fit inline with the suspects information.
Each element then has a clue list that can in turn be expanded and edited.
📌 Next Steps
With the majority of the data structures now implemented, we can focus on curating some starter cases. We can start planning out our first few levels and running through a full-game with players.