- Datatable Driven Bounce Pads
- Checkpoints
- Collectables
- Collectable placement helpers
- Trigger and Interaction Components
- Platforms
- Music-driven events (Sequencer)
- Slide Mechanic, player movement and dot product fun
Platformers require consistency across different gameplay interactions and objects. Tables are a great way to keep track of this, as any changes in the table will persist across all levels, ensuring that the player knows what height to expect when landing on a particular bounce pad.
-
By adding a new entry into the data table along with its corresponding enum, this blueprint will automatically display a new selectable type.
-
This bounce pad sets the height and material from the datatable.
Bounce pads can be rotated, and will launch the player wherever they point.
A simple checkpoint system is useful in 3d platforming games to ensure progress throughout the level.
- On startup, it converts the new spawn location from local space to world space.
- Once the player overlaps with the trigger, the checkpoint will get the game mode and officially set a new spawn point. This is particularly useful for expansive open worlds where checkpoints can be utilized in any sequence. To establish an ordered checkpoint system, implementing an index can ensure that only checkpoints representing further progress are considered
I've made 2 collectables: common and key collectables. Both inherit from a collectable parent, which sets up the removal of the collectable once it has been collected, and enforces height so that all collectables appear at uniform height.
Level designers can drag and drop collectables into a level without having to set up their height every time.
Common collectables spin and hover using a timeline, which can be edited to ensure uniformity across all common collectables.
An offset can be given so that when placed in sequence, they can offset each other.
Level designers need to add large collections of collectables quickly, this could be collectables leading down a path, or collectables in a circle on a moving platform, or along the curve of a jump. I have made two classes to help with this:
This object spawns collectables around its origin, with a radius of R and a total rotation from 0-360 degrees. A number of parameters can be set:
- Number of collectables
- Collectable BP to spawn (Must inherit Collectable parent class)
- Collectable end offset
- Circle Radius
- Total degrees of rotation.
All of these will ensure that designers don't have to work very hard to get a circle of collectables. Creating circles manually can be challenging!
Splines work in a similar way, allowing the designer to follow a path to place collectables along, or do whatever crazy design they want.
Interactable bp actors inherit from an interaction class, which sets up a UI widget to appear and dissapear when the player has them highlighted (close and in front of them). When the player interacts, it will activate whatever that component will override as its own "interact" function. Parent class graph:
I've set up a switch, which is a child of the interactable actor and uses a TriggerComponent I made. Upon interaction, it uses it to open and close the door.
This NPC is also a child of the interactable actor, but stops the player from moving and shows a "dialogue" in the form of a string message.
###Trigger and Triggerable Component
Trigger Component: Attachable component that facilitates the logic for registering itself with the object you want to trigger. The actor can use it to trigger whatever the designer has set up. Using a dropped, you can make any switch trigger anything with the triggerable
component.
Triggerable component: Has two behaviours:
- Toggle on/off. Object can act off of toggle events to enact some kind of behaviour.
- Buildup trigger. Object will not trigger unless all of the triggers pointing to itself have been fired.
As an example of the buildup trigger, you can see that this door doesn't open unless both key collectables have been collected.
To set what actor the object will trigger, you can use a dropper.
A designer will be able to swap triggered objects really quickly, or add new key items to open doors. They can do this without needing to change the existing triggered object.
Every good 3D platformer needs moving platforms. I've made two: rotating and movement platforms.
Using a timeline I can get a position along a spline and move the platform along with it. It can inherit rotation of the spline, or stay upright. It can use any mesh. Start and stop via player interaction, or once the level starts. Rotating platforms can be set which axis, and the rate each individual axis rotates by.
Inspired by the recent Super Mario Wonder, I explored implementing actors in a level that respond to the beat of a song.
-
A level sequence with a song starts playing. The sequencer references a Music manager, which periodically fires "StrongBeat" events.
-
A trigger component called "MusicTriggerComponentBP" subscribes to the music manager's StrongBeat events, and fires its own event that the parent can use in order to do something. In my case, I made platforms rotate. This creates a harmonious relationship between the audio and the world, which really helps the game feel unified. As well, you don't need to worry about syncing movements yourself with every object you place.
2023-11-02.08-58-00.mp4
An artist could create a track, and someone could go through the song and add events for on beats, off beats, accents, the melody, etc. Then, you could have all of those events be subscribed to by actors that need to act in time. Once you've created the level sequence, you can build off of it really easily.
As part of the 3d platformer package, I wanted to experiment on what it's like fine-tuning a playable character that feels fun to control on both keyboard and mouse. WOW this took the most time, and I could still improve it!!
- In the air they can take two of the following actions:
- Dash
- Jump
- The character can slide, which has the following effects:
- They slow down while on horizontal or upward slope
- They carry their momentum while jumping over a minimum threshold
- They can slide down a slope in order to build momentum.
- They jump higher when sliding.
Implementing the jump and dashing was fine, the tricky part was the sliding, which took a lot of fine tuning in order to get down (and it's still not perfect). I have a system where when sliding, it changes the character's parameters via a data table I've set up.
To emulate the feel of increasing in speed, as the player slides down or up it changes their maximum speed. The math to determine if the player should speed or slow down is as follows:
When sliding, a raycast is shot directly below the player, and the angle of the slope is used with the current velocity of the player to dictate if they're moving up or down that slope. If the dot product is positive, the player is going downhill. If it is zero or negative, they're horizontal or going uphill, and should then slowdown.
As part of the stylization of the movement, I can use the slope normal to add a very small force to the player, so they slowly slide down in the direction of the slope regardless of how they're sliding.
Although the slide mechanic isn't flawless, particularly when sliding on an incline as it swiftly transitions back to walking, it still represents a significant improvement from the previous version. I find it to be satisfactory, and I take pride in the mathematical calculations and effort I invested to implement this feature independently.
If you wish to play through the "level" I made, or see any of the implementations yourself, feel free to download the project. If you're going to use the code for your own work, all I ask is that you credit me somewhere.
Thank you!
(note, this github is more about the features than the level. There is no end to it, it's a playground to try out the movement mechanics and how it works with everything else I've built)
I don't own any of the music, or the skybox that was free on the marketplace.