Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Mystery at Murder Manor

A topic by MiniBobbo created Mar 11, 2018 Views: 533 Replies: 3
Viewing posts 1 to 4

So I'm working on a game tentatively titled Mystery at Murder Manor.  A bunch of guests show up at a house party at Murder Manor and, surpruise surprise, one of them is murdered.  It is up to the player to question the guests, put together a picture of who was where during the party, who picked up what items, and the relationships between the different characters.

I plan to procedurally generate the guests and the events so each mystery will be different.  I'm hoping to make adjustable difficulty by changing around some of the parameters.  Who knows how that will work.

I'm working on a couple things at the same time.  I need a bunch of suspects to wander around the mansion socializing, so I made a person generator.  I can generate first and last names for characters of White, Black, Asian, Native American, Hispanic and Arabic descent.  First names are simply divided by gender.  Last names are generated from a list of the most popular last names according to census data.  So that is working ok.  

I also need some portraits for the interviews and to appear on cards that the player will move around the mansion to keep track of where everyone is.  I need them to be pretty distinct and recognizable, but I may be generating a lot of them so I decided to combine different elements to make distinct portraits.

I plan on every portrait having the same base body.  Then I drew different hair, eyes, mouths, and clothes that could appear on that body.  I plumbed up all the code for body and hair and assigned them random colors just to prove out the concept and so far I'm real happy with the results.  


I'll get actual skin tones for each race and select them randomly in the future.  

Mystery Generator

I'm also tackling the procedural mystery generator.  I have a plan to generate solvable mysteries each time, but I'm not sure how it will work since I've never done this before and I'm making it up as I go along.

My basic plan for the game is to create a series of Events and Constraints.  An event will be something like "Time period 1 ID 1 passed through Room 4", or "Time period 3, ID 4 entered room 2".  Each guest, when questioned, will talk about events in the room that they were in during the time period they were asked about.  Next is Constraints.  Constraints will be things like "Time Period 2, ID 3 has to be alone in room 4".  Then when I generate any future events I'll have to check them against the constraints.  If they don't violate a constraint, then it is a valid.  I'm hoping I can create 30 people, set them loose in the house to randomly walk around and talk to each other and as long as they don't violate a constraint the mystery will make sense.

Then I'll generate the murder.  I'll pick two people and make one the murderer and one the victim.  then I'll put them in a room together at a certain time and put a constraint on the room that they have to be alone.  Then I'll kill one.  Next I'll generate another event f the murderer stashing the murder weapon.  I'll generate a constraint on that case that someone else has to be in the room where the murder weapon is stashed so the player will be able to learn about it from one of the guests.

It sounds like a solid plan in my head, but we will see how it works in reality.  

Sounds amazing! This could have so much replayability.

(+1)

Ok, more progress.

I hard coded the mansion that the game will take place in.  basically it is just a series of connected nodes.  Right now, there are 9 rooms arranged in a square.  I also made a quick visualizer so I can see what is going on.  This is what it looks like:


The red are valid paths.  

Then I wrote a simple flood fill pathfinding algorithm.  You can supply a from and to ID for rooms and it will find the best path (best being shortest).  It currently always takes the room with the lower ID if two paths are equal, so going from 0 to 4 will always go through room 1 instead of 3 because 1 is lower than 3.  A savvy player could use this I guess.  I'll change the algorithm to take a random route if there are multiple shortest routes.

TestCase.hx:46: Shortest path from room 0 to Room 8: [0,1,2,5,8]

I also wrote a modified algorithm in case I needed a person to go through a specific room (like the murderer needs to move from their location, to the location where they stash the weapon, but they have to pass through the room with their victim).  So that is working too.

TestCase.hx:49: Path from room 0 to Room 8 going through room 4: [0,1,4,5,8]

Finally, I wrote the core to take the paths I generated and create a list of events so that the other people can tell you about them when you question them.

TestCase.hx:54: { timePeriod => 0, location => 0, lie => false, action => LEFT, person => 1 }
TestCase.hx:54: { timePeriod => 0, location => 1, lie => false, action => PASSED_THROUGH, person => 1 }
TestCase.hx:54: { timePeriod => 0, location => 4, lie => false, action => PASSED_THROUGH, person => 1 }
TestCase.hx:54: { timePeriod => 0, location => 5, lie => false, action => PASSED_THROUGH, person => 1 }
TestCase.hx:54: { timePeriod => 0, location => 8, lie => false, action => ENTERED, person => 1 }

There is a flag in there so this statement can actually be a lie.  This is a future state thing.  Right now, all the statements are true.

I also created the Constraint object that tell if an event is valid or not.  I manually created some and checked them and they are working like I expect, but they aren't plumbed into the mystery creator yet, so no examples.

How this basically is going to work is that I'll have the random people (not the murderer or the victim or the one who finds the body) just walking around.  I'll generate a random movement for them (generate the events to move person 1 from room 1 to room 5), then check those events and find out if they would violate any constraints.  If they do, throw out those events and try to generate another set.  I'll have to be careful not to get caught in any infinite loops by putting people in situations where they have no valid moves.  I don't think I will have any of those situations with how I'm currently designing the murders, but I might in the future.  That's one of the dangers of procedural generation.  

I might just make an event like "Person 3 is disappears to resolve a time paradox" in the event that a person has no legal moves, including just staying where they are and doing nothing.  Interestingly enough, if questioned about this the other people will mention it in passing like it is no big deal.