Sign In

Making an Horror game with Stable Diffusion Images

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)

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 spritesheet with Krita

Then I selected some of them, remove the background and set it transparent and imported in Uniry.

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 trasparent 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

5

Comments