1
0
mirror of https://github.com/veden/Rampant.git synced 2025-02-05 13:14:51 +02:00

see changelog

This commit is contained in:
Aaron Veden 2020-05-24 20:25:21 -07:00
parent 9aa81d20d4
commit 878c2204b3
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
9 changed files with 58 additions and 44 deletions

View File

@ -2,13 +2,17 @@
Version: 0.18.13
Date: 16. 4 2020
Improvements:
- Added neutral objects to scanning to decrease chunk rating based on number of things present
- Swapped to ai command completed for unit movements
- Added effect when spawners build to destroy build site
- Integrated vanilla AI into Rampant for pollution management
- Map processing sweep now does and forward and reverse pass
- Better handling of death pheromone and squad coordination
- Added support for script_raised_set_tiles
- Added setting option for max squads active
- Added setting option for max settlers active
Tweaks:
- Increased Victory scent to x10 pheromone value
- Reduced active raid nest contribution to AI state to 0.002
- Changed ai credits per rocket launched to 5000
- Refactored calculateKamikazeThreshold based on member count and current evolution

View File

@ -417,9 +417,13 @@ local function rebuildMap()
collision_mask = "player-layer",
type={"artillery-turret",
"reactor",
"rocket-silo"}
}
"rocket-silo"}}
map.filteredEntitiesChunkNeutral = { area=map.area,
collision_mask = "player-layer",
type={"tree",
"simple-entity"}}
local sharedArea = {{0,0},{0,0}}
map.filteredEntitiesCliffQuery = { area=sharedArea, type="cliff", limit = 1 }
map.filteredTilesPathQuery = { area=sharedArea, collision_mask="water-tile", limit = 1 }
@ -1026,7 +1030,6 @@ local function onUnitGroupCreated(event)
local group = event.group
local surface = group.surface
if (surface.name == natives.activeSurface) and (group.force.name == "enemy") then
print("fuck", event.tick, natives.squadCount, natives.squadCount > natives.AI_MAX_SQUAD_COUNT, natives.builderCount, natives.builderCount > natives.AI_MAX_BUILDER_COUNT)
if not group.is_script_driven then
if not natives.aiNocturnalMode then
local settler = mRandom() < 0.25 and

View File

