blueprint

Enemy System

  • Exposure: public
  • UE Version: 5.0

Robert211016

December 7, 2022, 3:19 pm

Click the button above, it will automatically copy blueprint in your clipboard. Then in Unreal Engine blueprint editor, paste it with ctrl + v
Versions
January 13, 2023
  1. I have made it so enemies that are small can shoot towards the player.

  2. I have made it fully possible for the enemies to do kamikaze.

  3. I have fixed the issue with the enemies not following the same spline during the random wave. Therefore I have made a global variable.

  4. I have managed to make the space stations rotate around the pivot.

  5. I have iterated upon it even more, because the some of the enemies sometimes go backwards. I don't think I can improve it more within the time limit however I have 1 last idea.

  6. After 10+ attempts at using all kind of nodes I have made it possible to rotate the enemies in the direction they are moving, it's nowhere near perfect but for now it will have to do until I find a way

  7. I have removed the entire "Not moving" part of my function, because if the enemy is "small" it won't move (And it's the only moment when an actor isn't moving in this game), hence it became obsolete

  8. I have moved a large chunk of the event into a function to make more space and easier to read, as well I have found a solution to the issue I had before where the enemies would wait 9 seconds to spawn because of the reset. I realized I don't need the reset so I am spawning the waves separately.

  9. I have managed to make the laser beam move between the 2 satellites at extremely high speed like in the original game.

January 12, 2023
  1. I have updated the player Death event as I realized that it was messing with the escaping enemies, as well as the fact that I was doing half of nodes in the "Foreach loop" so it was drastically killing performance.

  2. I have added another fail safe that will stop enemies from spawning if the number of enemies to spawn is lower than 1

  3. I have fixed the issue with the Space Station Spawning even if the player didn't die. I simply added an input for the function and checking if the player died.

  4. I have solved the issue, it is actually a combination, first was the delay, if the delay was 0, the game would consider that he reached the destination whilst being in the state "Escaping" which kills the enemy, second being I was Setting the state before restarting the timeline.

  5. Somehow it still doesn't work, the enemies once there are only 2 they either kill themselves for some unknown reason, or do what they are meant to do

  6. I have made a function that checks if there are only 2 enemies left, if that is the case, the enemies should escape

  7. I have updated the kamikaze mechanic, now it will be able to go towards the player and kill him without errors appearing.

  8. I have greatly improved the overall way the event tick looks, before I have 20+ nodes doing shrinking and other things, but now I have moved all that logic into functions, for a more easy to read blueprint.

January 11, 2023
  1. I have made it so you can customize the delay between each spawn depending on the Wave. Because some enemies require a smaller distance between each other, and other require a larger distance.

  2. I have made another fail safe in case there is a Stray enemy that strays in the center (Unrelated to the game functionality). It appeared for the first time a few games ago, but I am unaware what spawns it and why it has a Beam Laser sprite although it is a fighter

  3. I have fixed a relic that was still present, for example the set number of enemies to spawn, which would have spawned enemies indefinetly

  4. Because it would be a waste of work to just not include the Planets and everything I have made already, I simply made it so after every chance stage they just follow the same patterns. (Technically I am only forced to make 3 stages with patterns which I did)

  5. I have created a fail safe, meaning that for some unknown reason the Game doesn't end after all enemies have been killed this will 100% end the game without fail.

  6. I have optimized a little the function by using local variables, and I have implemented "Real Stages", because we only need to make 3 stages but this game is infinite, I am going to make the game repeat itself but the patterns are reliant on the Stage number so that would have to be reseted.

  7. I have solved the issue I was facing, I have made a local variable with every Space Station so there wouldn't be issues with the For each loop.

  8. I have attempted to make it so space stations disappear once the player dies, however it doesn't work, I am getting errors and sometimes not all space stations get destroyed

