The MOBA Blog

The MOBA Blog

Introduction.

The purpose of this blog is to create a MOBA game that will be released on GitHub for free. As I move forward, I will update the build accordingly. When I'm done, I was like to use this template to create a MOBA game of my own. It won't compete with 'League of Legends' by any stretch. In fact, it will most likely be a more casual single player game. 

That shouldn't stop you from using the build of the game to create your own type of experience though! You are free to download and take the build in whatever direction you please! 

Let me tell you a story.

Once upon a time I tried to sell an asset on the Epic Market place. It was supposed to be themed after a Chimera which was supposed to add to the antagonistic feel. 

Being that I was someone who didn't know how to 3D model, it wasn't accepted. Truth is, I fancy myself a Game Designer more than anything which means I know little bit of every process, but I am Master of None.

So this brings us to today. I'm just going to give you all this project! that's right, instead of just rotting away on my solid state, all of you can do with it what you will. So, will I!

Some of you will undoubtedly remember I was making a MOBA at one point in my channel. That was years ago. I was younger then, hope in my eyes, eager to do what I could. These days I've been forced into wage slavery, and I want to do something worthwhile! 



Ready, set, go!

So, initially this was just going to be a tower that you could implement into any game type. You can still do that but I'm going to take it to the next level and implement enemies, spawn points, and allow players to fight! This particular blog will follow and show my process.

It's incomplete but you're free to do with it as you will. More content coming soon!

What are we working with?

So, it's like this: The Tower is set to grab the first target that enters its perimeter. It begins shooting at the rate that is set within its properties. I tried to make the tower stand-alone so that you could place multiple on the play space, if you so choose. You know what? I choose. 

What are we even making?

What I would like to do is make a build of this game for people to play. Right now, I have an example map where you can run around and avoid the tower's shots. Not that it matters, because it doesn't even do any damage. This brings up an important point: I'm missing a ton of things to make this a standalone experience.  so, let's make a list of things that need to be addressed. 

  • Start Screen
  • Attack
  • Health (Player and enemy)
  • Lose Screen
  • Minion

That should be a good list for now (color for dramatic effect and because I can!). I don't have them in a specific order but let's start with making an attack happen from the player. For this I need a weapon but I'm not using any Marketplace assets . . . yet. So that I don't violate any distribution clauses, I'm going make my own, using the modeling tools that come with the Editor.

I know I said I wasn't a 3D artist but we're doing this anyway! Honestly, I've been wanting to learn that new system and I need to get away from BSP because well, its ancient. 

Sword!

Let's load up the Modeling tools. I'm going to start with a box primitive and turn that into my mighty blade of awesomeness! I'll make a few cuts within the topology; I was able to manipulate it into a shape that makes more sense for a sword! I, more or less, manipulated the vertices until I got a shape that I was happy with. This gave way to a thought: I need to do something about the UV's. 

Famous last words, I know. The modeling toolset comes with a UV editor so I may as well use it. For those not in the know, UV editing is helpful for making your materials apply to your 3D model and make your life awful!

After like, an hour of this (certainly felt that way!). I realized something super important about modeling this sword: You know what? Who cares? I don't need to make this thing look pretty because I am going to replace it anyway! 

And just like that, we're done with the sword! 

Make Damage!

The concept of damage basically boils down to an Actor that spawns with its own collision check. This means that all damage can have its own independent child actor and custom attributes that we'll set up here. Again, I'm no artist so we're going to use a sphere Primitive with a glow-y material. The sphere comes with it's own collision which we're going to promptly turn off. I'm going to add my own collision in the form of a box collider. This will make it simple for the Engine to calculate what the actor was overlapping.

Perfect! Now I have to make sure that the Actor only exists for a certain amount of time so that I'm not spawning a new actor every time I try to hit something. We're going to use Blueprints for this as I'm not too comfortable with throwing out a bunch of C++ code into the repo (I don't want your machine to explode, I'm saving you!). First, we need to make sure that this Actor destroys itself no matter what. 

