mirror of
https://github.com/veden/Rampant.git
synced 2025-01-26 03:20:07 +02:00
respect for peace mode and enforcement fix
This commit is contained in:
parent
9beda7b4e1
commit
78cce214c0
44
README.md
44
README.md
@ -17,29 +17,33 @@ MP should be working
|
||||
|
||||
# Features
|
||||
|
||||
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
|
||||
Rapid 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, player, player base pheromone 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
|
||||
Pathfinding - unit groups will use potential fields to perform only single step pathfinding allowing for efficient and dynamic pathing
|
||||
- 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
|
||||
- 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
|
||||
- Pathfinding - unit groups will use potential fields to perform only single step pathfinding allowing for efficient and dynamic pathing
|
||||
|
||||
# Planned Features
|
||||
|
||||
Tunneling Biters
|
||||
Fire Biters
|
||||
Suicide Biters
|
||||
infesting Biters
|
||||
adaptive aliens
|
||||
Base Expansion
|
||||
- Tunneling Biters
|
||||
- Fire Biters
|
||||
- Suicide Biters
|
||||
- infesting Biters
|
||||
- adaptive aliens
|
||||
- Base Expansion
|
||||
|
||||
# Version History
|
||||
|
||||
0.14.10 -
|
||||
- Improvement: Respect for peace mode. To be used with something like the True Peace Mod
|
||||
- Fix: Enforce rate limit for retreats
|
||||
|
||||
0.14.9 -
|
||||
- Fix: Added null check in rally cry for chunks that have yet to be generated by game engine (https://mods.factorio.com/mods/Veden/Rampant/discussion/7946)
|
||||
|
||||
@ -47,7 +51,7 @@ Base Expansion
|
||||
- Feature: Rallying death cry, when a native dies on a chunk past the death threshold it will attempt to summon reinforcements from nearby nests
|
||||
- Tweak: Increased unit group merge distance from 16 to 28 tiles
|
||||
- Tweak: Increased retreat grab radius from 15 tiles to 24 tiles
|
||||
- Tweak: Decreased vengence squad cost from 50 to 45
|
||||
- Tweak: Decreased vengeance squad cost from 50 to 45
|
||||
- Improvement: On group merge recalculate the kamikaze threshold, so groups that become large have a chance to kamikaze before attacking
|
||||
- Improvement: Disallow group merges when units are taking and receiving damage
|
||||
- Fix: Corrected unit group frenzy trigger based on engaging a target
|
||||
@ -57,7 +61,7 @@ Base Expansion
|
||||
|
||||
0.14.7 -
|
||||
- Feature: Counterattack waves trigger when the player is standing in a chunk with the death pheromone past the retreat threshold
|
||||
- Feature: Reinforcement waves trigger when the player is standind in a chunk that contains a nest
|
||||
- Feature: Reinforcement waves trigger when the player is standing in a chunk that contains a nest
|
||||
- Tweak: Increased max number of unit groups that can be active concurrently from 30 to 40
|
||||
- Improvement: Removed restriction on unit group formations around nests
|
||||
|
||||
@ -120,7 +124,7 @@ Base Expansion
|
||||
|
||||
0.13.2 = 0.14.2
|
||||
|
||||
0.13.1 - Backported 0.14 factorio version to 0.13 factorio version
|
||||
0.13.1 - Back ported 0.14 factorio version to 0.13 factorio version
|
||||
|
||||
0.0.8 -
|
||||
- Fixed retreat oscillations (https://forums.factorio.com/viewtopic.php?f=94&t=31445&start=10#p198750)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name" : "Rampant",
|
||||
"factorio_version" : "0.14",
|
||||
"version" : "0.14.9",
|
||||
"version" : "0.14.10",
|
||||
"title" : "Rampant AI",
|
||||
"author" : "Veden",
|
||||
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",
|
||||
|
@ -133,17 +133,19 @@ function aiBuilding.rallyUnits(chunk, regionMap, surface, natives, evolutionFact
|
||||
aiBuilding.formSquads(regionMap, surface, natives, rallyChunk, evolutionFactor, AI_VENGENCE_SQUAD_COST)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function aiBuilding.formSquads(regionMap, surface, natives, chunk, evolution_factor, cost)
|
||||
if (natives.points > cost) and (chunk[ENEMY_BASE_GENERATOR] ~= 0) and (#natives.squads < (AI_MAX_SQUAD_COUNT * evolution_factor)) then
|
||||
local valid = false
|
||||
if (cost == AI_VENGENCE_SQUAD_COST) then
|
||||
valid = true
|
||||
elseif (cost == AI_SQUAD_COST) then
|
||||
valid = attackWaveValidCandidate(chunk, surface, evolution_factor)
|
||||
end
|
||||
if not surface.peaceful_mode then
|
||||
if (cost == AI_VENGENCE_SQUAD_COST) then
|
||||
valid = true
|
||||
elseif (cost == AI_SQUAD_COST) then
|
||||
valid = attackWaveValidCandidate(chunk, surface, evolution_factor)
|
||||
end
|
||||
end
|
||||
if valid and (math.random() < mMax((0.25 * evolution_factor), 0.10)) then
|
||||
local squadPosition = {x=0, y=0}
|
||||
local squadPath, squadScore = scoreNeighbors(chunk,
|
||||
|
@ -113,15 +113,9 @@ constants.GROUP_MERGE_DISTANCE = 28
|
||||
-- player building pheromones
|
||||
|
||||
constants.BUILDING_PHEROMONES = {}
|
||||
-- constants.buildingPheromones["container"] = 1
|
||||
-- constants.buildingPheromones["storage-tank"] = 1
|
||||
constants.BUILDING_PHEROMONES["generator"] = 8
|
||||
constants.BUILDING_PHEROMONES["pump"] = 2
|
||||
constants.BUILDING_PHEROMONES["offshore-pump"] = 2
|
||||
-- constants.buildingPheromones["constant-combinator"] = 1
|
||||
-- constants.buildingPheromones["train-stop"] = 2
|
||||
-- constants.buildingPheromones["rail-signal"] = 1
|
||||
-- constants.BUILDING_PHEROMONES["electric-pole"] = 4
|
||||
constants.BUILDING_PHEROMONES["transport-belt"] = 1
|
||||
constants.BUILDING_PHEROMONES["accumulator"] = 10
|
||||
constants.BUILDING_PHEROMONES["solar-panel"] = 8
|
||||
|
@ -66,7 +66,7 @@ end
|
||||
In theory, this might be fine as smaller bases have less surface to attack and need to have
|
||||
pheromone dissipate at a faster rate.
|
||||
--]]
|
||||
function mapProcessor.processMap(regionMap, surface, natives, evolution_factor)
|
||||
function mapProcessor.processMap(regionMap, surface, natives, evolution_factor)
|
||||
local roll = regionMap.processRoll
|
||||
local index = regionMap.processPointer
|
||||
local scouts = false
|
||||
@ -76,9 +76,9 @@ function mapProcessor.processMap(regionMap, surface, natives, evolution_factor)
|
||||
roll = math.random()
|
||||
regionMap.processRoll = roll
|
||||
end
|
||||
|
||||
|
||||
if (0.05 <= roll) and (roll <= 0.10) then
|
||||
scouts = true
|
||||
scouts = true
|
||||
end
|
||||
|
||||
if (natives.state == AI_STATE_AGGRESSIVE) and (0.11 <= roll) and (roll <= 0.35) then
|
||||
@ -119,7 +119,7 @@ function mapProcessor.processPlayers(players, regionMap, surface, natives, evolu
|
||||
-- put down player pheromone for player hunters
|
||||
-- randomize player order to ensure a single player isn't singled out
|
||||
local playerOrdering = nonRepeatingRandom(players)
|
||||
|
||||
|
||||
local scouts = false
|
||||
local squads = false
|
||||
local vengenceThreshold = -(evolution_factor * RETREAT_MOVEMENT_PHEROMONE_LEVEL)
|
||||
@ -172,7 +172,7 @@ function mapProcessor.processPlayers(players, regionMap, surface, natives, evolu
|
||||
if vengence then
|
||||
formSquads(regionMap, surface, natives, chunk, evolution_factor, AI_VENGENCE_SQUAD_COST)
|
||||
end
|
||||
|
||||
|
||||
processPheromone(regionMap, chunk)
|
||||
end
|
||||
end
|
||||
@ -187,7 +187,7 @@ end
|
||||
--]]
|
||||
function mapProcessor.scanMap(regionMap, surface)
|
||||
local index = regionMap.scanPointer
|
||||
|
||||
|
||||
local processQueue = regionMap.processQueue
|
||||
local endIndex = mMin(index + SCAN_QUEUE_SIZE, #processQueue)
|
||||
for x=index,endIndex do
|
||||
|
155
make.rkt
155
make.rkt
@ -1,80 +1,83 @@
|
||||
(module BuildScript racket
|
||||
|
||||
(require file/zip)
|
||||
(require json)
|
||||
|
||||
;(define modFolder "C:/Users/veden/AppData/Roaming/Factorio/mods/")
|
||||
;(define zipModFolder "C:/Program Files/Factorio_0.14.1/mods/")
|
||||
(define modFolder "/home/veden/.factorio/mods/")
|
||||
(define zipModFolder "/data/games/factorio14.18/mods/")
|
||||
(define configuration (call-with-input-file "info.json"
|
||||
(lambda (port)
|
||||
(string->jsexpr (port->string port)))))
|
||||
(define packageName (string-append (string-replace (hash-ref configuration 'name) " " "_")
|
||||
"_"
|
||||
(hash-ref configuration 'version)))
|
||||
|
||||
(define (makeZip folder)
|
||||
(let ((packagePath (string->path (string-append folder
|
||||
packageName
|
||||
".zip"))))
|
||||
(when (file-exists? packagePath)
|
||||
(delete-file packagePath)))
|
||||
(zip (string-append folder
|
||||
packageName
|
||||
".zip")
|
||||
#:path-prefix packageName
|
||||
(string->path "info.json")
|
||||
(string->path "control.lua")
|
||||
(string->path "config.lua")
|
||||
(string->path "data.lua")
|
||||
(string->path "LICENSE.md")
|
||||
(string->path "tests.lua")
|
||||
; (string->path "setupUtils.lua")
|
||||
(string->path "README.md")
|
||||
; (string->path "setup.lua")
|
||||
(string->path "NOTICE")
|
||||
(string->path "libs")
|
||||
(string->path "locale")
|
||||
(string->path "graphics")
|
||||
(string->path "prototypes")))
|
||||
|
||||
|
||||
;(current-directory "..")
|
||||
(define (copyFile fileName modFolder)
|
||||
(copy-file (string->path fileName)
|
||||
(string->path (string-append modFolder
|
||||
packageName
|
||||
"/"
|
||||
fileName))))
|
||||
|
||||
(define (copyDirectory directoryName modFolder)
|
||||
(copy-directory/files (string->path directoryName)
|
||||
(string->path (string-append modFolder
|
||||
packageName
|
||||
"/"
|
||||
directoryName))))
|
||||
|
||||
(define (copyFiles modFolder)
|
||||
(let ((packagePath (string->path (string-append modFolder
|
||||
packageName))))
|
||||
(when (directory-exists? packagePath)
|
||||
(delete-directory/files packagePath))
|
||||
(sleep 0.1)
|
||||
(make-directory packagePath)
|
||||
(copyFile "control.lua" modFolder)
|
||||
(copyFile "config.lua" modFolder)
|
||||
(copyFile "info.json" modFolder)
|
||||
; (copyFile "setupUtils.lua" modFolder)
|
||||
(copyFile "data.lua" modFolder)
|
||||
(copyFile "tests.lua" modFolder)
|
||||
(copyDirectory "libs" modFolder)
|
||||
(copyDirectory "locale" modFolder)
|
||||
(copyDirectory "graphics" modFolder)
|
||||
(copyDirectory "prototypes" modFolder)))
|
||||
|
||||
;;(copyFiles modFolder)
|
||||
(provide run)
|
||||
|
||||
(require file/zip)
|
||||
(require json)
|
||||
|
||||
;(define modFolder "C:/Users/veden/AppData/Roaming/Factorio/mods/")
|
||||
;(define zipModFolder "C:/Program Files/Factorio_0.14.1/mods/")
|
||||
(define modFolder "/home/veden/.factorio/mods/")
|
||||
(define zipModFolder "/data/games/factorio14.18/mods/")
|
||||
(define configuration (call-with-input-file "info.json"
|
||||
(lambda (port)
|
||||
(string->jsexpr (port->string port)))))
|
||||
(define packageName (string-append (string-replace (hash-ref configuration 'name) " " "_")
|
||||
"_"
|
||||
(hash-ref configuration 'version)))
|
||||
|
||||
(define (makeZip folder)
|
||||
(let ((packagePath (string->path (string-append folder
|
||||
packageName
|
||||
".zip"))))
|
||||
(when (file-exists? packagePath)
|
||||
(delete-file packagePath)))
|
||||
(zip (string-append folder
|
||||
packageName
|
||||
".zip")
|
||||
#:path-prefix packageName
|
||||
(string->path "info.json")
|
||||
(string->path "control.lua")
|
||||
(string->path "config.lua")
|
||||
(string->path "data.lua")
|
||||
(string->path "LICENSE.md")
|
||||
(string->path "tests.lua")
|
||||
; (string->path "setupUtils.lua")
|
||||
(string->path "README.md")
|
||||
; (string->path "setup.lua")
|
||||
(string->path "NOTICE")
|
||||
(string->path "libs")
|
||||
(string->path "locale")
|
||||
(string->path "graphics")
|
||||
(string->path "prototypes")))
|
||||
|
||||
|
||||
;(current-directory "..")
|
||||
(define (copyFile fileName modFolder)
|
||||
(copy-file (string->path fileName)
|
||||
(string->path (string-append modFolder
|
||||
packageName
|
||||
"/"
|
||||
fileName))))
|
||||
|
||||
(define (copyDirectory directoryName modFolder)
|
||||
(copy-directory/files (string->path directoryName)
|
||||
(string->path (string-append modFolder
|
||||
packageName
|
||||
"/"
|
||||
directoryName))))
|
||||
|
||||
(define (copyFiles modFolder)
|
||||
(let ((packagePath (string->path (string-append modFolder
|
||||
packageName))))
|
||||
(when (directory-exists? packagePath)
|
||||
(delete-directory/files packagePath))
|
||||
(sleep 0.1)
|
||||
(make-directory packagePath)
|
||||
(copyFile "control.lua" modFolder)
|
||||
(copyFile "config.lua" modFolder)
|
||||
(copyFile "info.json" modFolder)
|
||||
; (copyFile "setupUtils.lua" modFolder)
|
||||
(copyFile "data.lua" modFolder)
|
||||
(copyFile "tests.lua" modFolder)
|
||||
(copyDirectory "libs" modFolder)
|
||||
(copyDirectory "locale" modFolder)
|
||||
(copyDirectory "graphics" modFolder)
|
||||
(copyDirectory "prototypes" modFolder)))
|
||||
|
||||
(define (run)
|
||||
(copyFiles modFolder)
|
||||
;; (copyFiles zipModFolder)
|
||||
(makeZip modFolder)
|
||||
;;(makeZip modFolder)
|
||||
;;(makeZip zipModFolder)
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user