Making an Horror game with Stable Diffusion Images


Objective I wanted to partecipate to a Scream Jam 2023 (https://itch.io/jam/scream-jam-2023) on Itch.io .

A Gamejam is a few days competition where solo or teams can create a videogame.

The Scream Jam Theme is the Horror game without any limitation on the theme.. only to avoid NFWS games.

Idea My Idea was to create a Mansion infested with ghost and a girl that has to escape from it.

The Girl has to find some clues during the game and she has to survive and exit from the mansion.

Game Engine I decided to use unity as I know very well the engine and let you publish in Web and on windows.

Also works well with C# code (my main language).

I was thinking to use Godot 4 but C# is limited and the web publishing is not supported yet.

Music About music I decided to use free music and sounds from the internet, check the credits for more information

Graphics I wanted to generate the graphics with Stable Diffusion.

I select a checkpoint that was perfect for my game (camelliamixLine_v2.safetensors) https://civitai.com/models/44195/camelliamixline

Prompt : background, the tension builds as you navigate through rooms, mansion’s dark history. Whispers of the Haunting

Negative: blurry, blurry_image, Lowres, Low_resolution, Low_picture_quality, Low_picture_anime, extra_anatomy, extra_body, extra_navel, extra_face, extra_eyes, extra_chest, extra_nipples, extra_hips, extra_arms, extra_hands, extra_fingers, extra_legs, extra_feet, extra_toe, missing_anatomy, missing_body, missing_navel, missing_face, missing_eyes, missing_chest, missing_nipples, missing_hips, missing_arms, missing_hands, missing_fingers, missing_legs, missing_feet, missing_toe, sketch, sketching, (worst quality: 2), (low quality:2), ((monochrome)), ((grayscale)), inpainting, HDR, bad_prompt_version2, jpeg artifacts, signature, watermark, text, error, missing fingers (visible hands:1.6)(girl:1.7) (people:1.7)

Image output I have generated many images :

Using the images in the game I imported the images into a folder of my unity project, then I put the images that I wanted to use in the game.

For each image I defined the area where the player should move.

This was easy with the Polygon Collider2D

Link between Images, move between rooms Each door have an object with a collider ad some settings that point to another door in another room.

When the player hits the area the camera and player will move to the new position.. giving the idea that the player is moving..

Changing the size of the player A problem that I had was the dimension of the player, in some rooms the zoom was different from another rooms also, when the player was moving should change the size..

This is a 2D game that’s why I decided to create an object that changed the dimension of the player while moving on it.

On the floor of the room the options to change the size of the player.

Changing the game aspect To make the atmosphere more Horror I decide to use some Global Volume to change the camera lens distortion, adding “film grain”, “vignette” effect

Lights Also in each room I added some animated lights .

The light were generated with Stable Diffusion + ControlNet from an old lamp, then with Krita I have created all the pieces that could feat in the different rooms.

Then I have compose the different lights with particle effects, and 2Dlight with animation that give the idea of fire moving.

Making the scary ghosts To make the ghosts I have used .

Prompt: old woman ghost full body without legs, (white background:1.5) (horror:1.8)

Negative: blurry, blurry_image, Lowres, Low_resolution, Low_picture_quality, Low_picture_anime, extra_anatomy, extra_body, extra_navel, extra_face, extra_eyes, extra_chest, extra_nipples, extra_hips, extra_arms, extra_hands, extra_fingers, extra_legs, extra_feet, extra_toe, missing_anatomy, missing_body, missing_navel, missing_face, missing_eyes, missing_chest, missing_nipples, missing_hips, missing_arms, missing_hands, missing_fingers, missing_legs, missing_feet, missing_toe, sketch, sketching, (worst quality: 2), (low quality:2), ((monochrome)), ((grayscale)), inpainting, HDR, bad_prompt_version2, jpeg artifacts, signature, watermark, text, error, missing fingers (visible hands:1.6)(girl:1.7) (no people:1.7)

Generate Forever for many images I have generate a lot of different images, all with white background

Making a sprite sheet with Krita Then I selected some of them, remove the background and set it transparent and imported in Unity.

Adding Bones to animate them In unity I added in the Skinning Editor the geometry of each ghost and added some bones.

Then I animated Them and created animation depending of the player position.

Idle animation In this animation I work with the alpha value of the images, hiding a little bit the ghost to the player.

Chasing animation With a script I was detecting the distance between the player and the ghost, he was shouting and moving to the player with a different animation, where I was changing the color fo the ghost from transparent to red and moving it.

Play the game for free I hove you enjoy my quick guide to create this kind of games.

IA can help a lot with the graphics but also you need to know well an image tool like Krita or photoshop and then you need to know Unity or another game engine.

Enjoy the final game at : https://misterm.itch.io/haunting-echoes-escape-from-the-enchanted-manor

Get Haunting Echoes: Escape from the Enchanted Manor

Download NowName your own price

Comments

Log in with itch.io to leave a comment.

Nice project. I also wanted to do something like that for a long time but didn't at the end : you may have given me the will to try it myself.

The biggest problem I would have will be the creation of sprite animation without using 2d bones. I still have to mess around with stable diffusion and find a good workflow. Control Net might help but I don't know.

Anyway, thanks again for sharing this.

For the main player I wrote also this: https://civitai.com/articles/2609/some-tips-for-making-a-2d-game-with-stable-diffusion-graphics-in-unity

Net control works well with bones but the details change a lot for frame to frame. Best will be to make a specific lora for your player or enemy and then using it..

(+1)

I already read your article on Civitai : it was a nice one.

Concerning the animation, maybe I'll try to make it on the same picture like other suggested some time ago on Reddit to keep the consistency. And yes, having a LORA is a huge benefit too. But I think the IP Adapter Control net would be able to give similar result. I had great results with this whithout using a specific character LORA.