Personal Project - Enemy Spawner
Second video to be added soon to provide video tour and description of the blueprints!
Focus of the Project
This project came about as a tool to help Level Designer students create levels that include enemies. By creating this enemy spawner, I was hoping to help those students control the placement and visibility of their enemies in a level along with providing the possibility of their levels having waves of enemies to fight. This project was also my first look into Unreal's blueprint system and a chance to get more familiar with the engine.
How does it work?
The enemy spawner is a plugin that comes with 7 parts: 5 blueprints and 2 structs:
- The spawn box: A trigger box which, when the player walks through it, will call one of the spawners provided to it at random to begin.
- The spawner: An actor which performs the functions to spawn enemies in the order and with the parameters specified. Can be place anywhere in the level to work.
- The spawnpoint: The point at which the enemies will spawn. Comes with a large arrow to indicate which direction the enemies will face when spawning.
- The enemy death attachment: An actor component which will attach itself to an enemy when it has been spawned through the spawner. On enemy destruction/through the custom event call, this attachment will tell the spawner that the enemy it is attached to has died.
- The boss death attachment: An attachment that acts very similar to the enemy death attachment, but when the enemy dies with this attachment, the attachment tells the spawner that a boss enemy has died.
The round struct:
Linear Spawning:
Linear Spawning rounds are created by not checking the “Random” checkbox under the Round details on a spawner. These rounds will basically spawn enemies in the order that they are listed on the Enemy Data Table, and the max number of enemies will be set to the number of entries in said Enemy Data Table.
Random Spawning:
Random Spawning rounds are created by checking the “Random” checkbox under the Round details on a spawner. These rounds pick from the enemies listed in the Enemy Data Table at random while leaning towards the enemies with a higher preference percentage. How the preference percentage works is described in greater detail in the “Data Table” section of this manual. You have to set the max number of enemies for this round, yourself, and the spawner will spawn number of random enemies that you specified in this value.
Boss Spawning:
Boss Spawning rounds are created by checking the “Boss” checkbox under the Round details on a spawner. This round type is only meant to be used before a Looping Spawns round. If you don’t intend to use a Looping Spawns round, just spawn the boss normally. Basically, enemies spawned this round will be consider “bosses” and as long as they are alive, the Looping Spawns round will continue to spawn enemies as long as its “number of loops” hasn’t run out.
Looping Spawns:
Looping spawns rounds must come after a Boss Spawning round, or they just won’t work. This round is meant to work by initially spawning the number of enemies specified, and then whenever a normal enemy dies, the spawner will spawn a new enemy to replace it, keeping the number of enemies to a maximum amount. This spawn can be linear or random with linear looping through the same set of enemies in the same order no matter which of the normal enemies are killed. Once all of the “bosses” for this spawner has been killed, the spawner will stop spawning the looping enemies. The number of enemies that can be spawned is limited by the “number of loops” for the round. How “number of loops” works is described in the Spawner section in the bullet points.
- Wait time Minimum is the lowest possible amount of time the spawner waits between spawns.
- Wait time Maximum is the highest possible amount of time the spawner waits between spawns.
- The maximum number of enemies is only used during random rounds. (aka the “Random” checkbox is marked true.) If the current round is Linear, then don’t worry about this value as the spawner will handle this automatically. For random rounds, this value needs to be set to the number of enemies you wish to spawn this round. To put it simply, the value is actually the total number of enemies that were/are to be spawned this round.
- The Defeat Percentage is the percent of enemies that need to be defeated for this round to conclude and move onto the next round. (For those curious, the math is (1 – (current#ofenemies / max#ofenemies)) The value is meant to be between 0 and 1 (0% to 100%), and any values outside of this range will like lead to errors. This value also counts the enemies that are still alive from the last round, if there are any. For example, you need 100% of enemies to be defeated, and you spawned 5 enemies this round. However, there are still 2 enemies alive from last round. To reach 100% defeat percentage, the player has to kill all 7 enemies. Defeat percentage of 0% will just make the next round begin immediately.
- The random checkbox is used to indicate whether this round is “Random Spawning” or “Linear Spawning”. Both will be explained below.
- The boss checkbox is used to indicate whether this round is “Boss Spawning” or not. “Boss Spawning” will be explained below.
- The looping checkbox is used to indicate whether this round is “Looping Spawns” or not. “Looping Spawns” will be explained below.
- The number of Loops explains how many enemies will spawn to keep max number of enemies in a “Looping Spawns” round. For example, putting 3 here will mean that only up to 3 enemies will spawn to replace dead enemies. Leave this value at 0 if you want infinitely spawning enemies to replace dead enemies for this spawner.
Linear Spawning:
Linear Spawning rounds are created by not checking the “Random” checkbox under the Round details on a spawner. These rounds will basically spawn enemies in the order that they are listed on the Enemy Data Table, and the max number of enemies will be set to the number of entries in said Enemy Data Table.
Random Spawning:
Random Spawning rounds are created by checking the “Random” checkbox under the Round details on a spawner. These rounds pick from the enemies listed in the Enemy Data Table at random while leaning towards the enemies with a higher preference percentage. How the preference percentage works is described in greater detail in the “Data Table” section of this manual. You have to set the max number of enemies for this round, yourself, and the spawner will spawn number of random enemies that you specified in this value.
Boss Spawning:
Boss Spawning rounds are created by checking the “Boss” checkbox under the Round details on a spawner. This round type is only meant to be used before a Looping Spawns round. If you don’t intend to use a Looping Spawns round, just spawn the boss normally. Basically, enemies spawned this round will be consider “bosses” and as long as they are alive, the Looping Spawns round will continue to spawn enemies as long as its “number of loops” hasn’t run out.
Looping Spawns:
Looping spawns rounds must come after a Boss Spawning round, or they just won’t work. This round is meant to work by initially spawning the number of enemies specified, and then whenever a normal enemy dies, the spawner will spawn a new enemy to replace it, keeping the number of enemies to a maximum amount. This spawn can be linear or random with linear looping through the same set of enemies in the same order no matter which of the normal enemies are killed. Once all of the “bosses” for this spawner has been killed, the spawner will stop spawning the looping enemies. The number of enemies that can be spawned is limited by the “number of loops” for the round. How “number of loops” works is described in the Spawner section in the bullet points.
The enemy struct:
- Pawn Class: The pawn class spawned as the enemy. Used in all cases.
- Behavior Tree: The behavior tree meant to be attached to the enemy AI being spawned. Used in all cases, can be set to "None" if there is no behavior tree that is meant to be attached to this pawn.
- Preference Percent: The percentage of how often you want this enemy to be spawned in random spawning. This data table's preference values should add up to one, or the spawner will adjust for going over or under. If you want all enemies to have an even chance of spawning, leave this value at 1. Example case: Soldier enemy has preference of 0.2 and Zombies has a preference value of 0.8. This will cause soldiers to spawn 20% of the time and zombies will spawn 80% of the time.
Rings of Hell - Equipment Permanence
How does it work?
Items Menu:
- Handled by loading each entry in the inventory every time the menu is opened to make certain that, if the inventory has changed, all items available to the player will be displayed.
- Each item entry comes with 3 pieces of information for the inventory:
- The name of the item
- The number of said item currently held by the player
- The description of said item
- The description for the item is displayed in the right-most box through the "On Hover" event on the buttons. They each hold the item's description and their description is parsed to the box for displaying.
Loading of items into the menu.
Equipment Menu:
- Similar to the inventory, the unequipped equipment is loaded in every time the menu is opened to handle any changes in the player's available equipment.
- When it comes to equipped equipment, however, each character has their own set of slots: headgear, leotard, belt, and boots. These four slots are loaded into their respective buttons on the menu whenever the menu is opened or the player swaps being altering the two characters.
- Each equipment's information is handled through a struct which involves 8 pieces of important information that is used by the menu and the combat loading system:
- The equipment name
- The equipment type (whether it's meant to be headgear, leotard, belt, or boots)
- The integer amount of health the equipment adds
- The integer amount of attack the equipment adds
- The integer amount of defense the equipment adds
- The integer amount of speed the equipment adds
- The attack modification the equipment has
- The attack mod on the equipment is used in combat loading to change an attack to a modified form which can come with higher stats or special effects.
Discerning which character to equip the equipment to.
Deeper look into equipping. Involves unequipping any equipment in the same slot and then setting the new item into said slot.
Skills Menu:
- Similar to the inventory, the unequipped skills is loaded in every time the menu is opened to handle any changes in the player's available skills.
- A character's equipped skills is loaded in whenever the player opens the menu or swaps to editing that character in the menu.
- Skills are very simple as the only information they hold is the name of said skills. The name of the skill is looked up in the Master Attack List (a Data Table) during combat loading to actually add the correct skill to the character's arsenal.
- Clicking on a skill button on the unequipped side add the skills to the specified character's equipped skills list. If the skill is already equipped, then clicking the button will unequip it.
- There is a limit to the number of skills each character can have, so when a skill is clicked to equip, the number of skills that character currently has is checked. If the latest skill clicked will exceed the max number of skills available at the time, then the skill will not be equipped.
- Whenever a skill is equipped or removed, that character's skill list is reloaded to display the newly changed list of skills.
Loading of all equipped and unequipped skills in the menu.
The equipping/unequipped of skills when clicking on a skill button in the unequipped list.