Castle Cairn - Gameplay Programming
Most recently I have been employed at Wee Tattie Studios, with most of my work being spent on the upcoming puzzle horror game Castle Cairn. This encompasses the majority of my work with Unreal Engine 5, using Blueprints, C++, material shaders, Niagara and more to implement various systems for the game. You can check the game’s demo on itch.io here!
In a hurry? Check the gallery below! For more detail, however, see the descriptions underneath that.
In-Game Phone
This was a major part of my work on the game, so much so it needed its own page! Check that out here!
Sequenced Scares
These are narrative/scripted sequences that involve a mysterious figure haunting the player, their intent unknown… these existed in a basic form already, but I was tasked with fixing and improving these.
With a few assets provided by the team’s excellent artists (models, animations, textures, etc.), I imported these into Unreal, then created proper shaders and Niagara particle systems to help sell the figure’s ghostliness. I made sure to optimise these visual effects as best as I could—Unreal always being quite resource heavy after all.
From there I needed to choreograph these events in-game. This required a little initiative on my own part as the outline for the events was fairly vague; I drew inspiration from various other games I’ve played. I wanted the events to be as reactive as possible, generally starting only when the player can actually see the figure, while also trying to draw the players attention using corridors or having objects fall in front of them, alongside other tricks. From there it was just a matter of playing the the right animations, and clearing all the assets from the scene when it’s finished.
Timeshift VFX
Another technical art task assigned to me was to create the visual cue for a “time shift” gameplay mechanic, wherein objects can be magically shifted between their past and present versions due to the setting’s supernatural nature.
The gameplay system itself was already set up, so building on top of that I used a fairly straightforward material graph to achieve the effect.
Using a noise map, an “amount” variable scans through the map’s black to white value to set the opacity of the texture—this makes the texture dissolve in and out based on a desired value. The edge of the opacity mask was then given a magical glowing effect.
From there, a blueprint setup was used to actually control the visual effect. A “timeshiftable” mesh actually consists of two meshes, past and present, both having the timeshift shader applied to them but with one having the effect inverted. Then, a timeline would be played to gradually scan one object in and the other out when the timeshift was started.
Tutorials
One important system the game needed was a mean to properly introduce the player to the game’s mechanics and controls. To that end, I created a simple tutorial system.
A given tutorial displays a panel on the left side of the screen, configured to specific inputs depending on the tutorial’s section (e.g. movement shows WASD). When a control is pressed, the corresponding item glows and crosses out (providing clear feedback to the player they did something right); once a tutorial section is complete the panel fades out.
More complex tutorials wait for specific tasks to be completed instead.
Objectives
Another means to guide the player through the game was an Objectives system, also implemented by myself.
An objective consists of a main task, a “completed” flag, and an optional array of “tasks” (essentially sub-objectives). Objectives are defined in data tables, and can be started/progressed/finished via blueprint functions or with simple trigger zones the player walks into.
When an objective updates, it is first displayed in the top-left corner of the screen (with an appropriate animation), and active objectives can be tracked in a special “app” on the in-game phone.
Combination Lock Puzzle
Any horror game worth its salt needs a four-digit lock puzzle (0451, and other such video game traditions)! In this case however, it’s the first puzzle the player runs into, as a way to get them comfortable before introducing more complex puzzles later on. I was tasked with refurbishing an earlier version of this puzzle.
The main quirk of our version of the puzzle was that it was styled as a rotating combination lock using a specific model; I ended up splitting the system into several different objects (the combo lock object, the door, and a UI widget) to let each part handle its own behaviour. The combo lock is displayed in the UI using a Render Target texture for simplicity, with buttons in the UI calling functions in the combo lock.
When the correct code (set in the puzzle’s details panel for easy tweaking by designers) the door will obviously open—however I did need to make sure it pushes back the player just to make sure they don’t get stuck inside it (a very interesting bug).
Additional Work
There were various other smaller tasks I was given, especially in the run up to releasing the demo. Alongside simple (if somewhat tedious) tasks such as importing models and mocking up level layouts, I also worked on the following.
Phone Text Messages
A last-minute addition for the phone (detailed on its own page). To help provide narrative elements to the player, a simple faux-text message app was needed, where the player would, at set points, receive messages from a mysterious third party, spooky…
This was fairly simple to implement: program a new page for the phone, set it to be a scrolling UI, use a system that stores messages the player would “send” and “receive”, style these appropriately (dots for the message “loading”, left-grey for received, right-blue for sent), and add these to the UI one by one.
Mostly importantly, however, these text message conversations are defined in an easily changeable data table, allowing narrative designers to create them very quickly.
Loading Screen
Another simple thing added fairly late into development: a loading screen to indicate to the player that the game is loading a level and hasn’t just frozen.
The UI was fairly simple to create, scrolling buffer wheel, pulsing game logo (made with a custom material), “LOADING” message, etc.
However, using ordinary Unreal Engine loading would result in this menu being frozen, so using Unreal’s built in “async” loading functions was needed. Pull up loading screen, async load the desired level, wait for loading to be done, when done fade out the loading screen and load up the level. Simple, but exactly what was needed.
Bugfixes, Code Optimisation, and Testing
Finally, I provided a great deal of general utility work to the game. Since the game was built off earlier prototype versions, and had a great deal of other developers dropping in and out with their own sporadic contributions, a lot of the work (especially leading up the demo release) was, basically, tidy up.
To that end, I did a lot of my own testing on the game, dug into lots of old blueprints and systems to tidy them up as best as I could (or carefully remove them if they were entirely irrelevant), optimised what I could (e.g. removing redundant code, making certain parts easily reusable, cleaning up circular dependencies, etc.) and fixed a great deal more. Seemingly simple, but it was a big enough a part of my work that I felt it deserved at least a brief mention here!