This blog post, I'll be covering my combat system I developed from scratch for my 3rd person platformer unity demo
The brief set in place by our university asked us to create Slimes, similar to those found in Minecraft. In Minecraft, slimes roam the land and spawn smaller slimes when they are killed, if they start as a medium or large slime that is. They are very basic enemies, with a simply jumping attack and large hit box when encountering large slimes. The difficulty within gameplay with that they spawn more and more smaller and harder to hit slime every time you kill the larger versions, even if they get weaker. This creates a nice balance for players to fight with.
When creating my own slimes, I started by getting the aesthetics down, making mine very close to the original just to give myself a feeling of threat when fighting them in testing, instead of simple cubes bouncing at me. I implemented a simple jump mechanic alongside an instant snap rotation to face the enemy they are chasing. I think a smoother rotation toward the player would have been better ideally, but this is what I would have added if I had more time.
Another property of slimes involved having an 'active area' or not. If they did, then the slimes would roam freely, but only within that area. If the predicted landing spot was outside of this, then the slime would not jump, but only spin to face the enemy, staring it down. I also created a spawner button that had the option to add an active area to the enemy if you wanted. I used a place for this, then ignored the y axis when checking if the landing position was within bounds. This worked nicely, but if I had a scene with a layered layout, then I'd have to rethink this and maybe only create a volume of area that the slimes can move within instead.
The Slimes themselves are all prefabs for each different size, with many options regarding jump force, if they spawn more on death, how many, what enemy to spawn on death, how much damage they do to players and how much health they have themselves. These can all be tweaked to however you would like, but following the guidlines presented to me, I left the defaults to always spawn 2 smaller enemies on death unless you were the smallest, all damaging 1 health point, and their own health going from 3 to 1 from largest to smallest.
For my own combat, I already had a simple punch animation set in place, I just had to tie a method of damaging enemies to that now. If an enemy stood a certain range in front of me when I punched (this can be changed, but by default it was set to 3.5 meters) the enemy would lose 1 health point. This mean large slimes took 3 hits to kill and medium slimes 2, and small slimes 1. Every time I punch the enemy, I wanted a sense of weight, so I added a little knockback. Similarly, every time a slime touched the player, they would knockback the player as well as damage them.
I could have added the sword to my character, but that would have involved major reworks of my character design, though I plan to implement this into my group project when I add my character to it.
Do look forward to my next blog post regarding my upcoming group project, but for now, thanks for reading!
Leave a Reply.
Hi, I'm Conrad Wilson. a Games Developer & university student at UWE Bristol.