Hello, I need some help organizing Wave data for my Tower Defense game. What I want is a way for data to be stored that can be easily edited and modified. I also want this to be compatible with a fixed wave count and also an infinite wave count. I’ve tried storing the data as a list with each string representing each fixed wave data, with one sub list for data for each wave and another for the enemy data. However, I haven’t been able to find a way to accurately and effeciently organize my data. What would be the best way to store this Wave Data?
For some context, this is how I store the data currently, and I have two seperate functions in a seperate object class that initalizes the data given here. The number indexes are the wave numbers.
What I would do is maybe start off with something like this,
and then develop it more as you seem fit. I recommend using dictionaries
instead of tables. Its more easy to work with something similar to JSON.
Then when it reaches the last wave, you either finish the game,
or you can generate a random wave, and make a function that takes a difficulty level,
and based of that returns a wave that has harder mobs and more mobs etc.
Game1 = {
#Start the first wave after 5 seconds has passed from gamestart
[5] = {
initWaveMessage = "Welcome, we are now gonne spawn some basic mobs",
waveEnemies = {
#summon first attack in wave after 3 seconds passed since first wave
[3] = {
waveMessage = nil,
[1] = {
mobID = "scout",
mobAmount = 5,
spawnBuffer = .5 --delay for spawning mobs
modifiers = {
health = 50
},
},
},
#summon second attack in wave after 25 seconds passed since first wave started
[25] = {
waveMessage = "you have survived so far goodjob!"
[1] = {
mobID = "lightScout",
spawnBuffer = .25, --delay for spawning mobs
mobAmount = 10,
modifiers = {
health = 25
},
},
},
},
},
}