From c88e6cc81fd4148fb487b21defee5eca3461d846 Mon Sep 17 00:00:00 2001 From: Aaron Veden <veden@ivcore.com> Date: Sat, 13 May 2017 20:23:25 -0700 Subject: [PATCH] added difficulty setting, interop, and spelling correction --- README.md | 28 +++++++++++++++++----------- control.lua | 1 + info.json | 4 ++-- libs/AIPlanning.lua | 2 +- libs/Interop.lua | 16 ++++++++++++++++ locale/en/locale.cfg | 6 ++++-- settings.lua | 14 +++++++++++++- 7 files changed, 54 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index c8391d2..161e6c6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Rampant Tactics -Factorio Mod - Improves the enemies tactics by using potential fields/pheromones allowing probing of defenses, retreats, reinforcements, counterattacking, breaching, rallying death cry, and player hunting. Also removes homing biter projectiles. +Factorio Mod - Improves the enemies tactics by using potential fields/pheromones allowing probing of defenses, retreats, reinforcements, counterattacking, breaching, rallying death cry, and player hunting. Also removes homing biter projectiles. Difficulty setting in mod options menu. # Forum Post @@ -21,22 +21,23 @@ Configure Options not in game menu: # Features +- Difficulty Scaling - A mod option to control how quickly the ai can perform actions like making attack waves. - Nocturnal Mode - A mod option to force biters to only attack at night. Does not yet affect vanilla attacks. - Recycling Biters - When large groups of biters form on the game map and aren't assigned to a unit group or near a base will be periodically removed and refunded to the ai causing attack waves proportional to the number of units removed. - Breaching - When biters are destroying structures nearby unit groups will come to join them - Frenzy squads - When a unit group gets close to a player or start combat they switch to attacking everything in there path for a set radius or until there is nothing left - Rabid squads - Is in a permanent frenzied state as soon as the group is formed -- Tactical Retreats - these will take place when a unit group is in a chunk that has reached a death threshold -- Unit Group Merging - if multiple unit groups retreat at the same time there is a chance the groups will merge -- Unit Group Forming - any chunks with spawners in it that is covered by a pollution or player clouds will form groups based on the evolution factor +- Tactical Retreats - These will take place when a unit group is in a chunk that has reached a death threshold +- Unit Group Merging - If multiple unit groups retreat at the same time there is a chance the groups will merge +- Unit Group Forming - Any chunks with spawners in it that is covered by a pollution or player clouds will form groups based on the evolution factor - Probing Behavior Against Defenses - unit groups will attempt to avoid chunks that are soaked in death -- Player Hunting - unit groups will track the player based on there emitted pheromone cloud -- Rallying Death Cry - when a unit is killed on a chunk that is past the retreat threshold, the unit will attempt to summon reinforcements to help them -- Counterattacks - when the player is in combat near nests they will send reinforcements to unit groups -- Reinforcements - nests will send assistance to nearby nests under attack by the player -- No Homing Projectiles - all projectiles are fired at locations and no longer track the player -- Pathfinding - unit groups will use potential fields to perform only single step pathfinding allowing for efficient and dynamic pathing -- Peace mode - if something sets peace mode, Rampant will respect it +- Player Hunting - Unit groups will track the player based on there emitted pheromone cloud +- Rallying Death Cry - When a unit is killed on a chunk that is past the retreat threshold, the unit will attempt to summon reinforcements to help them +- Counterattacks - When the player is in combat near nests they will send reinforcements to unit groups +- Reinforcements - Nests will send assistance to nearby nests under attack by the player +- No Homing Projectiles - All projectiles are fired at locations and no longer track the player +- Pathfinding - Unit groups will use potential fields to perform only single step pathfinding allowing for efficient and dynamic pathing +- Peace mode - If something sets peace mode, Rampant will respect it # Planned Features @@ -49,6 +50,11 @@ Configure Options not in game menu: # Version History +0.15.7 - +- Feature: Difficulty Scaling - A mod options to control how quickly the ai performs actions +- Fixed: Spelling on mod option +- Improvement: Exposed nocturnal toggle and difficulty scaling to interop + 0.15.6 - - Feature: Nocturnal Mode - Causes Rampant attacks waves to only spawn at night. Best use with daylight Extender mod. diff --git a/control.lua b/control.lua index 566f607..3a02b4f 100644 --- a/control.lua +++ b/control.lua @@ -108,6 +108,7 @@ local function onModSettingsChange(event) natives.attackWaveMaxSize = settings.global["rampant-attackWaveMaxSize"].value natives.attackPlayerThreshold = settings.global["rampant-attackPlayerThreshold"].value natives.aiNocturnalMode = settings.global["rampant-permanentNocturnal"].value + natives.aiPointsScaler = settings.global["rampant-aiPointsScaler"].value end local function onConfigChanged() diff --git a/info.json b/info.json index 523064c..e216315 100644 --- a/info.json +++ b/info.json @@ -1,10 +1,10 @@ { "name" : "Rampant", "factorio_version" : "0.15", - "version" : "0.15.6", + "version" : "0.15.7", "title" : "Rampant AI", "author" : "Veden", "homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445", - "description" : "Improves the enemies tactics by using potential fields/pheromones allowing probing of defenses, retreats, reinforcements, counterattacking, breaching, rallying death cry, and player hunting. Also removes homing biter projectiles.", + "description" : "Improves the enemies tactics by using potential fields/pheromones allowing probing of defenses, retreats, reinforcements, counterattacking, breaching, rallying death cry, and player hunting. Also removes homing biter projectiles. Difficulty setting in mod options menu.", "dependencies" : ["base >= 0.13.17", "? bobenemies", "? Natural_Evolution_Enemies"] } diff --git a/libs/AIPlanning.lua b/libs/AIPlanning.lua index 6e1eeaa..7624a04 100644 --- a/libs/AIPlanning.lua +++ b/libs/AIPlanning.lua @@ -38,7 +38,7 @@ function aiPlanning.planning(natives, evolution_factor, tick, surface) maxPoints = maxPoints * 0.85 end if (natives.points < maxPoints) then - natives.points = natives.points + math.floor((AI_POINT_GENERATOR_AMOUNT * math.random()) + ((AI_POINT_GENERATOR_AMOUNT * 0.7) * (evolution_factor ^ 2.5))) + natives.points = natives.points + math.floor((AI_POINT_GENERATOR_AMOUNT * math.random()) + ((AI_POINT_GENERATOR_AMOUNT * 0.7) * (evolution_factor ^ 2.5)) * natives.aiPointsScaler) end if (natives.temperamentTick == tick) then diff --git a/libs/Interop.lua b/libs/Interop.lua index 6de4177..f8286c5 100644 --- a/libs/Interop.lua +++ b/libs/Interop.lua @@ -8,6 +8,22 @@ function interop.getAIPoints() return global.natives.points end +function interop.setNocturnalMode(flag) + global.natives.aiNocturnalMode = flag +end + +function interop.getNocturnalMode() + return global.natives.aiNocturnalMode +end + +function interop.setPointsPerCycleScaling(scale) + global.natives.aiPointsScaler = scale +end + +function interop.getPointsPerCycleScaling() + return global.natives.aiPointsScaler +end + function interop.changeState(aiState) global.natives.state = aiState end diff --git a/locale/en/locale.cfg b/locale/en/locale.cfg index 455419b..42253e6 100644 --- a/locale/en/locale.cfg +++ b/locale/en/locale.cfg @@ -35,7 +35,8 @@ rampant-safeBuildings-railChainSignals=Make rail chain signals safe from biters rampant-safeBuildings-railSignals=Make rail signals safe from biters rampant-safeBuildings-trainStops=Make train stops safe from biters rampant-attackPlayerThreshold=Player score contribution threshold -rampant-permanentNocturnal=Permanent Noctural Mode +rampant-permanentNocturnal=Permanent Nocturnal Mode +rampant-aiPointsScaler=Difficulty Scaling [mod-setting-description] rampant-useDumbProjectiles=Turns off homing projectiles for worms and spitters @@ -53,4 +54,5 @@ rampant-safeBuildings-railChainSignals=Make rail chain signals safe from biters rampant-safeBuildings-railSignals=Make rail signals safe from biters rampant-safeBuildings-trainStops=Make train stops safe from biters rampant-attackPlayerThreshold=The score that a chunk must reach for it to contribute to the attack threshold. Increasing reduces player pheromone cloud impact. -rampant-permanentNocturnal=Toggling this will cause Rampant attack waves to spawn at night and retreat in the morning. DOES NOT turn off vanilla attack groups yet. Works better with Day/Night extender mod. +rampant-permanentNocturnal=Toggling this will cause Rampant attack waves to spawn at night. DOES NOT turn off vanilla attack groups yet. Works better with Day/Night extender mod. +rampant-aiPointsScaler=This scales how many action points the ai gets per logic cycle to perform actions like making attack waves. Between 0.0 and 5.0. Setting to 0.5 would cause the ai to work at half speed. diff --git a/settings.lua b/settings.lua index 7bdd566..cf537c1 100644 --- a/settings.lua +++ b/settings.lua @@ -43,7 +43,7 @@ data:extend({ setting_type = "runtime-global", minimum_value = 0, default_value = 7, - order = "c[modifier]-b[threshold]", + order = "c[modifier]-c[threshold]", per_user = false }, @@ -150,5 +150,17 @@ data:extend({ default_value = false, order = "f[modifier]-a[ai]", per_user = false + }, + + { + type = "double-setting", + name = "rampant-aiPointsScaler", + description = "rampant-aiPointsScaler", + setting_type = "runtime-global", + default_value = 1.0, + minimum_value = 0.0, + maximum_value = 5.0, + order = "f[modifier]-b[ai]", + per_user = false } })