Wizard Game Dev Log 1, Fireball


This is my first dev log, a few months into my attempt to learn UE5 and create a shit game. I know UE5 is bad for the soul, but I really just want to make a game, alright? The core concept is Ultrakill, but worse and flavored with spells. Right now, I’m just sending out some of my code into the void, so if you want to copy any of it, just remember to credit me somewhere lol. This is half of the code I used to create a fireball which travels forward and targets enemies, my best creation. 

Let's start at the beginning.

After being spawned, the fireball casts to Game Mode and saves it as a variable. This will let me grab the list of enemies in the level later. Next, the ball moves forward and sits for a second. It appears that the delay is 2 seconds, but that’s just because the Move command takes a full second to finish. The “For Loop With Delay” is a custom node made after a tutorial, because the basic loop doesn’t allow for delays because fuck me ig. The Double Up event basically just targets then moves, a vestigial limb from a somehow worse version of this code.

After three attempts to move into an enemy, the fireball checks if it’s already dead and potentially explodes. I had problems with exploding twice, so the basic check was added. On to Targeting.

The event starts by using the game mode reference to check how many enemies are alive. If none are, the ball takes self damage and explodes. This is an alternative way to avoid double deaths, but because I don’t know which is cheaper computation wise, I haven’t made it uniform. After the branch, I use the collision point, the center of the fireball, and the nearest actor to create a vector that points between them. I suck at visualizing vectors, so this baby puzzle stumped me. The new vector is used to make a rotator, which the fireball then uses. I’m proud of this shitty little piece of code, so no mean comments. 

For movement, I use a line trace to determine the starting and goal locations before lerping between them with a timeline. The “Get Forward vector” node at the start gives a unit vector, so by multiplying it by 500, the fireball will move 500 units forward with each activation. The timeline is simple, going from (0,0) to (1,1) for a nice and jarring move. I can’t figure out how to do that easing thing with the timeline, so it starts and stops instantaneously. If the fireball dies mid-journey, it will stop moving.

I think this post is long enough, so I’ll leave you with this.

I’ll go through my Damage Macro and the Explosion types at a later date. Thanks for reading.

Leave a comment

Log in with itch.io to leave a comment.