On the 'Begin Play' event node we're going to place a destroy node after it. This will make the actor kill itself as soon as it spawns. Efficient but we want it to exist for long enough to actually do the damage. This calls for a Delay node! This is a crude solution, and I'd much rather use a Timer, but we'll address that later. Now the Actor behaves as expected! This was all just to make sure that, no matter what, the Actor wouldn't overstay it's welcome. Now we need make behavior for when it overlaps something it hates!

To do this, we need to use the 'OnOverlapped' function located within the Box Collider. Once we have the event node, we can define what Actor's we're looking to damage and how much damage we want to apply. I'm going to use the generic 'ApplyDamage' function as this will allow me to just add damage to an overall Actor without worrying about a specific point (headshots are probably for a different project but you can change it to what you want!). 

I'm going to hard code the damage amount for now but that will be its own variable, eventually.  So now, what we have code that basically says, "No matter what, I'll destroy myself but if I overlap an enemy tower, I'll apply my damage AND destroy myself!" So, this should handle everything for my Damage actor. 

Animation!

I love animation! I usually give this a lot more time but much like the sword, I just need something in there for now. I'm going to load up the animation program that I typically use. It's called Akeytsu. I don't even think the company exists anymore, but you can get it for free if you want a quick and easy animation tool. Blender also works just fine. 

I'm going to do a quick and simple sword swing that makes enough sense to get the point across. Again, this is just to have something inside the engine.

Okay, we're back in the editor! Ignore the fact that the animation imported on the wrong axis and now I have to reimport it at a -90 degrees 'X' axis :P. I need to create an animation Montage, that way the animation can hold data that we can call with an AnimNotify.

Speaking of, let's make one of those so we can call it. In the file browser, right click the file bar and search for 'notify' and make a new notify type from the actor browser. Name it what you want then you'll be taken to the editor. In this case, if we want the Blueprint editor then we're going to have to override the actual notify function. Once we do this, we'll get the input and output of the function. We just need to do one thing here: Spawn our damage actor. Bam! we're done here!

Creating a Montage is simple enough. Right click on the animation you want and select to make a new Montage. This will take us to the Montage Editor where we can add our notify. Basically, we want the damage to spawn just as the sword is swinging downward. We'll scrub the timeline to that point, right click and place the notify we created, here. 

Finally, we need to call the Montage in our code. We'll do this in the Tower after it does a quick check. We'll deal with the code mess a little later (Yes, we're kicking the can down the road but future me can deal with this as he's cursing his ancestors.). From our player reference we're going to pull our attack function . . . which we totally didn't skip over and are just remembering. 

Let's quickly make one in the actual player Blueprint. We're going to make a new function and name it 'Attack' or something to that effect. In this function we're just going to call our animation Montage. Okay we're at the home stretch! 

Back in the Tower asset we're going to call 'Attack' from our player. We'll need to check if the player is in the actual proximity to attack, first. We're going to need to grab the distance with the 'Get Distance' function. We'll make this within the Tower for now (again, kick the can down the road). I chose a distance of <400 which I figure is close enough to get the overall effect. Okay, once this is hooked up, we play test!

okay, the animation plays but I don't see the attack. That's because the damage dealing is happening faster than you can see the mesh spawn. We're gonna have to cheese the system a bit for now (Again, the CAN and the KICKING of IT!). In the damage class I'm going to stick a delay in between the 'ApplyDamage' function and the 'Destroy' function. This will give us an idea that it's happening. Okay let's try this again!


And there it is! it works! There are a ton of issues that we're going to need to make another list of tickets for but we've got this running for now. Welcome to game development! I'm going to divide this into a few blogs so that we can follow the progress of this for sure!

Thank you for joining me this far and stay tuned for the next blog where we actually address the can that we've been kicking!

 

You can find the GitHub Link here: MOBA Tower Turret

Check out my guide on finding a great controller to dev with!
Check out my Monitor setup to see how I make it happen!

Back to blog