January 10, 2023
  1. It has become difficult to find what I am looking for therefore I have organized everything in different colors. like the enemy_Spaceship blueprint Pink is the begin player, red is enemy die, yellow is player died, blue is wave control and purple is spawning spaceships.

  2. I have also added the destination reached Interface because that is important for the game as it tells the manager to clear everything from the arrays and that the wave is no longer active.

  3. There seemed to be an issue with the new thing I have created, after the 3rd wave nothing was spawning, also I forgot to remove them from the stage array as well.

  4. I got annoyed that I couldn't find a node I was searching for, so I color coated every comment based on what they represent, Blue is movement, dark blue is even tick, pink is event begin, Red is death, Green is movement that relies on splines, and yellow are collisions.

  5. I have made it impossible to spawn special enemies (Asteroids, Satellites, Space Stations) during chance stages.

  6. I have updated the Spline selector on the enemy blueprint, by having added the reference to the enemy manager that we have made in an earlier iteration. (This will simply reduce the chaos a little)

  7. In this part I am trying to make it so once an enemy reaches the end of the spline it just respawns instead of returning to the middle. (This is only during chance stages )

January 8, 2023
  1. I have made it so at the start we check if this stage is a chance stage and then decide on how many enemies should be spawned. For chance stages it's always 40, however for normal stages it fluctuates at random between 50 and 40 enemies.

  2. I have fixed an issue, because the destroy actor didn't have a reference it destroyed the manager, and crashed the game. I have also added a delay so this event doesn't happen multiple times at the same time.

  3. I have made it so the enemies that reach the end of the spline move to the assigned slot without waiting for the 1 second delay.

  4. I have improved the Comments, as well as changed the order, if after the delay there are still enemies left, then spawn the space stations (To prevent the spawn of stations after the end of the stage)

  5. I have made it so it only spawns Space stations if there are enemies left in the stage. (Otherwise pass onto the next stage)

January 2, 2023
  1. I have iterated and removed the single lasers from the laser Removal Event as we will no longer use it as I merged the 2 blueprints

  2. I have made it so once the Enemy reaches the end of the spline, it will become small and be assigned a specific slot at the center of the screen, where it will stay idle until further orders.

January 1, 2023
  1. I have added a new branch checking if the wave is active that will stop multiple waves from appearing at the same time.

  2. The code to destroy all lasers actually didn't work, it would crash the game engine, my hypothesis is that there were too many loops at the same time therefore instead of doing them at the same time, I am doing them in a row and now it works perfectly.

  3. I have added the Destroy all lasers event, when the player dies. I made the event but forgot to call it.

December 21, 2022
  1. By adding a random delay I have made it possible for the enemies to not overlap because this way the odds of them arriving at their destination at the same time is extremely small.

  2. I have made it possible for the enemies to get back to the middle after moving off screen. however they would often overlap

  3. This is the function that moves the enemies off screen

  4. I made it so it can randomly chose where the enemies will flee towards.

  5. Made the mechanics for when the player dies, this will make enemies passive and make them flee off screen.

December 20, 2022
  1. I have fixed the enemy removal from the wave array, now I am clearing everything instead of individually removing them.

  2. I have iterated upon the Satellite targets because I have realized the player will also move so the satellite's rotation would have to change as well.

  3. I have noticed that multiple waves of enemies would cause an insane amount of lag, therefore I have created a new part that would only activate the lineTrace only if the enemy is moving.

  4. I wanted to make it so once an enemy is no longer part of the wave that they should be removed, however it doesn't remove all the enemies. I figured out why, apparently it removes 5 and the others cannot be accessed because their index is now smaller than 5, therefore they cannot be found in the foreach loop.

December 19, 2022
  1. This is the first implementation of Satelites. How they are spawned and where they are heading.

  2. I have made it so you can spawn the Space Stations in front of the Player, and chose whether or not the middle one is a weapon pod or a space station.

  3. I have added a way for the player to be killed if the enemy collide with the player spaceship.

  4. I have set by default the actor rotation (Working)

  5. Second attempt, this time I wanted to rotate based on the velocity. (Failed)

  6. I have attempted making it so you can rotate the satellites to face the direction they were going (Failed)

  7. I have added the kamikaze function, which would direct the enemy towards the player.

  8. I have implemented enemy states on the enemy with their functionality.

