Timeframe: 5 days
Date: October 2019
The GenerateObstacles() function calls SelectSpawnLocations(), then spawns the actors at those locations into the world. The spawned actors are also placed into another array so that their type can be chosen.
MoveSides() recieves axis input and based on a timerate, the selected y position is incremented up or down. HandleYMovement() Sets location based on index multiplied by the Y multiplier distance.
EVENTS AND COMPONENTS
Events are declared and set by the GameMode. Other scripts then import the game mode to access and assign these events.
Cube Runner is a lane-based endless runner where the player must traverse a procedurally generated course and gather as many points as they can.
Anglescript Programming: I took some time to learn Hazelight's AngelScript (AS) tool in Unreal.
Design: I focused also on desiging gameplay that felt good and that was readable for the player.
The LevelGeneration class is scalable, based on valuesset in the GameMode. The ConstructObstaclePositions() positions are first generated at a world position (offset on the y as player starts at centre on 0)
These positions are stored into Arrays for X and Y.
The SetObstacleType() takes the spawned actors from an array and decides what 'type' they should be (if destructable or breakable) - if neither are chosen, then obstacle stays as blocking.
An example of how the scalability of level generation works. Designers can decide the distance between points on X and Y axis's through the multiplier.
The amount of X rows can also be chosen, as well as the Y columns, starting from 0 and adding on both sides.
Lane movement felt the most natural, as players found free movement with the grid based level to be awkward or wrong.
Below is the function that binds all input actions.
Input component setup and settings for FloatingPawnMovement comp.
The Camera is a separate object. It first gets the GameMode and then assigs the SetPlayerReference function to an event. It is then set to player location with offset and rotation values. Its location is then lerped towards the player, multiplied by 0.9f so that it stays a little closer towards the centre of the lane. The Set functions are called by the player, so that we can SetViewTarget to that camera instead of our own.
For speed based events, these are assigned within the Movement Component that moves all the objects in the level towards the player (who is static).