This week on indie dev session we created an enemy wave pattern.
This simple yet interesting blue print is running a script that engage a spawn action of a few enemies in a short period of time.
So the basic funtion is relatively easy:
1. Array with a few enemy class and child BP's.
2. Simple Spawn manager that have a timed function and spawn calling.
So, how it works?
First at the begiging of the game the manager counts a few seconds.
Then, first spawn is of 1-3 enemies from Enemy Class BP.
After 3-4 seconds it spawns 1-2 more enemies, this time a direct child of the first Enemy Class BP.
Lastly, 5-6 seconds later it spawns the 3rd time 1-2 enemies, again direct child of Enemy Class BP.
Overall an easy things to make, BUT how to make it loop?
Our lecturer made a simple loop, but I felt that it was not correct... From my experience making "manual" loops in UE4 is slightly complicated yet simple to solve.
Another lecturer from Game Dev course gave it a look and found the problem, the function would work but would never loop because of 1 simple thing, Validation.
Validation is a simple node to create but it hold something really powerful, "Is Valid" node is a function that check itself during the game, it's a boolean function but with a slight twist, if you create it from a variable, it check if the variable is valid in game, this is very important as I learned last year that without validation scripts many functions in game are lost, one of the reasons is that UE4 do not understand how to loop once a function was called, "Is Valid" is the closure of the loop, even though they are not connected by any means, it makes sure that the game object or function exists in-game.
So for me, this was not a very insightful session but was interesting to see how UE4 deals with relatively simple yet complex task efficiently