Corona-cation (Day 5)
Git Commit: afb9a0e
"Added ScarabSwarm enemy"
Added ScarabSwarm enemy:
What I thought would be a simple enemy turned out to take up all my time today. The basic idea was that it would be an enemy that would just be a hitbox that once overlapped would do damage every interval of time. That part wasn't so bad, it was the movement that took the longest.
I started off thinking that the actor itself would be static and the actual swarm would be a particle effect that would give the illusion of movement. Turns out I was wrong and the designers said that the entire thing "moves in erratic patterns". So I had to convert the actor to a pawn then add an AI controller, blackboard, behavior tree, etc. then tell it to pick a random point close to around it and move there. The problem was, it didn't move. I struggled for a while until I noticed that I had forgotten the most important thing that I had always taken for granted when making human type enemies. The pawn didn't have a movement component. I basically told it to move somewhere without giving it legs.
Once I figured that out I decided that a behavior tree and whatnot was too complex for something that only moved around randomly. Because of this I deleted all that in favor of doing all the movement on the pawn itself by using "AIMoveTo" nodes. With this done I showed a designer for approval and was told it looked as intended. Success! The only feedback was that the swarm should move more in a straight path and not double back on itself so much. This was expected as the random points were random and so the swarm was a little too erratic.
To fix this I did a check to see if the point it had found was more or less in front of the swarm. This made it look much better but resulted in a new problem: the swarm would run itself into a wall or corner and get completely stuck. To remedy this I added a condition that if too many points in a row were found out of range, the swarm would just go with any point it found.
This is the final BP:
TestForValidPoint |
Comments
Post a Comment