Endless Enemies


At night, bugs can hatch out of any natural surface. Defend against attacks from all sides, and even inside if you're not careful. Highly configurable. Inspired by BREAM, by StephenB.

Tweaks
5 days ago
2.0
155
Enemies
Owner:
TeabagNation
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
12 days ago
Latest Version:
1.2.3 (5 days ago)
Factorio version:
2.0
Downloaded by:
155 users

By default, causes enemies on Nauvis and Gleba to spawn every 20 seconds on the closest natural piece of unblocked terrain, during the night. Spawn rate is based entirely on evolution factor, and pollution has no impact on it, so it can work on any surface.

The behaviour is extremely tweakable. Which units spawn on which surfaces, at which evolution threshold, in how many groups, how often, how dark it has to be, etc. In fact, it might be too tweakable; some knowledge of Lua syntax will be helpful if you want to really get use out of the available settings.

The UPS impact is very small, despite the amount of spawns. Target finding is done in parallel with the rest of the mod, and only checks one chunk per surface each tick. I haven't done serious testing, but I suspect that using this mod in place of vanilla biters will actually improve UPS, because there will be a lot fewer idle entities on the map.


Demolishers

Demolishers can be spawned, if you add them to the spawn definitions, but can't be commanded to attack a target. They'll just start patrolling around the area where they spawn. They also have no pollution consumption by default, so you need to add a "pollution" field to the spawn threshold table for it, or the game will go into an infinite loop and crash.
Note that on default settings this will eventually result in you getting multiple demolishers spawned just outside your base every 5 seconds. Have fun! (Or learn how to use a ternary operator and change the number of waves to 1 per night for only Vulcanus, if you're a wimp)

Example of Adding Demolishers

Surface spawn definition

Add the following definition into the table after the nauvis and gleba stuff. (IE {nauvis={...}, gleba={...}, vulcanus={...}})

vulcanus={"demolisher"}

Evolution threshold for spawn

Add the following definition into the table after the biter/spitter/wriggler/etc stuff.

demolisher={{name="small-demolisher", threshold=0.95, pollution=3000},{name="medium-demolisher", threshold=0.98, pollution=6000}}

The names small-demolisher and medium-demolisher must match the in-game prototype names for those units, but the demolisher class name is entirely arbitrary. As long as you use the same class name in the spawn definitions and the evolution thresholds, it doesn't matter what the name actually is.


Mod Support

Custom enemies from any mod should work, but support is very much a DIY situation. For each modded enemy type you want to add, you must look up the prototype names and then define a spawn threshold table including those names. Once the spawn thresholds are set, add the class name to the spawn definition table for the surface you want them to spawn on. You can refer to the above example of adding demolishers; it's done exactly the same way, but probably without the "pollution" field.


Known Issues

  • Sometimes spawned groups will just hang around instead of attacking their intended target. The mod tracks enemy groups that it spawned, and will remind them what they should be doing once per minute. They eventually get around to it.
  • Adding the mod to an in progress game with very large surfaces can result in no spawns happening for a while, as the 1-chunk-per-tick search algorithm slowly works through all the generated chunks. Spawns will eventually start to happen normally.
  • If you screw up the settings you can crash the game. This is not a bug, it's a feature. Great power, great responsibility, etc, etc.

Potential Future Work

  • Tips and Tricks entry with examples of possible settings formulas.
  • Make the spawn dummy collision box very large, so buildings can be used as an effective safe zone.
  • Look into distributing settings across helper mods that can be easily cloned and edited, so users don't have to edit code in those stupid tiny textboxes.
  • Some sort of algorithm to scan which enemies spawn on which planets, and auto-generate spawn tables from that.
  • Compartmentalize settings on a per-surface basis. Hard mode - find a way to do it that doesn't add extreme bloat to the settings menu.

Check out BREAM if you haven't already. It's a different take on the same idea, which absorbs pollution to determine spawn amounts. It's also highly configurable, and each mod has its advantages. The mods don't conflict with each other; run both, if you're insane!