Thursday 3 February 2022

[Dev Log] Generic Slenderman Clone Part 1 // UE5 & Blueprint

The next game on my list for the 12 months of games challenge is a straight up Slenderman clone. Slenderman is without a doubt one of my favourite games of all time due to the simplicity of the premise; you are chased around a forest by an A-Posing faceless man in a suit whilst collecting 8 items. I was always more of a console gamer and so I didn't know anything about the "indie" games scene and then 2013 hit with Slenderman and now I can't go back; indie horror games are my favourite genre.

So to ease myself into UE5 (and remind myself of how the editor works); I decided to make a straight up Slenderman clone. Once I've completed this version, I will then remake it using C++ instead of Blueprint.

In total there are 5 stages to this game, in this first part I'll be:
  1. Creating the "map" and first person mode
  2. Putting notes on the "map"
  3. Displaying the collected notes count
  4. Adding a way to collect notes
  5. Adding "slenderman"
  6. Creating a titlescreen and endscreen
  7. Creating an executable
So there will be a full "game" by the end of this stage (it helps keep me motivated) but when I say "map" I mean the default 3rd person map and "notes" will literally just be textured cubes from the starter content.

1 - Creating the "map" and first person mode
I've just synced UE5 at work and I did the "Your First Hour in UE5" tutorial from the Unreal Learning portal but other than I've not done much. I will say I like the interface upgrade and the darker colours. For this project I'm using the Early Access 2 version.

I started off with the third person project using Blueprint and starter content. My game will be imaginatively called "Default Unrealman".


I cleaned up the scene a bit by removing the text and moved things into folders. 

I added a hacky "line trace" to my character which is simply just a collision box shaped to a rectangle coming off the players face. It's not very efficient but I'm not making Halo so it doesn't really matter.


"True" first person mode is achieved my simply attaching the camera to the head socket and moving it so it's on the head. The rectangle trace is also connected to the head socket. I set the camera to move with the pawn rotation and then set the pawn rotation to use controller yaw; this way the camera doesn't do a 360 spin around the player but moves as the player moves.

2 - Putting Notes on The Map
I created a new blueprint actor for my notes which simply contains a cube with a texture on it from the starter content. The note contains a text variable with what to display on interaction and a collision box, I then placed 8 of them on the map.

3 - Displaying the Collected Notes Count
For this, I needed to override the current game mode. I created a new HUD class called BP_GameHUD. Then created a widget called W_GameHUD. BP_GameHUD contains a reference to W_GameHUD and a function that allows access to this widget.

With that out of the way, I added some text to the Widget and then added the widget to the viewport.


Currently this isn't interactable but it's simple enough to set up getters and setters in the widget to change this text.

4 - Collecting the Notes
This involved adding the usual "Press E to use" text to the screen whenever the player is looking at a note.  I added a new text component to the hud widget and 2 functions to set and stop displaying it.


Then I gave the note blueprint a reference to the hud widget and called these functions using when overlap begins and ends on the collision box. Now when playing the game it appears in the middle of the screen, directly where the player is looking and disappears when the collision stops. 

To "collect" the note, it removes the actor from the game when E key is released and to update the HUD widget, I added an int to BP_GameHUD and a function to increment which then updates the hud widget.



5 - Adding "Slenderman"
My version of slenderman is an A-Posing default unreal man:


UE5 has a couple of new components that you can add to actors called "InterpToMovement" and "RotatingMovement", however I'm going to do it the old old-fashioned way:



This will get replaced with a behaviour tree later on but for now it's fine.


Terrifying.

6 - Creating a Titlescreen and Endscreen
The most involved part of the process...at least there are widgets this time and I can just drag and move them around instead of manually typing in positions. Bless the editor. I hate doing UI stuff.

After much faffing about creating a new game mode for the menu screen and setting input controls for each screen. I finally had a "working" slenderman game....I mean technically it's a game.

7 - Creating an Executable

This was the most different part of the process from using UE4. Turns out I still haven't installed the Windows SDK on my pc; I've had it for almost a year now. The package and cook is in a completely different place as well and documentation links are broken. Very cool Epic.

For future reference, you need to install the specific .NET framework from here:

Then, just when I thought it was building, I needed to disable the Quixel Bridge plug-in due to some random shared pointer being null. I will say though Quixel did fix it back in October, I just haven't updated the Engine...

But eventually I got my application:



It's beautiful. 

It might not look like much but it's basically the bare bones of the game. Make it night time and add a spooky forest and it's pretty much done....OK maybe not completely. The next stage is to add the flashlight and sprint mechanics and make it night time. Then in Stage 3 I'll create the forest.