Scripting Samples

Wall-running Functionality (Unreal Engine 4)

I started this project on January 9th, 2021 in order to test my own proficiency with Unreal Engine's blueprint system after using it for only 6 months. So I decided that I wanted to make a first-person shooter style of game, and I wanted to see how difficult it would be to prototype wall-running movement. The video here and accompanying images should show at least the baseline functionality that I was able to come up with in the first afternoon working on this project. I did start with the first person character template as the CharacterMovement component that it starts with is pretty malleable, so I was confident that I could use it as a foundation for the mechanics I wanted to add, and thus avoid reinventing the wheel.
 

From a design perspective, the references of wall running and overall movement I wanted to emulate were Overwatch, Titanfall 2 and Doom Eternal. My goal overall was fast-paced, and getting that to mesh with wall-running.

  • Doom Eternal lacks any wall running, but has a double jump(which I also implemented), and has quick acceleration and deceleration for the character's movement, which I wanted to emulate to a degree.

  • Overwatch was a good reference because of the character Lucio, who skates on walls, and is able to adjust his movement while running on a wall(something that I thought fit with the faster paced movement). 

  • Titanfall 2 has really fluid wall-running movement and feels good to control and also has a nice double jump to boot, so it was definitely a great reference for this project.

The way I handled the implementation was essentially a two stage approach: collision detection, then tracing/raycasting towards the wall that is collided with.

The images to the right are snippets of the functionality that I made in blueprints.

TL;DR
I detect collisions on the player's cylinder collider, checking for 90 degree static geometry and if the player is in the air, then it begins tracing a line towards the surface that was hit. The player's movement mode is then set to flying and their vertical velocity is zeroed out so that they stay in one spot. The line traced towards the wall will detect when they leave the wall to set the player's movement mode to falling. Jumping when wall-running is the in the direction of the current wall's normal plus a bit on the z-axis to give it an upward boost.

Update:  Since last working on this project, I have made it so that the player doesn't need to hold any buttons to stay moving. Once they begin wall-running, it applies a consistent movement input in the direction they are intending to go along the wall. So now the player can look around and shoot while wall-running and it feels more correct and requires a bit less focus on maintaining a wall-run!

An image showing some of the blueprint logic I made for the wall-running functionality that I made.
Image of blueprint logic for wall-running functionality that I created
Image of blueprint logic that I created for zeroing out a character's Z velocity while they wall-run

Procedural Generation - Level

Here's a zipped folder of the C# scripts that I wrote for this project
(they're zipped cause Wix doesn't accept .cs files)

This code was made for a project that I did for the DigiPen course CS199 - AI for Designers. The goal of the project was to procedurally generate rooms for the level before gameplay begins. We were given a Unity Project that was pre-assembled by our professor with the functionality for the player, enemy, keys, doors and pickups. The task of the assignment was to take knowledge from previous courses and apply it to this assignment in order to find a way to generate a level at runtime.

 

The professor of the course, Victor Cecci, gave us total freedom on how we implemented the procedural generation, as long as it could replicate the rough layout example we were given in regards to how specific items were generated in the scene.
 

From a design perspective, the references of procedural generation I wanted to emulate were Enter the Gungeon, and The Binding of Isaac: Rebirth.

 

But I specifically wanted to have the rooms be a bit more freeform than creating a bunch of rooms by hand and saving them as specific archetypes, so I wanted to write it so that the rooms would create themselves and their contents at runtime. This would allow me to adjust the more granular details applied to each room, allowing the potential for more randomness and variety in the future.

I went with an array and list-based approach, as it made the most sense to me and seemed safer than a more arbitrary domino-style implementation.

The video to the left, should hopefully explain the way I implemented the procedural generation. It is about a 20 minute video, so I've included a TL;DR below for those who don't have the time or don't wish to listen to the video. (And for those who do/did listen, apologies for the number of times I said Uh or Um)

I can link the scripts to the left so that they can be viewed.

TL;DR

I went with an approach of creating a large character array and looping through that array and only spawning rooms where there are available spaces. And then based on that array, spawning rooms where there are characters that represent rooms.

The created rooms would then create their own floors, walls and content based on where they exist in the list on the RoomManager that created them.

More scripting samples will be listed here as I add them. Thanks for reading!