Showing posts with label 3d game. Show all posts
Showing posts with label 3d game. Show all posts

Friday, 22 September 2023

Unreal Free For The Month Jam // September 2023 - Escape The Palace Hall

What is Free For The Month Jam?? I explain it all here in great detail:

Basically, it's a game jam I made up where you have to use the current Unreal Free For The Month Assets to do, something.

It's called a jam instead of a game jam because you don't have to make a game. It can just be a simple mechanic. Whatever floats your boat.

This month I sat down and was actually able to complete my own jam for the first time since I started it almost year ago.

My entry this month came from ChatGPT which told me to create:

So that's what I did. And I made it into a video:


It's very basic, but I really struggle with finishing projects so I was proud I managed to get this to a packaged state and was happy to call it finished.

I ended up creating a very small game that requires you to find 2 items, pick them up and place them on pedestals to unlock the doors. If you don't do it within 60 seconds, you lose. It features a grab mechanic and a simple interact mechanic with the doors, as well as two trigger box events that cause spooky things to happen. I then added some sounds and music for ambience.

Keeping the scope small was really difficult and hopefully I'll be able to complete next months faster.

Tuesday, 31 May 2022

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

So after part 1, I had the bare bones of a slenderman game. In this part I wanted to flesh out the mechanics a little more and make it start to look more like a "game". My Goals for part 2 were:
  1. Replace the cubes with actual "notes"
  2. Create random spawn points for the notes
  3. Create a sprint mechanic + realistic jump
  4. Add sprint and notes to HUD widget
  5. Change it to night time
  6. Create a flashlight
  7. Create a battery mechanic
  8. Executable
1. Replace the cubes with actual "notes"
2. Create random spawn points for the notes
For this I opened up blender and made the shittest piece of paper. Took about 1 minute. Made sure to resize the plane to A4, curled the edges slightly and gave it a material slot for the front and back and then exported it to Unreal.

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

I downloaded the note textures used in one of the slenderman games off google images and created materials from them. Then created a way for the notes to pick one of the materials at runtime. There are 8 different textures and each note is unique:

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

I created a new blueprint which now handles the spawning of the notes and what material they get. This blueprint contains 16 locations where the notes could spawn. More can be added but only 8 locations will be picked at runtime. You can change the number of locations in the details panel in the editor.

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

3. Create a sprint mechanic and realistic jump
Default unreal man jumps like Princess Peach; in fact it's more floating than jumping and greatly annoys me. Fixing it is quite simple though by just changing the Z Jump Velocity in the Character Movement.

The sprint mechanic is also relatively simple. When shift is held, it reduces the sprint each second and when it reaches 0 (from 100), you can no longer sprint. It takes 10 seconds to replenish fully. I achieved this by using timers instead of ticking. That way, we're not constantly checking to see if we're sprinting (or replenishing sprint value) every frame; only when we need to.

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

4. Add sprint and notes collected to the HUD widget
Using icons from the Android library (they're free to use) I added a progress bar and text to the HUD:

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

The progress bar does use a binding to update itself which is expensive but barely anything is ticking in this game so I didn't really care. In UE5, the progress bars now come with a default animation as well which is snazzy. The notes text is updated when a note is destroyed and the blueprint sends a message to the HUD.

5. Change to night time
This was one of the most difficult parts as lighting in Unreal Engine is unbelievably difficult. You need to change colours determined by sun, override sky colours, change the post process volume and exponential height fog....it's never ending. Also, as the scene is so dark afterwards; I duplicated BP_Sky_Sphere so I could add a tick box which would allow me to switch between day and night in real time.

In the construction script I added this mess:
[Dev Log] Generic Slenderman Clone Part 2 // UE5 & Blueprint

Which toggles between "soft day" and night:

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

6. Adding a flashlight
For this I simply add a spot light to the character and attached it to the head socket so it moves with the character. I thought about a doing a torch you hold in your hand but couldn't be bothered with the hand animations as this is true first person so instead, the player is wearing a head torch. I added some nodes to allow the player to toggle the flashlight on and off with F.

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

The flashlight is its own blueprint and spawns on the player as a child component. I gave it a light profile as well using one of the default UE ones so it's softer when far away from objects; but then the cone shape starts to appear when you get closer. It always annoys me in games when the flashlight is just a circle in the centre of the screen.

7. Adding a battery mechanic
This didn't take long as it was almost copy and paste on the sprint mechanic. I added some timers to the flashlight so when it's in use it begins to lose power and it updates the HUD with the new power level. I added a cylinder to game which acts as a "battery". When you pick it up it replenishes the battery power; regardless of how much power you have left. So batteries should be used wisely as you can't store them in an inventory.

8. Executable
In the gif, "slenderman" is motionless as I disabled it's "AI" for the moment whilst testing (and I forgot to remove the debug output from sprinting) but it's starting to look more like a spooky game now!

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

In part 3, I'll actually create the forest map, add sounds like footsteps, cracking twigs and some story elements. By the end of part 3 it will look like a proper slenderman game but it still won't act like one.

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.