@ -84,6 +84,8 @@ local setPathRating = chunkPropertyUtils.setPathRating
local getChunkByXY = mapUtils.getChunkByXY
local mMin = math.min
local mMax = math.max
local mFloor = math.floor
local mRandom = math.random
@ -197,11 +199,12 @@ local function scorePlayerBuildings(surface, map)
end
function chunkUtils.initialScan(chunk, surface, map, tick, rebuilding)
local passScore = 1 - (surface.count_tiles_filtered(map.filteredTilesQuery) * 0.0009765625)
local waterTiles = (1 - (surface.count_tiles_filtered(map.filteredTilesQuery) * 0.0009765625)) * 0.80
local natives = map.natives
local enemyBuildings = surface.find_entities_filtered(map.filteredEntitiesEnemyStructureQuery)
if (passScore >= CHUNK_PASS_THRESHOLD) or (#enemyBuildings > 0) then
if (waterTiles >= CHUNK_PASS_THRESHOLD) or (#enemyBuildings > 0) then
local neutralObjects = mMax(0, mMin(1 - (surface.count_entities_filtered(map.filteredEntitiesChunkNeutral) * 0.005), 1) * 0.20)
local pass = scanPaths(chunk, surface, map)
local playerObjects = scorePlayerBuildings(surface, map)
@ -276,7 +279,7 @@ function chunkUtils.initialScan(chunk, surface, map, tick, rebuilding)
setResourceGenerator(map, chunk, resources)
setPassable(map, chunk, pass)
setPathRating(map, chunk, passScore)
setPathRating(map, chunk, waterTiles + neutralObjects)
return chunk
end
@ -286,9 +289,10 @@ function chunkUtils.initialScan(chunk, surface, map, tick, rebuilding)
end
function chunkUtils.chunkPassScan(chunk, surface, map)
local passScore = 1 - (surface.count_tiles_filtered(map.filteredTilesQuery) * 0.0009765625)
local waterTiles = (1 - (surface.count_tiles_filtered(map.filteredTilesQuery) * 0.0009765625)) * 0.80
if (passScore >= CHUNK_PASS_THRESHOLD) then
if (waterTiles >= CHUNK_PASS_THRESHOLD) then
local neutralObjects = mMax(0, mMin(1 - (surface.count_entities_filtered(map.filteredEntitiesChunkNeutral) * 0.005), 1) * 0.20)
local pass = scanPaths(chunk, surface, map)
local playerObjects = getPlayerBaseGenerator(map, chunk)
@ -300,7 +304,7 @@ function chunkUtils.chunkPassScan(chunk, surface, map)
end
setPassable(map, chunk, pass)
setPathRating(map, chunk, passScore)
setPathRating(map, chunk, waterTiles + neutralObjects)
return chunk
end
@ -316,6 +320,9 @@ end
function chunkUtils.mapScanResourceChunk(chunk, surface, map)
local resources = surface.count_entities_filtered(map.countResourcesQuery) * RESOURCE_NORMALIZER
setResourceGenerator(map, chunk, resources)
local waterTiles = (1 - (surface.count_tiles_filtered(map.filteredTilesQuery) * 0.0009765625)) * 0.80
local neutralObjects = mMax(0, mMin(1 - (surface.count_entities_filtered(map.filteredEntitiesChunkNeutral) * 0.005), 1) * 0.20)
setPathRating(map, chunk, waterTiles + neutralObjects)
end
function chunkUtils.mapScanEnemyChunk(chunk, surface, map)

View File

@ -58,7 +58,7 @@ constants.VICTORY_SCENT_BOUND = 128
constants.TICKS_A_SECOND = 60
constants.TICKS_A_MINUTE = constants.TICKS_A_SECOND * 60
constants.CHUNK_PASS_THRESHOLD = 0.25
constants.CHUNK_PASS_THRESHOLD = 0.2
-- constants.INTERVAL_PLAYER_PROCESS = 63
-- constants.INTERVAL_MAP_PROCESS = 5
@ -281,36 +281,36 @@ constants.BUILDING_PHEROMONES["reactor"] = constants.GENERATOR_PHEROMONE_LEVEL_6
constants.BUILDING_PHEROMONES["rocket-silo"] = constants.GENERATOR_PHEROMONE_LEVEL_6
constants.VICTORY_SCENT = {}
constants.VICTORY_SCENT["wall"] = constants.BUILDING_PHEROMONES["wall"] * 3
constants.VICTORY_SCENT["transport-belt"] = constants.BUILDING_PHEROMONES["transport-belt"] * 3
constants.VICTORY_SCENT["wall"] = constants.BUILDING_PHEROMONES["wall"] * 10
constants.VICTORY_SCENT["transport-belt"] = constants.BUILDING_PHEROMONES["transport-belt"] * 10
constants.VICTORY_SCENT["splitter"] = constants.BUILDING_PHEROMONES["splitter"] * 3
constants.VICTORY_SCENT["pump"] = constants.BUILDING_PHEROMONES["pump"] * 3
constants.VICTORY_SCENT["offshore-pump"] = constants.BUILDING_PHEROMONES["offshore-pump"] * 3
constants.VICTORY_SCENT["splitter"] = constants.BUILDING_PHEROMONES["splitter"] * 10
constants.VICTORY_SCENT["pump"] = constants.BUILDING_PHEROMONES["pump"] * 10
constants.VICTORY_SCENT["offshore-pump"] = constants.BUILDING_PHEROMONES["offshore-pump"] * 10
constants.VICTORY_SCENT["lamp"] = constants.BUILDING_PHEROMONES["lamp"] * 3
constants.VICTORY_SCENT["solar-panel"] = constants.BUILDING_PHEROMONES["solar-panel"] * 3
constants.VICTORY_SCENT["programmable-speaker"] = constants.BUILDING_PHEROMONES["programmable-speaker"] * 3
constants.VICTORY_SCENT["accumulator"] = constants.BUILDING_PHEROMONES["accumulator"] * 3
constants.VICTORY_SCENT["assembling-machine"] = constants.BUILDING_PHEROMONES["assembling-machine"] * 3
constants.VICTORY_SCENT["turret"] = constants.BUILDING_PHEROMONES["turret"] * 3
constants.VICTORY_SCENT["ammo-turret"] = constants.BUILDING_PHEROMONES["ammo-turret"] * 3
constants.VICTORY_SCENT["lamp"] = constants.BUILDING_PHEROMONES["lamp"] * 10
constants.VICTORY_SCENT["solar-panel"] = constants.BUILDING_PHEROMONES["solar-panel"] * 10
constants.VICTORY_SCENT["programmable-speaker"] = constants.BUILDING_PHEROMONES["programmable-speaker"] * 10
constants.VICTORY_SCENT["accumulator"] = constants.BUILDING_PHEROMONES["accumulator"] * 10
constants.VICTORY_SCENT["assembling-machine"] = constants.BUILDING_PHEROMONES["assembling-machine"] * 10
constants.VICTORY_SCENT["turret"] = constants.BUILDING_PHEROMONES["turret"] * 10
constants.VICTORY_SCENT["ammo-turret"] = constants.BUILDING_PHEROMONES["ammo-turret"] * 10
constants.VICTORY_SCENT["furnace"] = constants.BUILDING_PHEROMONES["furnace"] * 3
constants.VICTORY_SCENT["lab"] = constants.BUILDING_PHEROMONES["lab"] * 3
constants.VICTORY_SCENT["roboport"] = constants.BUILDING_PHEROMONES["roboport"] * 3
constants.VICTORY_SCENT["beacon"] = constants.BUILDING_PHEROMONES["beacon"] * 3
constants.VICTORY_SCENT["radar"] = constants.BUILDING_PHEROMONES["radar"] * 3
constants.VICTORY_SCENT["electric-turret"] = constants.BUILDING_PHEROMONES["electric-turret"] * 3
constants.VICTORY_SCENT["furnace"] = constants.BUILDING_PHEROMONES["furnace"] * 10
constants.VICTORY_SCENT["lab"] = constants.BUILDING_PHEROMONES["lab"] * 10
constants.VICTORY_SCENT["roboport"] = constants.BUILDING_PHEROMONES["roboport"] * 10
constants.VICTORY_SCENT["beacon"] = constants.BUILDING_PHEROMONES["beacon"] * 10
constants.VICTORY_SCENT["radar"] = constants.BUILDING_PHEROMONES["radar"] * 10
constants.VICTORY_SCENT["electric-turret"] = constants.BUILDING_PHEROMONES["electric-turret"] * 10
constants.VICTORY_SCENT["boiler"] = constants.BUILDING_PHEROMONES["boiler"] * 3
constants.VICTORY_SCENT["generator"] = constants.BUILDING_PHEROMONES["generator"] * 3
constants.VICTORY_SCENT["fluid-turret"] = constants.BUILDING_PHEROMONES["fluid-turret"] * 3
constants.VICTORY_SCENT["mining-drill"] = constants.BUILDING_PHEROMONES["mining-drill"] * 3
constants.VICTORY_SCENT["boiler"] = constants.BUILDING_PHEROMONES["boiler"] * 10
constants.VICTORY_SCENT["generator"] = constants.BUILDING_PHEROMONES["generator"] * 10
constants.VICTORY_SCENT["fluid-turret"] = constants.BUILDING_PHEROMONES["fluid-turret"] * 10
constants.VICTORY_SCENT["mining-drill"] = constants.BUILDING_PHEROMONES["mining-drill"] * 10
constants.VICTORY_SCENT["artillery-turret"] = constants.BUILDING_PHEROMONES["artillery-turret"] * 3
constants.VICTORY_SCENT["reactor"] = constants.BUILDING_PHEROMONES["reactor"] * 3
constants.VICTORY_SCENT["rocket-silo"] = constants.BUILDING_PHEROMONES["rocket-silo"] * 3
constants.VICTORY_SCENT["artillery-turret"] = constants.BUILDING_PHEROMONES["artillery-turret"] * 10
constants.VICTORY_SCENT["reactor"] = constants.BUILDING_PHEROMONES["reactor"] * 10
constants.VICTORY_SCENT["rocket-silo"] = constants.BUILDING_PHEROMONES["rocket-silo"] * 10
-- map settings tweaks

View File

@ -81,13 +81,13 @@ function pheromoneUtils.disperseVictoryScent(map)
local chunkX = chunk.x
local chunkY = chunk.y
local i = 1
for x=chunkX - VICTORY_SCENT_BOUND, chunkX + VICTORY_SCENT_BOUND do
for y = chunkY - VICTORY_SCENT_BOUND, chunkY + VICTORY_SCENT_BOUND do
for x=chunkX - VICTORY_SCENT_BOUND, chunkX + VICTORY_SCENT_BOUND,32 do
for y = chunkY - VICTORY_SCENT_BOUND, chunkY + VICTORY_SCENT_BOUND,32 do
local c = getChunkByXY(map, x, y)
if (c ~= -1) then
addDeathGenerator(map, c, -pheromone * VICTORY_SCENT_MULTIPLER[i])
addDeathGenerator(map, c, -pheromone * VICTORY_SCENT_MULTIPLER[i] * getPathRating(map, c))
end
i = i + 1
i = i + 1
end
end

View File

@ -100,7 +100,6 @@ function aiDefense.retreatUnits(chunk, cause, map, surface, tick, radius)
created = true
newSquad = createSquad(position, surface)
else
print("cancelling retreat")
return
end
end

View File

@ -18872,8 +18872,8 @@ rampant-enableFullMapScan=This setting causes the game map to slowly be scanned
rampant-suppress-surface-change-warnings=Turn off the warnings you get when you change surfaces, warnings should only appear the first time you visit a new surface.
rampant-maxNumberOfBuilders=If you are not using many other script mods, I recommend putting this to 60.
rampant-maxNumberOfSquads=If you are not using many other script mods, I recommend putting this to 70.
rampant-maxNumberOfBuilders=More builders requires more UPS.
rampant-maxNumberOfSquads=More squads requires more UPS.
[description]
rampant-set-surface=You are setting the Rampant AI active surface to\n__1__

View File

@ -65,7 +65,7 @@ data:extend({
setting_type = "runtime-global",
minimum_value = 1,
maximum_value = 120,
default_value = 50,
default_value = 35,
order = "b[modifier]-f[wave]",
per_user = false
},

View File

@ -147,7 +147,8 @@
baseCreated
hives
traps
utility) chunkMinMaxes))
utility
vg) chunkMinMaxes))
(set! activeChunkSet chunks)
(set! activeChunkMinMaxSet chunkMinMaxes)