Dev Log: Getting started with Tower Defense
This is a development log showcasing the development of a tower defense engine for RPG Maker. Awhile ago I had shown some previews of an RPG Maker Tower Defense engine in the works. It looked something like this:
Well, it ended up only being a preview and that was it. So now in hopes of actually finishing the system, I’m going to create a dev log to show a tower defense engine being created for RM step-by-step.
Background
Wikipedia has an article on Tower Defense. It summarizes it as follows
The goal of tower defense games is to try to stop enemies from crossing a map by building traps to slow them down and towers which shoot at them as they pass. Enemies and towers usually have varied abilities, costs, and upgrade prices. When an enemy is defeated, the player earns money or points, which are used to buy or upgrade towers, or upgrade the number of money or points that are earned, or even upgrade the rate at which they upgrade.
I’m sure at some point in the history of gaming, the original tower defense game probably involved architectural towers of some sort, but at this point it is just the name of a genre and “tower” can represent anything you (may or may not) control. Such as fire-breathing kitties.
Outline
Based on the overview above, the goals of the system is fairly straightforward. At the bare minimum, we just need
- Towers
- Enemies
- Showing towers and enemies on the map
- Building towers
- Enemy spawn points
- Enemy move routes
- Interaction between units on the map
- Locations that enemies want to go to
Let’s look at how each concept can be represented in RPG Maker.
Towers
Towers are the units you control. They can be upgraded through methods such as gaining EXP by defeating enemies, or spending points on them. They can be represented as Actors.
Enemies
Enemies are the units you don’t have much control over. We can represent them using Enemy objects in RM and set them up through the enemy database.
We already have access to a variety of things such as how much exp they give, how much gold they drop, and basically anything else you can think of with RM.
Spawn points
This is where enemies appear. There can be one or many spawn points. We can simply use an event to represent a spawn point.
End Location
This is where enemies want to go. There can be one or many end locations. We can use an event to represent this.
Move Routes
The path that enemies take to a particular location. The event system already support move routes, so we can use that.
Showing units
Although we know how we want to set up our database, we still need to be able to them on the screen. A custom class can be created that will hold a battler, whether it is an actor or enemy.
Note the significance of this design: by allowing a tower defense battler to hold an existing actor/enemy, if you already have an existing party that you wish to use, you can simply plug them into the system.
Interaction between units on the map
The objective of the basic tower defense game is to prevent enemies from going to a particular location. You build towers to defeat enemies that pass by. We would need a way to provide this kind of interaction between units.
Building units
A set of menus would need to be created that allows players to build units and place them on the screen.
Build locations
Units may or may not be built anywhere you want. In some tower defense games, units cannot be placed in such a way that no path to the end location exists. In other games, this restriction does not exist because the enemies can fight back. We can use regions to restrict where units can be built or not.
Moving Forward
After thinking about all of the basic features that are needed, we can begin building our tower defense engine. Some parts of it are relatively easy, while other parts may be more complicated.
Ideally, at the end, we will have a stand-alone tower defense system that can be plugged into any project with no compatibility issues.
Spread the Word
If you liked the post and feel that others could benefit from it, consider tweeting it or sharing it on whichever social media channels that you use. You can also follow@HimeWorks on Twitter or like my Facebook page to get the latest updates or suggest topics that you would like to read about.
Maybe too late to post here (3,5 years later… :P).
How did it go? I mean about your TD project?
Would love to see how your game looks like 🙂
Was trying to build my own TD games for like 1 years ago, I still have that project on my PC.
The problem was to be available select tower and place it somewhere. Don’t know how to do that :/
Same with the projectile to enemies that does dmg to them.
So I did give up, can’t find any RPGMV games that have TD genre, only some few clips on youtube, but none of them
is completed for testing.
I love RPG 🙂
And I love TD <3
To get that togheter would be nice =)
Like a mini-games.
Omg! I’m looking so forward to this! <3 <3 <3 <3 <3
Really cool. I’m sharing it on my DevBlog. <3
I’ve been on a Crystal Defenders craze lately hahahah, so many ideas flowin’
Looking forward to this. I’m working on my a keep defense mini-game in my RPG, with stationary archer units and melee units that move towards enemies (much like the Fort Condor mini-game in FF7). But I’m having trouble with effective way for the units to acquire new targets. I’m also using your move route extras, move route triggers and custom event trigger scripts to handle the melee units moving towards enemies and damaging them on contact, but it’s not really optimal.
Also I haven’t figured out how to make archers shoot visible projectiles. (Might need some sort of icons on map script)
I can’t imagine to play a “true” and very fun TD game made with the Maker, but this looks awesomely interesting nevertheless! I’ll keep my eyes open for surprises on the way~
By the way, you should really get paid for all your efforts with RPG Maker and all those tutorials and explanations. Always an interesting read!
What kind of things would make it less fun than a TD made in a different engine?
You can help by referring me and my blog to others and letting them know what kind of things are available.
Whenever I see someone who’s remotely interested in RPG Maker, they either already know about you or they wouldn’t create stuff on their own, but I’ll remember to mention your sweet site.
About your first question, well, mostly it’s that I’m a big fan of TD games, but I only play them with my digits on my phone and I suspect that the quick gameplay and things like special lightning strike attacks or the whole damage system might be somewhat complicated to build in RPG Maker, although I have already learned so much since I started with it, so I also wouldn’t be surprised if you can actually get something fun together with it.
If they aren’t interested in making things on their own, they may know someone that is involved in RPG Maker that doesn’t know about my scripts.
The basic TD engine would be based mostly on RM’s default systems. For example, the damage system would be calculated the same way you expect as the default battle system.
I’ve played a few games where you had a special power that you could unleash when a gauge is filled, or you have enough money to use it. This could be replicated by adding a button to the HUD and then attaching a common event to it. Ideally, you would basically create these special skills using eventing.
Yup, I believe even with a custom engine for TD games, there would be a lot left to event for such a game. But I mean, people can also create a quick pac man game with the default engine if they wish, so there are enough possibilities for all kinds of genres. I mean, other scripters have also “upgraded” the Maker to other awesome engines (like Tomoaky’s countless different genre engines), so I’m excited what you’re going to create.
And yup, will be mentioning whenever appropriate =)
Couple of things come to mind in terms of a traditional TD. As you pointed out, the interaction between tower and enemies is very important. Projectile is the most common way for towers to attack the enemies. However, there are other forms of attacks some towers utilize such as Aura AoE Attack. It should be doable through a simple proximity check between the events for such a kind of attack. Overall, very interesting script as it can be utilized in all the projects. Having a variety of medium for players to interact with the game is important. I can see myself being hooked to a side minigame of TD in a traditional RPG!
FF7 is a pretty good example. I think they had 6 or 7 mini-games integrated into the story. Though, the disadvantage with that is some people might not like some of the games.
I will be starting with a very simple attacking system, where you specify the attack skill used (which dictates the animation and damage), along with a custom “range” property. If an enemy is in range, the skill will be executed. Whether it hits or not would likely be based on the default hit/miss calculations.
AoE would be after the system has been completed.