• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

A tower defense system

Status
Not open for further replies.
Level 8
Joined
Dec 29, 2006
Messages
359
I'm currently working on a tower defense, and it currently has multiple playable stages. My question is, what would be the most trigger-efficient and conservative way to make it so different sets of monsters will attack the player based on what stage they choose? Or better yet, a way that each wave is composed of random monsters, but is still playable, e.g., the monsters are just as fair as if they weren't randomly generated?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
You need to use a system with some functions which read data from an array database. Entries in the database refer to values used by each wave. Each wave is automatically set via the system so that it moves on to the next.

I made exactly such a system for my green circle TD if you wish to view it for its waves.
 
Level 8
Joined
Dec 29, 2006
Messages
359
I already have a system that pumps out waves, its just that the waves are all the same for all stages, and id like to vary it up a bit, maybe to the point where there are different "types" of stages. forgot to mention that, sorry lol >.<

still, i would be interested in seeing how you set up your waves and such, and perhaps compare that with what i did, and maybe even learn something :D
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I used about 3 functions for the actual system. Function one delt with actual wave advances and loading some stuff values from my data tables for efficency. Function 2 delt with the actual spawning of the waves. Function 3 was used by function 2 as a target for timer delaying the next waves (could probably get rid of it by asigning function 1 to a code variable and using that as the timer target).

The data tables I set up contained everything variable about the waves.

Yes, it is crude and probably unefficent. Then again I made it to pretty much be an improved version of the orignal system and it reduced file size by atleast 10KB by doing that alone. It also allowed me to use handy commands to display detailed information to players about future and past waves, greater so that most TDs.

You can get in from the maps section (still is pending).
 
Level 8
Joined
Dec 29, 2006
Messages
359
ill go check it out right now, sounds like itll be really helpful, thanks for replying btw :D

EDIT: Well, I don't know JASS because i have just recently started fooling with the editor. So, could you please either explain what each function does in-depth, or point me to a good tutorial to learn JASS, so i could read and understand for myself?
 
Last edited:
Level 4
Joined
Apr 18, 2009
Messages
127
ill go check it out right now, sounds like itll be really helpful, thanks for replying btw :D

EDIT: Well, I don't know JASS because i have just recently started fooling with the editor. So, could you please either explain what each function does in-depth, or point me to a good tutorial to learn JASS, so i could read and understand for myself?

Check out the GUI part in Ralle's Tower Defence Guide. This will explain you how to set different types of units in an easy way.
 
Level 8
Joined
Dec 29, 2006
Messages
359
lol thats actually the system that my tower defense uses, the one described in that tut. Im thinking right now that I might be able to get new waves based on the stage by setting different arrays for each stage, and then calling them based on the stage the player picked. Though, again, this does not seem to be the most efficient method.
 
Level 8
Joined
Dec 29, 2006
Messages
359
you guys are getting me wrong, i already know how to spawn waves and such correctly, i have no trouble with that. I want to find out an efficient way to spawn different sets of waves for each stage i include in my map.

Like this

Stage 1: Wave 1: Monster A; Wave 2: Monster B

Stage 2: Wave 1: Monster C; Wave 2: Monster D

and so on for each stage, so that no two stages have identical "sets" of waves.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I fail to see how this is a problem to do. Simply enhance your array system to store more values which add some randomness to it. Eg, you could have 3-5 unit types per wave, and the wave engine will choose randomly from them all the time, or else only at wave start. For more randomness, the spawns could have abilities like evastion, magic immune or extra fast, which can also be randomly retrieved from an array system when spawning them and added to them.

The answer is designing array systems and spawn system to perform what you want. Arrays allow for easy random selection as you can simply pick from them via a random index between a range. Their contence can then be directly plugged into natives to do stuff like adding unit abilities, or creating unit types. With some string arrays you could even make matching announcement text to go with the random waves.

I am not saying arrays are the answer to everything, but in this case they are part of the easiest solution.

Not too sure if this applies to GUI though, as almost always do JASS now.
 
Level 8
Joined
Dec 29, 2006
Messages
359
It wasnt that i didnt know how to do it, i was just searching to see if there was a more efficient way to do it, rather than making arrays for each stage and such. If that is the simplest way to achieve that then ill do it that way.
 
Last edited:
Status
Not open for further replies.
Top