Another big week for production! In addition to making some progress on adding artifacts, I sorted out out a few of the last major level design tweaks that I needed to a) make the apartment a required detour and b) house more artifacts in the alleyway (while adding to the ‘post-apocalyptic warring regional factions’ worldbuilding).
The key areas of work were as follows:
- The stairwell
- a broken flight of stairs to force the player to pass through the apartment
- a handrail
- customized collisions and walk speed for smoother movement up/down
- Watch tower
- Alleyway artifacts
- suitcase
- security checkpoint sign
- A ladder mechanic
- Optimization
- refined the scripting behind artifact approach and inspection
- enabled nanite foliage for smoother performance
The stairwell
Broken flight of stairs
This was a crucial for designing the player’s path from start to finish; I didn’t want the player to be able to reach the rooftop without passing through the apartment.
My solution was to break one of the flights of stairs. Admittedly, this sort of structural damage doesn’t really make sense. What caused only those stairs inside the building to fall? Why did none of the surrounding walls collapse? Where did the fallen pieces of the stairs go?
While I would have loved to address each of these questions, I needed to accept imperfection here to continue getting the rest of the game done by the end of the month.
Fracturing the stairway was fairly straightforward using Unreal’s “Fracture” functionality, which I used to break the main mesh into several pieces that I selectively deleted.
Handrail
I modeled a handrail in Blender to, mainly to keep the player from falling off the edges of the stairs, but also to make the stairwell look more complete (and not like a barebones video game environment).
The steps involved were:
- exporting the existing staircase meshes into Blender
- using these meshes as references to model the handrail shape as a series of curves
- solidifying the curve into a cylindrical mesh
- UV mapping (I ended up just using Blender’s ‘Smart UV Project,’ since manual unwrapping wasn’t producing elegant results)
Smoother navigation up/down stairs
Originally, walking up and down the stairs resulted in a very shaky visual experience; the camera jostled with every step traversed on the stair mesh (so a solid handful of times per second).
This was because the stairs’ default collision boxes were set to comform 100% to their jagged shape. Instead, I gave the stairs ‘flat’ collision boxes (like inclined walkways).
The head bobbing I built into the player camera still conveys the feeling of walking up steps, but in a much less intrusive way. This headbobbing is also already tuned to sync with the footstep sounds!
I also used a bit of scripting to slow the player’s walk speed going up and down steps (technically, going up or down any significantly inclined surface). Before doing this, it felt like the player would race up and down the stairs at a superhuman pace, which I found distracting and kind of silly.
Watch tower
This was never in my plans until the time came to start thinking about adding artifacts like the solar panel/fan kit or the water purification tablets to the alleyway. How would these objects be housed such that they wouldn’t have been simply swept away? Maybe the bottle of tablets could go inside the building on the ground level, but it felt kind of odd placing the solar panel kit indoors where it wouldn’t have been used.
My solution was to include some sort of makeshift, outdoor structure as a sort of guard post where security personnel would have been keeping supplies and belongings while on watch.
Fortunately, I found an amazing model of a watch tower on Sketchfab made by DJ Maesen, which I’m able to use for free under Creative Commons Attribution licensing.
Alleyway artifacts
Suitcase
A suitcase was always going to be a key artifact for referencing the climate refugee crisis. I found this wonderful model of a suitcase on CGTrader by arteyeglass, to which I added blood spattering by bringing the color texture map into Photoshop (and using one of the built-in splatter brushes.
security checkpoint sign
Also indispensible for portraying the refugee crisis (and explaining the purpose behind the security checkpoint) was a sign about entry requirements.
I found a nifty “Road Closed” sign by sostcgtech on CGTrader. I then brought the diffuse, roughness, and metallic texture maps into Photoshop to rewrite the text! This was fairly simple do to using one of Photoshop’s built-in text fonts and adjusting exposure levels to darken and fade the letter sillhouettes to suit the different texture maps (e.g. making the letters kind of rough, but 100% not metallic).
Ladder climbing mechanic
The apartment ladder and guard post would be of no functional value if the player couldn’t climb them!
It turns out that the process of scripting thoroughly realistic ladder-climbing mechanic is incredibly complicated (you have to define behavior for getting onto the ladder, climbing up and down, disembarking the ladder from the top and bottom, and preventing the player from falling off the sides). These considerations are important for third person perspectives where the player can see their player climbing the ladder, but I don’t have to worry about this!
Instead, I ‘cheated’ by simply making the ladders walkable (albeitvery steep) slopes. I had spent a while scripting custom climbing movement and grappling with wonky results before deciding that I simply didn’t have the time. Unreal doesn’t allow one to walk up 90-degree ‘slopes,’ but 80+ degrees is fair game! All I had to do was slightly tilt the ladders and then override the player’s maximum walkable slope when ‘walking’ up these meshes. While the apartment ladder was easily tilted as an object in Unreal (and it was already tilted, anyway), the watch tower ladder had to be tilted in Blender since it’s part of the same mesh as the tower itself.
Performance Optimization
While time is short and my first priority is adding artifacts for narrative-telling purposes, I decided to take one day as a ‘break’ from my usual work to revisit the scripting behind the artifact inspection system and see if I could improve the game’s performance. On a decent laptop, the gameplay is tolerable but very choppy (even with automatically scaled graphics settings), so every extra frame-per-second makes a difference!
The problem: Calculation loops
It turns out that my original scripting for detecing when the player approaches and ‘picks up’ an artifact was incredibly inefficient. Without going into too much detail on the logic, the problem was that I was asking the player’s computer to run calculations on each of the level’s artifacts several times a second to detect approaches and interactions.
In otherwords, while the player is in the alleyway, the computer would still be checking on artifacts in the apartment to see if the player was approaching or inspecting them, and these extra calculations take a toll on the game’s performance.
The solution
Instead of constantly looping through every artifact, the game now detects approaches as events that are triggered by the artifacts themselves.
In other words, rather than the game’s main program constantly asking each of the artifacts “Where are you?” every split second, the artifacts now individually shout “Here I am!” when they’re approached.
My original scripting for entering artifact inspection mode also involved looping through all the artifacts to check for proximity whenever the player would left click. Instead, the program now only talks with the single closest artifact to see if it should bring that one up for inspection.
Looking ahead
With 2 weeks to go and basically all of the game’s functionality sorted out, I will continue focusing on adding artifacts to tell the specific story of my climate change timeline! Combining my own modeling work with prefabricated assets, I plan on having plenty added by the end of the week. Thanks to how I defined the “Artifact” object class, turning a 3D mesh into an interactable artifact takes almost no work!