December 18, 2022
  1. I have made this to test the function that changes splines depending of the wave, I will 100% replace this because it's a horrible way of doing it, but it's good for testing.

December 16, 2022
  1. After 4 hours of lost progress, I have found the reason why the shrinking system was malfunctioning, instead of the main actor I should have looked for the Component, which doesn't make any sense because it worked until now and the coordinate is the same...

December 15, 2022
  1. Added the custom scale

  2. I have solved an issue with the comments where is said Largest for the minimum scale and Smallest for the maximum scale. I have also added a maximumScale float variable because not all enemies are the same scale.
    (This is set after the switch on enumerator)

  3. I have made the asteroid movement to work, the issue was that it couldn't decide towards which side to move to, so it shifted between them, and tweaked the variable to resemble the original (Needs to be tweaked more)

  4. I have solved an issue I had where the enemies were spawning at the scale of 0.8 so they were too large at the beginning.

  5. I have added on the Enemy manager a way to spawn asteroids.

  6. I have made a new event, which will move the asteroid. (This is however flawed, so it doesn't work as it should)

December 14, 2022
  1. I am setting the Enemy Type on the Enemy right after spawning, so it can change sprite, functionality...

  2. I have also made it so if the enemy type is an asteroid to keep it invincible. (The only invincible enemy)

  3. I have made a function that checks the enemy type (Assigned by the enemy manager) and changes sprites accordingly.

  4. I have changed the shrinking system, to a more improved system that checks all the actors in the scene and ignores them all.

  5. This is the enemy laser blueprint, it is capable to change scale, kill the player and move towards the player.

  6. I have made a temporary way to for the enemies to shoot the player, so far they have the functionality to shoot towards the player and hit the player.

December 13, 2022
  1. This is the Enemy manager blueprint currently

  2. This is how the Enemy_spaceship blueprint looks currently

  3. I have made it so at the beginning the enemies will be invincible, the Error appeared because you could spawn kill them.

    On the laser I have made a branch checking if the enemy is invincible.

  4. This is how I used the delay I made before, this will spawn 10 enemies (An entire wave) with a short delay between each spawn.

  5. because there isn't a loop with delay I have done research and I have made my own Macro which would make a delay between each enemy spawned. (This way I wouldn't have to spawn an enemy add a delay, and do it all over again 10 times)

  6. When spawning the enemies we will decide what spline they must use and convey that information.

December 12, 2022
  1. I have made it possible for the enemies to become smaller or larger depending on how far away they are from the center of the screen, I had issues because the line cast would get blocked by the other enemies, so I had to ignore all BP_Enemy_Spaceships. Now it works perfectly.
    I will use this on the lasers as well.

  2. On the Enemy Spaceship I have tried making it so the enemies become smaller the closer they are to the center, in order to achieve this I have tried using a line cast that would return the time it took to reach the middle of the screen. (A value between 0.1 and 1 which is perfect) however it didn't work, it only works when the spaceship is 1 cm away, so I need to make a way to convert the distance into a value between 0.1 and 1.

  3. This will take the values received from the Enemy Manager, and convert them into a spline the enemies will follow.

  4. I have made it so I can manually assign the spline on which the enemies will move, based on stage and wave.

  5. I have made it possible for the Enemy to follow the spline (At the moment there is no rotation) but I will add it in the next iterations. [Functional]
    I have also made it possible to change the spline when necessary .

December 8, 2022
  1. In this iteration I have paved the way for both the Point System and the Stage System using the interface event I have done before. I have also implemented the Wave and Stage system.

  2. I have made it possible to start an interface event from within the enemy spaceship. this is only a prototype after a few hours of watching tutorials and unsuccessful attempts.

  3. This is the part on the Enemy manager, like I said it only prints a string but it will do more in the future.

December 7, 2022
  1. This is the part that is on the laser, it's purpose is to gather all the data from the enemy and transfer it to the player so he can assign the points, convey the information, and so on. (Because both the laser and the enemy get destroyed, so they might create errors).

  2. First commit

    See

1 comment

  • Robert211016

    December 7, 2022, 3:20 pm

    This is the part on the Player, which binds the event, for when the laser collides with an enemy