Rampant

by Veden

Improves the enemies tactics by using potential fields (pheromones) allowing probing of defenses, retreats, reinforcements, counterattacking, breaching, raids, rallying death cry, and player hunting. Uses blockable biter projectiles. Adds new Enemies which can be disabled in mod settings. Difficulty setting in mod options menu.

Content
1 year, 7 months ago
0.13 - 1.1
124K
Enemies

g Is there any way to make them stop attacking rails?

3 years ago

The new enemies just keep attacking train rails. There is an option to make the rails not take damage in this mod but enabling this option doesn't prevent them from attacking the train tracks. I play on railworld-type map generation settings and about 95% of any enemy attacks are rails that are far, far away from anything interesting. They don't do this behavior in vanilla. Is there any way you can add in an option to make them disregard train tracks and large electric poles and a target entirely the same way they do in vanilla? If I were to add this in myself, where should I look for the target acquisition code?

3 years ago
(updated 3 years ago)

I'm probably pretty close to figuring out how to modify the biters to not even consider rails a target. It looks like in the onBuild(event) function, there is code that registers entities. If entity.type == "resource" or entity.force.name == "neutral" then it doesn't run accountPlayerEntity(). I can make it not account safe entities as a player entity at all and this might work. The only problem is that this function only seems to run when an item is built and doesn't apply to already built stuff such as my extensive train network. I can't seem to find how the mod re-accounts for "safe entities" upon config change but onBuild doesn't seem to be it.

Edit: I was unsuccessful in modding in the fix for this. I was trying to either:

  1. find the code that "accounts the player entities" that probably runs when the mod runs for the first time. Then I make a custom command to re-register all the stuff only leave out the safe buildings so the ai doesn't even know they exist. Then do the thing I mentioned where building a new safe entity doesn't count toward accounted player buildings. This method was unsuccessful because I could not find the where this is run upon first load anywhere. I couldn't even find or understand the database that accountPlayerEntity loads stuff into.

  2. add some type of code right before a biter attacks something that basically does "if targeted thing is safe building, don't do it". I couldn't seem to understand entirely how the target acquisition logic works. It seems that it ranks stuff with points based on chunks and attacks the general chunk they calculate is best.

this issue is incredibly annoying.

3 years ago

Yes, currently the building safety only applies on build or death. This was a tradeoff I made for performance over functionality that I decided a long time ago and just never have gone back to it.
There are lots of code paths in Rampant that haven't been touched in a long time because I don't use the functionality and I have limited time.

New response