mirror of
https://github.com/veden/Rampant.git
synced 2025-03-17 20:58:35 +02:00
AI planning now processes upto 10 surfaces per cycle
This commit is contained in:
parent
388185dc1c
commit
c1b761d8dd
@ -449,6 +449,7 @@ function upgrade.attempt(universe)
|
||||
universe.pendingUpgradeIterator = nil
|
||||
universe.victoryScentIterator = nil
|
||||
universe.squadIterator = nil
|
||||
universe.processMapAIIterator = nil
|
||||
universe.vengenceQueue = {}
|
||||
universe.activeMap = nil
|
||||
universe.mapIterator = nil
|
||||
|
@ -25,6 +25,7 @@ Date: 23. 11. 2021
|
||||
- Added support for AbandonedRuins mod
|
||||
- Victory scent is now processed regardless of current active surface
|
||||
- Pheromone map processing only does upto 5% of generated chunks on a surface before switching to the next surface
|
||||
- AI Planning will now happen on upto 10 surface per cycle
|
||||
Tweaks:
|
||||
- Increase chance to upgrade an enemy structure from 5% to 30%
|
||||
- New enemy regional bases that have two factions now do 75% on one faction and 25% on the faction for building and upgrading enemy structures
|
||||
|
12
control.lua
12
control.lua
@ -44,6 +44,8 @@ local ENERGY_THIEF_LOOKUP = constants.ENERGY_THIEF_LOOKUP
|
||||
local distortPosition = mathUtils.distortPosition
|
||||
local prepMap = upgrade.prepMap
|
||||
|
||||
local processMapAIs = aiPlanning.processMapAIs
|
||||
|
||||
local registerEnemyBaseStructure = chunkUtils.registerEnemyBaseStructure
|
||||
|
||||
local queueGeneratedChunk = mapUtils.queueGeneratedChunk
|
||||
@ -60,8 +62,6 @@ local cleanUpMapTables = mapProcessor.cleanUpMapTables
|
||||
|
||||
local positionToChunkXY = mapUtils.positionToChunkXY
|
||||
|
||||
local temperamentPlanner = aiPlanning.temperamentPlanner
|
||||
|
||||
local processVengence = mapProcessor.processVengence
|
||||
local processAttackWaves = mapProcessor.processAttackWaves
|
||||
|
||||
@ -84,8 +84,6 @@ local scanResourceMap = mapProcessor.scanResourceMap
|
||||
|
||||
local processNests = mapProcessor.processNests
|
||||
|
||||
local planning = aiPlanning.planning
|
||||
|
||||
local rallyUnits = aiAttackWave.rallyUnits
|
||||
|
||||
local recycleBases = baseUtils.recycleBases
|
||||
@ -953,6 +951,9 @@ local function onSurfaceDeleted(event)
|
||||
if (universe.mapIterator == surfaceIndex) then
|
||||
universe.mapIterator, universe.activeMap = next(universe.maps, universe.mapIterator)
|
||||
end
|
||||
if (universe.processMapAIIterator == surfaceIndex) then
|
||||
universe.processMapAIIterator = nil
|
||||
end
|
||||
universe.maps[surfaceIndex] = nil
|
||||
end
|
||||
|
||||
@ -1004,7 +1005,7 @@ script.on_event(defines.events.on_tick,
|
||||
|
||||
if (pick == 0) then
|
||||
processPendingChunks(universe, tick)
|
||||
planning(map, gameRef.forces.enemy.evolution_factor, tick)
|
||||
processMapAIs(universe, gameRef.forces.enemy.evolution_factor, tick)
|
||||
if universe.NEW_ENEMIES then
|
||||
recycleBases(map)
|
||||
end
|
||||
@ -1026,7 +1027,6 @@ script.on_event(defines.events.on_tick,
|
||||
elseif (pick == 6) then
|
||||
scanPlayerMap(map, tick)
|
||||
processNests(map, tick)
|
||||
temperamentPlanner(map)
|
||||
elseif (pick == 7) then
|
||||
processPendingChunks(universe, tick)
|
||||
processScanChunks(map)
|
||||
|
@ -64,7 +64,7 @@ local function getTimeStringFromTick(tick)
|
||||
end
|
||||
|
||||
|
||||
function aiPlanning.planning(map, evolution_factor, tick)
|
||||
local function planning(map, evolution_factor, tick)
|
||||
local universe = map.universe
|
||||
map.evolutionLevel = evolution_factor
|
||||
universe.evolutionLevel = evolution_factor
|
||||
@ -305,7 +305,7 @@ function aiPlanning.planning(map, evolution_factor, tick)
|
||||
end
|
||||
end
|
||||
|
||||
function aiPlanning.temperamentPlanner(map)
|
||||
local function temperamentPlanner(map)
|
||||
local destroyPlayerBuildings = map.destroyPlayerBuildings
|
||||
local lostEnemyUnits = map.lostEnemyUnits
|
||||
local lostEnemyBuilding = map.lostEnemyBuilding
|
||||
@ -418,5 +418,29 @@ function aiPlanning.temperamentPlanner(map)
|
||||
end
|
||||
end
|
||||
|
||||
function aiPlanning.processMapAIs(universe, evo, tick)
|
||||
for _ = 1, 10 do
|
||||
local mapId = universe.processMapAIIterator
|
||||
local map
|
||||
if not mapId then
|
||||
mapId, map = next(universe.maps, nil)
|
||||
else
|
||||
map = universe.maps[mapId]
|
||||
end
|
||||
if not mapId then
|
||||
universe.processMapAIIterator = nil
|
||||
return
|
||||
else
|
||||
universe.processMapAIIterator = next(universe.maps, mapId)
|
||||
planning(map, evo, tick)
|
||||
temperamentPlanner(map)
|
||||
if not universe.processMapAIIterator then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
aiPlanningG = aiPlanning
|
||||
return aiPlanning
|
||||
|
Loading…
x
Reference in New Issue
Block a user