Intelligent Enemy Spawning System?

0 favourites
  • 2 posts
From the Asset Store
Create complex dialogues with ease with this tool/template!
  • Hi,

    My game involves fighting off waves of aliens. The aliens come in the form of predefined waves. What I would like to do is set up a system that can do actions like the following...

    Alternate between shooty aliens and melee aliens

    Pick waves with different difficulty levels, so that the average difficulty per round goes up slowly as the player moves through different rounds

    What I'm mainly wondering is, how should I store this data? If this was code each wave could be a class, and each wave would have associated variables like difficultyLevel and hasShootyAliens. Once I can have the data stored in some easily accessible way I think I can start training the computer to spawn waves that present the desired difficulty level.

    Let me know if any of this is unclear, and what you think the best solution is. Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can store the data in web storage. What I usually do for waves, obstacles, etc... Set up a variable for the amount of time between waves (waveTime). I then setup a timer and have it use the waveTime variable to define how long the timer runs. For example every "waveTime" seconds do X. Where the magic comes in is that on X you decide what should happen. As the difficulty rises, etc... you can drop the waveTime variable down to decrease the amount of time between waves.

    If you want to randomize your waves based on difficulty, create a variable called difficulty. When your timer runs you can do something like this:

    Every "waveTime" seconds

    -->If difficulty is 1 > Set enemyWave to Choose (a,b,c,d,e,f)

    Then in your events you decide what enemies you want to spawn for a, b, c, etc... for example I could say:

    if enemyWave = a > Spawn Red enemy

    if enemyWave = b > Spawn Blue Enemy, etc... etc...

    You do this for each difficulty 1, 2, 3, 4, 5, etc...

    That gives you a very simple yet random game that adapts based on the difficulty and will also spawn multiple types of enemies so that the game does not get stale. And each difficulty you also decrease your waveTime variable so enemies come faster and faster as the difficulty rises.

    You can also use the variable for difficulty or one for wavenumber and have the enemies health, speed, etc... go up based on them as well. That way even if they run into the same enemies they are more difficult to kill on higher waves, etc...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)