1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-26 20:54:12 +02:00

see changelog

This commit is contained in:
Aaron Veden 2019-02-02 22:01:28 -08:00
parent dbd2d92e55
commit 97d7595e42
13 changed files with 760 additions and 426 deletions

View File

@ -30,13 +30,13 @@ function upgrade.attempt(natives)
squad.frenzyPosition = {x=0,y=0}
squad.rabid = false
end
global.version = constants.VERSION_10
end
if (global.version < constants.VERSION_11) then
natives.state = constants.AI_STATE_AGGRESSIVE
natives.temperament = 0
global.version = constants.VERSION_11
end
if (global.version < constants.VERSION_12) then
@ -44,10 +44,10 @@ function upgrade.attempt(natives)
squad.status = constants.SQUAD_GUARDING
squad.kamikaze = false
end
-- reset ai build points due to error in earning points
natives.points = 0
global.version = constants.VERSION_12
end
if (global.version < constants.VERSION_16) then
@ -55,12 +55,12 @@ function upgrade.attempt(natives)
natives.lastShakeMessage = 0
--remove version 14 retreat limit, it has been made redundant
natives.retreats = nil
game.surfaces[natives.activeSurface].print("Rampant - Version 0.14.13")
global.version = constants.VERSION_16
end
if (global.version < constants.VERSION_18) then
natives.safeEntities = {}
natives.safeEntityName = {}
@ -68,10 +68,10 @@ function upgrade.attempt(natives)
global.version = constants.VERSION_18
end
if (global.version < constants.VERSION_20) then
natives.aiPointsScaler = settings.global["rampant-aiPointsScaler"].value
natives.aiNocturnalMode = settings.global["rampant-permanentNocturnal"].value
game.surfaces[natives.activeSurface].print("Rampant - Version 0.15.8")
global.version = constants.VERSION_20
end
@ -115,7 +115,7 @@ function upgrade.attempt(natives)
game.map_settings.unit_group.member_disown_distance = constants.UNIT_GROUP_DISOWN_DISTANCE
game.map_settings.unit_group.tick_tolerance_when_member_arrives = constants.UNIT_GROUP_TICK_TOLERANCE
-- used for breaking up how many squads are processing per logic cycle
natives.regroupIndex = 1
@ -127,26 +127,26 @@ function upgrade.attempt(natives)
if (global.version < constants.VERSION_25) then
game.map_settings.path_finder.min_steps_to_check_path_find_termination = constants.PATH_FINDER_MIN_STEPS_TO_CHECK_PATH
game.surfaces[natives.activeSurface].print("Rampant - Version 0.15.15")
global.version = constants.VERSION_25
end
if (global.version < constants.VERSION_26) then
game.map_settings.max_failed_behavior_count = constants.MAX_FAILED_BEHAVIORS
game.surfaces[natives.activeSurface].print("Rampant - Version 0.15.16")
global.version = constants.VERSION_26
end
if (global.version < constants.VERSION_27) then
game.surfaces[natives.activeSurface].print("Rampant - Version 0.15.17")
global.version = constants.VERSION_27
end
if (global.version < constants.VERSION_33) then
global.world = nil
game.surfaces[natives.activeSurface].print("Rampant - Version 0.15.23")
global.version = constants.VERSION_33
end
@ -157,7 +157,7 @@ function upgrade.attempt(natives)
end
global.regionMap = nil
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.3")
global.version = constants.VERSION_38
end
@ -169,14 +169,14 @@ function upgrade.attempt(natives)
natives.bases = {}
natives.baseIndex = 1
natives.baseIncrement = 0
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.6")
global.version = constants.VERSION_41
end
if (global.version < constants.VERSION_44) then
natives.kamikazeThreshold = 0
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.9")
global.version = constants.VERSION_44
end
@ -185,14 +185,14 @@ function upgrade.attempt(natives)
natives.scouts = nil
natives.tunnels = nil
natives.baseLookup = nil
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.16")
global.version = constants.VERSION_51
end
if (global.version < constants.VERSION_57) then
natives.attackWaveLowerBound = 1
for _,squad in pairs(natives.squads) do
squad.maxDistance = 0
squad.originPosition = {
@ -213,16 +213,16 @@ function upgrade.attempt(natives)
natives.settlerCooldown = 0
natives.settlerWaveDeviation = 0
natives.settlerWaveSize = 0
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.22")
global.version = constants.VERSION_57
end
if (global.version < constants.VERSION_69) then
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.34")
global.version = constants.VERSION_69
if (global.version < constants.VERSION_70) then
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.35")
global.version = constants.VERSION_70
end
return starting ~= global.version, natives
end

View File

@ -1,3 +1,19 @@
---------------------------------------------------------------------------------------------------
Version: 0.16.35
Date: 2. 1. 2019
Improvements:
- Added options to toggle new enemy factions
- Randomized base alignment array with map seed so faction distribution changes from map to map
- Added a setting to disable seige ai state, which may have been causing extra non pollution biter movements
Tweaks:
- Added upgrade path for neutral faction to laser resist faction
- Removed upgrade path from electric biters to laser resist faction
- Increased nest upgrade chance from 0.05% to 1.5%
Bugfixes:
- Fix for base upgrade framework to leveling nests correctly due to rounding errors in floating percision for lookup
- Fix for migration toggle setting not preventing the ai migration state
- Fix for entity upgrades allowing for a evolution decrease instead of start from current evolution requirement
---------------------------------------------------------------------------------------------------
Version: 0.16.34
Date: 10. 19. 2018
@ -10,9 +26,9 @@ Date: 10. 19. 2018
- Reduced Retreat pheromone max level from 20000 to 17000
- Reduced Retreat pheromone min level from 1500 to 1000
- Increased death generator from 75 to 125
- Increased movement persistance from 0.875 to 0.975
- Increased player persistance from 0.98 to 0.97
- Increased resource persistance from 0.99 to 0.97
- Increased movement persistence from 0.875 to 0.975
- Increased player persistence from 0.98 to 0.97
- Increased resource persistence from 0.99 to 0.97
Bugfixes:
- Fix for unit groups not being able to move off of impassable terrain
- Fix for incorrect variable name in interop
@ -23,7 +39,7 @@ Date: 9. 25. 2018
Improvements:
- Reworked how death pheromone sticks to terrain and how long it is active for
Optimizations:
- Reduced in memory map footprint increasing save speed
- Reduced in memory map footprint increasing save speed
Bugfixes:
- Fix for unit groups getting stuck in random locations
- Fix for unit retreats causing excessive retreats due to inverted comparison
@ -39,7 +55,7 @@ Date: 8. 1. 2018
- Lowered base alignment selection threshold from 0.65 to 0.35, causing more variation in the later stages of the game for factions
- Lowered upgrade entity selection threshold from 0.65 to 0.35, causing more variation in the later stages of the game for spawners and worms
Bugfixes:
- Invalid surface index for creative mode blueprinted tiles
- Invalid surface index for creative mode blueprinted tiles
- Surface tile change event wasn't correctly accounting active surface
- Normalized evolution requirements so when starting at a higher enemy level they are placed at the correct starting distances
- Fixed NEE compatibility
@ -72,7 +88,7 @@ Date: 6. 7. 2018
- Increased the lower attribute bound from 0.7 to 0.85
- Increased the base distance to evolution index ratio from (1 / 5480) to (1 / 7200)
- Increased the chance that initial base alignment picks a lower tier alignment by 0.15
- Normalized all enemy faction attributes through the defaults, should be minor unit corrections
- Normalized all enemy faction attributes through the defaults, should be minor unit corrections
Framework:
- Refactored new enemy modules
- Created default attributes for all unit, unit spawner, worms

View File

@ -131,7 +131,7 @@ local function onIonCannonFired(event)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
rallyUnits(chunk, map, surface, natives, event.tick)
end
end
end
end
local function hookEvents()
@ -140,7 +140,7 @@ local function hookEvents()
onIonCannonFired)
-- script.on_event(remote.call("orbital_ion_cannon", "on_ion_cannon_targeted"),
-- onIonCannonTargeted)
end
end
end
local function onLoad()
@ -153,7 +153,7 @@ local function onLoad()
-- print(serpent.dump(natives))
-- print(serpent.dump(natives.squads))
-- print(serpent.dump(natives.bases))
hookEvents()
end
@ -172,7 +172,7 @@ local function rebuildMap()
-- chunks are by key, so should overwrite old
-- game.forces.enemy.kill_all_units()
global.map = {}
map = global.map
map.processQueue = {}
@ -198,7 +198,7 @@ local function rebuildMap()
map.chunkToDeathGenerator = {}
map.queueSpawners = {}
-- preallocating memory to be used in code, making it fast by reducing garbage generated.
map.neighbors = { SENTINEL_IMPASSABLE_CHUNK,
SENTINEL_IMPASSABLE_CHUNK,
@ -221,7 +221,7 @@ local function rebuildMap()
for x=1,PROCESS_QUEUE_SIZE+1 do
map.scentStaging[x] = {0,0,0,0}
end
map.position2Top = {0, 0}
map.position2Bottom = {0, 0}
--this is shared between two different queries
@ -237,7 +237,7 @@ local function rebuildMap()
map.filteredEntitiesPlayerQuery = { area=map.area, force={"enemy", "neutral"}, invert = true }
map.canPlaceQuery = { name="", position={0,0} }
map.filteredTilesQuery = { name=WATER_TILE_NAMES, area=map.area }
map.attackAreaCommand = {
type = DEFINES_COMMAND_ATTACK_AREA,
destination = map.position,
@ -251,29 +251,29 @@ local function rebuildMap()
distraction = DEFINES_DISTRACTION_BY_ENEMY,
ignore_planner = true
}
map.retreatCommand = { type = DEFINES_COMMAND_GROUP,
group = nil,
distraction = DEFINES_DISTRACTION_NONE }
-- switched over to tick event
map.logicTick = roundToNearest(game.tick + INTERVAL_LOGIC, INTERVAL_LOGIC)
map.scanTick = roundToNearest(game.tick + INTERVAL_SCAN, INTERVAL_SCAN)
map.processTick = roundToNearest(game.tick + INTERVAL_PROCESS, INTERVAL_PROCESS)
map.chunkTick = roundToNearest(game.tick + INTERVAL_CHUNK, INTERVAL_CHUNK)
map.squadTick = roundToNearest(game.tick + INTERVAL_SQUAD, INTERVAL_SQUAD)
end
end
local function onModSettingsChange(event)
if event and ((string.sub(event.setting, 1, 7) ~= "rampant") or (string.sub(event.setting, 1, 18) == "rampant-arsenal")) then
return false
end
upgrade.compareTable(natives, "safeBuildings", settings.global["rampant-safeBuildings"].value)
upgrade.compareTable(natives, "safeBuildings", settings.global["rampant-safeBuildings"].value)
upgrade.compareTable(natives.safeEntities, "curved-rail", settings.global["rampant-safeBuildings-curvedRail"].value)
upgrade.compareTable(natives.safeEntities, "straight-rail", settings.global["rampant-safeBuildings-straightRail"].value)
upgrade.compareTable(natives.safeEntities, "rail-signal", settings.global["rampant-safeBuildings-railSignals"].value)
@ -290,13 +290,14 @@ local function onModSettingsChange(event)
natives.safeEntityName["big-electric-pole-3"] = newValue
natives.safeEntityName["big-electric-pole-4"] = newValue
end
upgrade.compareTable(natives, "attackUsePlayer", settings.global["rampant-attackWaveGenerationUsePlayerProximity"].value)
upgrade.compareTable(natives, "attackUsePollution", settings.global["rampant-attackWaveGenerationUsePollution"].value)
upgrade.compareTable(natives, "deadZoneFrequency", settings.global["rampant-deadZoneFrequency"].value)
upgrade.compareTable(natives, "raidAIToggle", settings.global["rampant-raidAIToggle"].value)
upgrade.compareTable(natives, "seigeAIToggle", settings.global["rampant-seigeAIToggle"].value)
upgrade.compareTable(natives, "attackThresholdMin", settings.global["rampant-attackWaveGenerationThresholdMin"].value)
upgrade.compareTable(natives, "attackThresholdMax", settings.global["rampant-attackWaveGenerationThresholdMax"].value)
upgrade.compareTable(natives, "attackThresholdRange", natives.attackThresholdMax - natives.attackThresholdMin)
@ -305,14 +306,14 @@ local function onModSettingsChange(event)
upgrade.compareTable(natives, "aiNocturnalMode", settings.global["rampant-permanentNocturnal"].value)
upgrade.compareTable(natives, "aiPointsScaler", settings.global["rampant-aiPointsScaler"].value)
upgrade.compareTable(natives, "newEnemies", settings.startup["rampant-newEnemies"].value)
upgrade.compareTable(natives, "newEnemies", settings.startup["rampant-newEnemies"].value)
upgrade.compareTable(natives, "enemySeed", settings.startup["rampant-enemySeed"].value)
-- RE-ENABLE WHEN COMPLETE
upgrade.compareTable(natives, "disableVanillaAI", settings.global["rampant-disableVanillaAI"].value)
natives.enabledMigration = natives.expansion and settings.global["rampant-enableMigration"].value
game.forces.enemy.ai_controllable = not natives.disableVanillaAI
return true
@ -346,7 +347,7 @@ local function prepWorld(rebuild)
local tick = game.tick
for chunk in surface.get_chunks() do
onChunkGenerated({ tick = tick,
surface = surface,
surface = surface,
area = { left_top = { x = chunk.x * 32,
y = chunk.y * 32 }}})
end
@ -381,7 +382,7 @@ script.on_nth_tick(INTERVAL_SCAN,
scanMap(map, surface, natives, tick)
map.queueSpawners = processSpawnerChunks(map, surface, natives, tick)
map.chunkToPassScan = processScanChunks(map, surface)
end)
@ -391,7 +392,7 @@ script.on_nth_tick(INTERVAL_LOGIC,
local tick = event.tick
local gameRef = game
local surface = gameRef.surfaces[natives.activeSurface]
planning(natives,
gameRef.forces.enemy.evolution_factor,
tick,
@ -406,10 +407,10 @@ end)
script.on_nth_tick(INTERVAL_SQUAD,
function (event)
local gameRef = game
cleanSquads(natives, map)
regroupSquads(natives, map)
squadsBeginAttack(natives, gameRef.players)
squadsDispatch(map, gameRef.surfaces[natives.activeSurface], natives)
end)
@ -429,7 +430,7 @@ end
local function onMine(event)
local entity = event.entity
local surface = entity.surface
if (surface.index == natives.activeSurface) then
if (surface.index == natives.activeSurface) then
addRemovePlayerEntity(map, entity, natives, false, false)
end
end
@ -443,38 +444,38 @@ local function onDeath(event)
local cause = event.cause
if (entity.force.name == "enemy") then
if (entity.type == "unit") then
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
-- drop death pheromone where unit died
deathScent(map, chunk)
if event.force and (event.force.name ~= "enemy") and (chunk[MOVEMENT_PHEROMONE] < -natives.retreatThreshold) then
local tick = event.tick
local artilleryBlast = (cause and ((cause.type == "artillery-wagon") or (cause.type == "artillery-turret")))
retreatUnits(chunk,
entityPosition,
convertUnitGroupToSquad(natives, entity.unit_group),
map,
surface,
surface,
natives,
tick,
(artilleryBlast and RETREAT_SPAWNER_GRAB_RADIUS) or RETREAT_GRAB_RADIUS,
artilleryBlast)
if (mRandom() < natives.rallyThreshold) and not surface.peaceful_mode then
rallyUnits(chunk, map, surface, natives, tick)
end
end
end
elseif event.force and (event.force.name ~= "enemy") and ((entity.type == "unit-spawner") or (entity.type == "turret")) then
local tick = event.tick
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
unregisterEnemyBaseStructure(map, entity)
rallyUnits(chunk, map, surface, natives, tick)
retreatUnits(chunk,
@ -534,7 +535,7 @@ local function onSurfaceTileChange(event)
local chunks = {}
local tiles = event.tiles
for i=1,#tiles do
local position = tiles[i].position
local position = tiles[i].position
local chunk = getChunkByPosition(map, position, true)
-- weird bug with table pointer equality using name instead of pointer comparison
@ -606,18 +607,18 @@ local function onRocketLaunch(event)
if (natives.points > AI_MAX_OVERFLOW_POINTS) then
natives.points = AI_MAX_OVERFLOW_POINTS
end
end
end
end
local function onInit()
global.map = {}
global.pendingChunks = {}
global.natives = {}
map = global.map
natives = global.natives
pendingChunks = global.pendingChunks
prepWorld(false)
hookEvents()
end

View File

@ -19,33 +19,57 @@ local laser = require("prototypes/Laser")
-- local energyThief = require("prototypes/EnergyThief")
if settings.startup["rampant-newEnemies"].value then
neutral.addFaction()
acid.addFaction()
physical.addFaction()
suicide.addFaction()
fire.addFaction()
electric.addFaction()
nuclear.addFaction()
inferno.addFaction()
fast.addFaction()
troll.addFaction()
if settings.startup["rampant-acidEnemy"].value then
acid.addFaction()
end
if settings.startup["rampant-physicalEnemy"].value then
physical.addFaction()
end
if settings.startup["rampant-suicideEnemy"].value then
suicide.addFaction()
end
if settings.startup["rampant-fireEnemy"].value then
fire.addFaction()
end
if settings.startup["rampant-electricEnemy"].value then
electric.addFaction()
end
if settings.startup["rampant-nuclearEnemy"].value then
nuclear.addFaction()
end
if settings.startup["rampant-infernoEnemy"].value then
inferno.addFaction()
end
if settings.startup["rampant-fastEnemy"].value then
fast.addFaction()
end
if settings.startup["rampant-trollEnemy"].value then
troll.addFaction()
end
if settings.startup["rampant-spawnerEnemy"].value then
spawner.addFaction()
end
if settings.startup["rampant-waspEnemy"].value then
wasp.addFaction()
end
if settings.startup["rampant-laserEnemy"].value then
laser.addFaction()
end
-- require("prototypes/Decaying")
-- require("prototypes/Poison")
-- require("prototypes/Undying")
spawner.addFaction()
wasp.addFaction()
laser.addFaction()
-- energyThief.addFaction()
for _, unitSpawner in pairs(data.raw["unit-spawner"]) do
if (unitSpawner.name ~= "biter-spawner") then
unitSpawner.autoplace = nil
unitSpawner.autoplace = nil
end
end
for _, unitSpawner in pairs(data.raw["turret"]) do
if (unitSpawner.name ~= "small-worm-turret") then
unitSpawner.autoplace = nil
unitSpawner.autoplace = nil
end
end
end
@ -58,7 +82,7 @@ end
-- print(serpent.dump(wall.collision_mask))
-- end
if settings.startup["rampant-enableSwarm"] then
if settings.startup["rampant-enableSwarm"] then
for k, unit in pairs(data.raw["unit"]) do
if (string.find(k, "biter") or string.find(k, "spitter")) and unit.collision_box then
unit.collision_box = {

View File

@ -1,7 +1,7 @@
{
"name" : "Rampant",
"factorio_version" : "0.16",
"version" : "0.16.34",
"version" : "0.16.35",
"title" : "Rampant",
"author" : "Veden",
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",

View File

@ -78,24 +78,24 @@ function aiPlanning.planning(natives, evolution_factor, tick, surface, connected
natives.attackWaveSize = attackWaveMaxSize * (evolution_factor ^ 1.66667)
natives.attackWaveDeviation = (attackWaveMaxSize * 0.5) * 0.333
natives.attackWaveUpperBound = attackWaveMaxSize + (attackWaveMaxSize * 0.25)
natives.settlerWaveSize = linearInterpolation(evolution_factor ^ 1.66667, natives.expansionMinSize, natives.expansionMaxSize)
natives.settlerWaveDeviation = (natives.settlerWaveSize * 0.5) * 0.333
natives.settlerCooldown = mFloor(linearInterpolation(evolution_factor ^ 1.66667, natives.expansionMinTime, natives.expansionMaxTime))
natives.unitRefundAmount = AI_UNIT_REFUND * evolution_factor
natives.kamikazeThreshold = NO_RETREAT_BASE_PERCENT + (evolution_factor * NO_RETREAT_EVOLUTION_BONUS_MAX)
local threshold = natives.attackThresholdRange
natives.attackWaveThreshold = (threshold - (threshold * evolution_factor)) + natives.attackThresholdMin
local points = mFloor((AI_POINT_GENERATOR_AMOUNT * mRandom()) + ((AI_POINT_GENERATOR_AMOUNT * 0.7) * (evolution_factor ^ 2.5)) * natives.aiPointsScaler)
natives.baseIncrement = points
if (natives.points < maxPoints) then
natives.points = natives.points + points
end
if (natives.temperamentTick == tick) then
natives.temperament = mRandom()
natives.temperamentTick = randomTickEvent(tick, AI_MIN_TEMPERAMENT_DURATION, AI_MAX_TEMPERAMENT_DURATION)
@ -111,9 +111,9 @@ function aiPlanning.planning(natives, evolution_factor, tick, surface, connected
roll = mRandom()
if (roll < 0.70) then
natives.state = AI_STATE_AGGRESSIVE
elseif (roll < 0.75) then
elseif ((natives.enabledMigration) and (roll < 0.75)) then
natives.state = AI_STATE_MIGRATING
elseif (roll < 0.80) then
elseif ((natives.seigeAIToggle) and (roll < 0.80)) then
natives.state = AI_STATE_SIEGE
elseif ((natives.raidAIToggle) and (evolution_factor >= 0.04)) then
natives.state = AI_STATE_RAIDING
@ -137,7 +137,7 @@ function aiPlanning.planning(natives, evolution_factor, tick, surface, connected
end
end
end
end
return aiPlanning

View File

@ -22,10 +22,10 @@ function aiPredicates.canAttack(natives, surface)
(natives.state == AI_STATE_RAIDING)) and not surface.peaceful_mode
end
function aiPredicates.canMigrate(natives, surface)
function aiPredicates.canMigrate(natives, surface)
return ((natives.state == AI_STATE_MIGRATING) or
(natives.state == AI_STATE_SIEGE) or
aiPredicates.canAttackDark(natives, surface)) and natives.expansion
aiPredicates.canAttackDark(natives, surface)) and natives.expansion and natives.enabledMigration
end
function aiPredicates.isDark(surface)

View File

@ -148,14 +148,14 @@ local mRandom = math.random
local function normalizeProbabilities(probabilityTable)
local result = {}
for alignment,probabilitySet in pairs(probabilityTable) do
local max = 0
local min = MAGIC_MAXIMUM_NUMBER
local alignmentResult = {}
result[alignment] = alignmentResult
for probability, _ in pairs(probabilitySet) do
if (probability > max) then
max = probability
@ -202,48 +202,72 @@ function baseUtils.findNearbyBase(map, chunk, natives)
distanceThreshold = base.distanceThreshold
end
end
return foundBase
end
local function findEntityUpgrade(baseAlignment, evoIndex, natives, evolutionTable)
local function findEntityUpgrade(baseAlignment, currentEvo, evoIndex, natives, evolutionTable)
local alignments = evolutionTable[baseAlignment]
if not alignments then
return nil
end
local entity = nil
for evo=evoIndex, 0, -EVOLUTION_INCREMENTS do
local entitySet = alignments[roundToFloor(evo, EVOLUTION_INCREMENTS)]
if entitySet and (#entitySet > 0) then
for evo,entitySet in pairs(alignments) do
if (currentEvo <= evo) and (evo <= evoIndex) and entitySet and (#entitySet > 0) then
entity = entitySet[mRandom(#entitySet)]
if (mRandom() > 0.35) then
if (mRandom() < 0.1) then
break
end
end
end
return entity
end
local function findBaseInitialAlignment(evoIndex, natives, evolutionTable)
local evoTop = roundToFloor(gaussianRandomRange(evoIndex, evoIndex * 0.3, 0, evoIndex), EVOLUTION_INCREMENTS)
local evoTop = gaussianRandomRange(evoIndex, evoIndex * 0.3, 0, evoIndex)
local pickedEvo
local alignment
for evo=evoTop, 0, -EVOLUTION_INCREMENTS do
local entitySet = evolutionTable[roundToFloor(evo, EVOLUTION_INCREMENTS)]
if entitySet and (#entitySet > 0) then
alignment = entitySet[mRandom(#entitySet)]
if (mRandom() > 0.35) then
break
end
end
for _,evo in pairs(natives.evolutionTableAlignmentOrder) do
local entitySet = evolutionTable[evo]
if (evo <= evoTop) and entitySet and (#entitySet > 0) then
if not pickedEvo then
alignment = entitySet[mRandom(#entitySet)]
pickedEvo = evo
else
local diff = pickedEvo - evo
if (diff > 0.2) then
if (mRandom() < 0.10) then
alignment = entitySet[mRandom(#entitySet)]
break
end
elseif (diff >= 0) then
if (mRandom() < 0.15)then
alignment = entitySet[mRandom(#entitySet)]
break
end
elseif (diff <= -0.2) then
if (mRandom() < 0.35)then
alignment = entitySet[mRandom(#entitySet)]
break
end
elseif (diff < 0) then
if (mRandom() < 0.25)then
alignment = entitySet[mRandom(#entitySet)]
break
end
end
end
end
end
return alignment
end
@ -252,47 +276,48 @@ function baseUtils.recycleBases(natives, tick)
local bases = natives.bases
local removeMe = {}
local endIndex = mMin(baseIndex+BASE_QUEUE_SIZE, #bases)
for index = baseIndex, endIndex do
local base = bases[index]
if ((tick - base.tick) > BASE_COLLECTION_THRESHOLD) then
removeMe[#removeMe+1] = index
end
if ((tick - base.tick) > BASE_COLLECTION_THRESHOLD) then
removeMe[#removeMe+1] = index
end
end
for i=#removeMe, 1, -1 do
tRemove(bases, i)
tRemove(bases, i)
end
if (endIndex == #bases) then
natives.baseIndex = 1
natives.baseIndex = 1
else
natives.baseIndex = endIndex + 1
end
natives.baseIndex = endIndex + 1
end
end
function baseUtils.upgradeEntity(entity, surface, baseAlignment, natives, evolutionFactor)
local position = entity.position
local entityType = entity.type
local currentEvo = entity.prototype.build_base_evolution_requirement or 0
entity.destroy()
if not baseAlignment or (baseAlignment == BASE_ALIGNMENT_DEADZONE) then
return nil
return nil
end
local distance = roundToFloor(mMin(1,
euclideanDistancePoints(position.x, position.y, 0, 0) * BASE_DISTANCE_TO_EVO_INDEX),
EVOLUTION_INCREMENTS)
local evoIndex = mMax(distance, roundToFloor(evolutionFactor, EVOLUTION_INCREMENTS))
local spawnerName = findEntityUpgrade(baseAlignment, evoIndex, natives, ((entityType == "unit-spawner") and natives.evolutionTableUnitSpawner) or natives.evolutionTableWorm)
euclideanDistancePoints(position.x, position.y, 0, 0) * BASE_DISTANCE_TO_EVO_INDEX),
EVOLUTION_INCREMENTS)
local evoIndex = mMax(distance, evolutionFactor)
local spawnerName = findEntityUpgrade(baseAlignment, currentEvo, evoIndex, natives, ((entityType == "unit-spawner") and natives.evolutionTableUnitSpawner) or natives.evolutionTableWorm)
if spawnerName then
local newPosition = surface.find_non_colliding_position(spawnerName, position, CHUNK_SIZE, 4)
if newPosition then
return surface.create_entity({name = spawnerName, position = newPosition})
end
local newPosition = surface.find_non_colliding_position(spawnerName, position, CHUNK_SIZE, 4)
if newPosition then
return surface.create_entity({name = spawnerName, position = newPosition})
end
end
return nil
@ -301,8 +326,8 @@ end
local function upgradeBase(base)
local paths = BASE_ALIGNMENT_PATHS[base.alignment]
if paths and (#paths > 0) then
base.alignment = paths[mRandom(#paths)]
return true
base.alignment = paths[mRandom(#paths)]
return true
end
return false
end
@ -316,31 +341,31 @@ function baseUtils.processBase(map, chunk, surface, natives, tick, base, evoluti
areaBottom[1] = chunk.x + CHUNK_SIZE
areaBottom[2] = chunk.y + CHUNK_SIZE
local entity
local cost
local choice = mRandom()
if (choice <= 0.3) then
if (base.points >= BASE_SPAWNER_UPGRADE) then
entity = surface.find_entities_filtered(map.filteredEntitiesSpawnerQueryLimited)
cost = BASE_SPAWNER_UPGRADE
end
if (base.points >= BASE_SPAWNER_UPGRADE) then
entity = surface.find_entities_filtered(map.filteredEntitiesSpawnerQueryLimited)
cost = BASE_SPAWNER_UPGRADE
end
elseif (choice <= 0.6) then
if (base.points >= BASE_WORM_UPGRADE) then
entity = surface.find_entities_filtered(map.filteredEntitiesWormQueryLimited)
cost = BASE_WORM_UPGRADE
end
elseif (choice >= 0.995) then
if (base.points >= BASE_UPGRADE) then
if upgradeBase(base) then
base.points = base.points - BASE_UPGRADE
end
end
if (base.points >= BASE_WORM_UPGRADE) then
entity = surface.find_entities_filtered(map.filteredEntitiesWormQueryLimited)
cost = BASE_WORM_UPGRADE
end
elseif (choice >= 0.985) then
if (base.points >= BASE_UPGRADE) then
if upgradeBase(base) then
base.points = base.points - BASE_UPGRADE
end
end
end
if entity and (#entity > 0) then
baseUtils.upgradeEntity(entity[mRandom(#entity)], surface, base.alignment, natives, evolutionFactor)
base.points = base.points - cost
baseUtils.upgradeEntity(entity[mRandom(#entity)], surface, base.alignment, natives, evolutionFactor)
base.points = base.points - cost
end
base.points = base.points + natives.baseIncrement
@ -355,103 +380,117 @@ function baseUtils.createBase(map, natives, evolutionFactor, chunk, surface, tic
local meanLevel = mFloor(distance / 200)
local distanceIndex = roundToFloor(mMin(1, distance * BASE_DISTANCE_TO_EVO_INDEX), EVOLUTION_INCREMENTS)
local evoIndex = mMax(distanceIndex, roundToFloor(evolutionFactor, EVOLUTION_INCREMENTS))
local distanceIndex = mMin(1, distance * BASE_DISTANCE_TO_EVO_INDEX)
local evoIndex = mMax(distanceIndex, evolutionFactor)
local alignment
if (not rebuilding) and (mRandom() < natives.deadZoneFrequency) then
alignment = BASE_ALIGNMENT_DEADZONE
alignment = BASE_ALIGNMENT_DEADZONE
else
alignment = findBaseInitialAlignment(evoIndex, natives, natives.evolutionTableAlignment) or BASE_ALIGNMENT_NEUTRAL
alignment = findBaseInitialAlignment(evoIndex, natives, natives.evolutionTableAlignment) or BASE_ALIGNMENT_NEUTRAL
end
local baseLevel = gaussianRandomRange(meanLevel, meanLevel * 0.3, meanLevel * 0.50, meanLevel * 1.50)
local baseDistanceThreshold = gaussianRandomRange(BASE_DISTANCE_THRESHOLD, BASE_DISTANCE_THRESHOLD * 0.2, BASE_DISTANCE_THRESHOLD * 0.75, BASE_DISTANCE_THRESHOLD * 1.50)
local distanceThreshold = (baseLevel * BASE_DISTANCE_LEVEL_BONUS) + baseDistanceThreshold
local base = {
x = x,
y = y,
distanceThreshold = distanceThreshold,
tick = tick,
alignment = alignment,
points = 0
x = x,
y = y,
distanceThreshold = distanceThreshold,
tick = tick,
alignment = alignment,
points = 0
}
if (alignment ~= BASE_ALIGNMENT_DEADZONE) then
setChunkBase(map, chunk, base)
setChunkBase(map, chunk, base)
end
-- if not buildHive(map, base, surface) then
-- return nil
-- end
natives.bases[#natives.bases+1] = base
return base
end
local function fileEntity(baseAlignment, entity, evolutionTable)
local evoRequirement = mFloor(entity.prototype.build_base_evolution_requirement/EVOLUTION_INCREMENTS) * EVOLUTION_INCREMENTS
local evoRequirement = mMin(entity.prototype.build_base_evolution_requirement, 1)
local eTable = evolutionTable[baseAlignment]
if not eTable then
eTable = {}
evolutionTable[baseAlignment] = eTable
eTable = {}
evolutionTable[baseAlignment] = eTable
end
local aTable = eTable[evoRequirement]
if not aTable then
aTable = {}
eTable[evoRequirement] = aTable
aTable = {}
eTable[evoRequirement] = aTable
end
aTable[#aTable+1] = entity.name
end
local function fileAlignment(baseAlignment, evolution, evolutionTable)
local evoRequirement = mFloor(evolution/EVOLUTION_INCREMENTS) * EVOLUTION_INCREMENTS
local eTable = evolutionTable[evoRequirement]
local evoRequirement = mMin(evolution, 1)
local eTable = evolutionTable[evolution]
if not eTable then
eTable = {}
evolutionTable[evoRequirement] = eTable
eTable = {}
evolutionTable[evoRequirement] = eTable
end
eTable[#eTable+1] = baseAlignment
end
local function nonRepeatingRandom(evoTable, rg)
local ordering = {}
for evo in pairs(evoTable) do
ordering[#ordering+1] = evo
end
for i=#ordering,1,-1 do
local s = rg(i)
local t = ordering[i]
ordering[i] = ordering[s]
ordering[s] = t
end
return ordering
end
local function processUnitClass(biterVariation, biterTier, spitterVariation, spitterTier, wormVariation, wormTier, surface, natives, baseAlignment, baseAlignmentString)
local position = { x = 0, y = 0 }
for tier=1,biterTier do
local t = ((biterTier == 5) and TIER_NAMING_SET_5[tier]) or TIER_NAMING_SET_10[tier]
for v=1,biterVariation do
local entity = surface.create_entity({
name= baseAlignmentString .. "-biter-nest-v" .. v .. "-t" .. t .. "-rampant",
position = position
})
fileEntity(baseAlignment, entity, natives.evolutionTableUnitSpawner)
entity.destroy()
end
local t = ((biterTier == 5) and TIER_NAMING_SET_5[tier]) or TIER_NAMING_SET_10[tier]
for v=1,biterVariation do
local entity = surface.create_entity({
name= baseAlignmentString .. "-biter-nest-v" .. v .. "-t" .. t .. "-rampant",
position = position
})
fileEntity(baseAlignment, entity, natives.evolutionTableUnitSpawner)
entity.destroy()
end
end
for tier=1,spitterTier do
local t = ((spitterTier == 5) and TIER_NAMING_SET_5[tier]) or TIER_NAMING_SET_10[tier]
for v=1,spitterVariation do
local entity = surface.create_entity({
name=baseAlignmentString .. "-spitter-nest-v" .. v .. "-t" .. t .. "-rampant",
position = position
})
fileEntity(baseAlignment, entity, natives.evolutionTableUnitSpawner)
entity.destroy()
end
local t = ((spitterTier == 5) and TIER_NAMING_SET_5[tier]) or TIER_NAMING_SET_10[tier]
for v=1,spitterVariation do
local entity = surface.create_entity({
name=baseAlignmentString .. "-spitter-nest-v" .. v .. "-t" .. t .. "-rampant",
position = position
})
fileEntity(baseAlignment, entity, natives.evolutionTableUnitSpawner)
entity.destroy()
end
end
for tier=1,wormTier do
local t = ((wormTier == 5) and TIER_NAMING_SET_5[tier]) or TIER_NAMING_SET_10[tier]
for v=1,wormVariation do
local entity = surface.create_entity({
name=baseAlignmentString .. "-worm-v" .. v .. "-t" .. t .. "-rampant",
position = position
})
fileEntity(baseAlignment, entity, natives.evolutionTableWorm)
entity.destroy()
end
local t = ((wormTier == 5) and TIER_NAMING_SET_5[tier]) or TIER_NAMING_SET_10[tier]
for v=1,wormVariation do
local entity = surface.create_entity({
name=baseAlignmentString .. "-worm-v" .. v .. "-t" .. t .. "-rampant",
position = position
})
fileEntity(baseAlignment, entity, natives.evolutionTableWorm)
entity.destroy()
end
end
end
@ -462,128 +501,148 @@ function baseUtils.rebuildNativeTables(natives, surface, rg)
-- todo fill out alignment evolution levels
for alignment,evo in pairs(BASE_ALIGNMENT_EVOLUTION_BASELINE) do
fileAlignment(alignment,
gaussianRandomRangeRG(evo, evo * 0.2, evo * 0.5, evo * 1.5, rg),
natives.evolutionTableAlignment)
fileAlignment(alignment,
gaussianRandomRangeRG(evo, evo * 0.2, evo * 0.5, evo * 1.5, rg),
natives.evolutionTableAlignment)
end
natives.evolutionTableAlignmentOrder = nonRepeatingRandom(natives.evolutionTableAlignment, natives.randomGenerator)
if ENABLED_NE_UNITS then
processNEUnitClass(natives, surface)
processNEUnitClass(natives, surface)
end
if ENABLED_BOBS_UNITS then
processBobsUnitClass(natives, surface)
processBobsUnitClass(natives, surface)
end
processUnitClass(NEUTRAL_NEST_VARIATIONS,
NEUTRAL_NEST_TIERS,
NEUTRAL_NEST_VARIATIONS,
NEUTRAL_NEST_TIERS,
NEUTRAL_WORM_VARIATIONS,
NEUTRAL_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_NEUTRAL,
"neutral")
NEUTRAL_NEST_TIERS,
NEUTRAL_NEST_VARIATIONS,
NEUTRAL_NEST_TIERS,
NEUTRAL_WORM_VARIATIONS,
NEUTRAL_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_NEUTRAL,
"neutral")
processUnitClass(ACID_NEST_VARIATIONS,
ACID_NEST_TIERS,
ACID_NEST_VARIATIONS,
ACID_NEST_TIERS,
ACID_WORM_VARIATIONS,
ACID_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_ACID,
"acid")
if settings.startup["rampant-acidEnemy"].value then
processUnitClass(ACID_NEST_VARIATIONS,
ACID_NEST_TIERS,
ACID_NEST_VARIATIONS,
ACID_NEST_TIERS,
ACID_WORM_VARIATIONS,
ACID_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_ACID,
"acid")
end
processUnitClass(PHYSICAL_NEST_VARIATIONS,
PHYSICAL_NEST_TIERS,
0,
0,
PHYSICAL_WORM_VARIATIONS,
PHYSICAL_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_PHYSICAL,
"physical")
if settings.startup["rampant-physicalEnemy"].value then
processUnitClass(PHYSICAL_NEST_VARIATIONS,
PHYSICAL_NEST_TIERS,
0,
0,
PHYSICAL_WORM_VARIATIONS,
PHYSICAL_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_PHYSICAL,
"physical")
end
processUnitClass(FIRE_NEST_VARIATIONS,
FIRE_NEST_TIERS,
FIRE_NEST_VARIATIONS,
FIRE_NEST_TIERS,
FIRE_WORM_VARIATIONS,
FIRE_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_FIRE,
"fire")
if settings.startup["rampant-fireEnemy"].value then
processUnitClass(FIRE_NEST_VARIATIONS,
FIRE_NEST_TIERS,
FIRE_NEST_VARIATIONS,
FIRE_NEST_TIERS,
FIRE_WORM_VARIATIONS,
FIRE_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_FIRE,
"fire")
end
processUnitClass(ELECTRIC_NEST_VARIATIONS,
ELECTRIC_NEST_TIERS,
0,
0,
ELECTRIC_WORM_VARIATIONS,
ELECTRIC_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_ELECTRIC,
"electric")
if settings.startup["rampant-electricEnemy"].value then
processUnitClass(ELECTRIC_NEST_VARIATIONS,
ELECTRIC_NEST_TIERS,
0,
0,
ELECTRIC_WORM_VARIATIONS,
ELECTRIC_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_ELECTRIC,
"electric")
end
processUnitClass(SUICIDE_NEST_VARIATIONS,
SUICIDE_NEST_TIERS,
0,
0,
SUICIDE_WORM_VARIATIONS,
SUICIDE_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_SUICIDE,
"suicide")
if settings.startup["rampant-suicideEnemy"].value then
processUnitClass(SUICIDE_NEST_VARIATIONS,
SUICIDE_NEST_TIERS,
0,
0,
SUICIDE_WORM_VARIATIONS,
SUICIDE_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_SUICIDE,
"suicide")
end
processUnitClass(NUCLEAR_NEST_VARIATIONS,
NUCLEAR_NEST_TIERS,
0,
0,
NUCLEAR_WORM_VARIATIONS,
NUCLEAR_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_NUCLEAR,
"nuclear")
if settings.startup["rampant-nuclearEnemy"].value then
processUnitClass(NUCLEAR_NEST_VARIATIONS,
NUCLEAR_NEST_TIERS,
0,
0,
NUCLEAR_WORM_VARIATIONS,
NUCLEAR_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_NUCLEAR,
"nuclear")
end
processUnitClass(TROLL_NEST_VARIATIONS,
TROLL_NEST_TIERS,
TROLL_NEST_VARIATIONS,
TROLL_NEST_TIERS,
TROLL_WORM_VARIATIONS,
TROLL_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_TROLL,
"troll")
if settings.startup["rampant-trollEnemy"].value then
processUnitClass(TROLL_NEST_VARIATIONS,
TROLL_NEST_TIERS,
TROLL_NEST_VARIATIONS,
TROLL_NEST_TIERS,
TROLL_WORM_VARIATIONS,
TROLL_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_TROLL,
"troll")
end
processUnitClass(0,
0,
INFERNO_NEST_VARIATIONS,
INFERNO_NEST_TIERS,
INFERNO_WORM_VARIATIONS,
INFERNO_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_INFERNO,
"inferno")
if settings.startup["rampant-infernoEnemy"].value then
processUnitClass(0,
0,
INFERNO_NEST_VARIATIONS,
INFERNO_NEST_TIERS,
INFERNO_WORM_VARIATIONS,
INFERNO_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_INFERNO,
"inferno")
end
processUnitClass(FAST_NEST_VARIATIONS,
FAST_NEST_TIERS,
FAST_NEST_VARIATIONS,
FAST_NEST_TIERS,
FAST_WORM_VARIATIONS,
FAST_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_FAST,
"fast")
if settings.startup["rampant-fastEnemy"].value then
processUnitClass(FAST_NEST_VARIATIONS,
FAST_NEST_TIERS,
FAST_NEST_VARIATIONS,
FAST_NEST_TIERS,
FAST_WORM_VARIATIONS,
FAST_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_FAST,
"fast")
end
-- processUnitClass(DECAYING_NEST_VARIATIONS,
-- DECAYING_NEST_TIERS,
@ -618,42 +677,48 @@ function baseUtils.rebuildNativeTables(natives, surface, rg)
-- BASE_ALIGNMENT_POSION,
-- "posion")
processUnitClass(LASER_NEST_VARIATIONS,
LASER_NEST_TIERS,
LASER_NEST_VARIATIONS,
LASER_NEST_TIERS,
LASER_WORM_VARIATIONS,
LASER_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_LASER,
"laser")
processUnitClass(0,
0,
WASP_NEST_VARIATIONS,
WASP_NEST_TIERS,
WASP_WORM_VARIATIONS,
WASP_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_WASP,
"wasp")
if settings.startup["rampant-laserEnemy"].value then
processUnitClass(LASER_NEST_VARIATIONS,
LASER_NEST_TIERS,
LASER_NEST_VARIATIONS,
LASER_NEST_TIERS,
LASER_WORM_VARIATIONS,
LASER_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_LASER,
"laser")
end
processUnitClass(0,
0,
SPAWNER_NEST_VARIATIONS,
SPAWNER_NEST_TIERS,
SPAWNER_WORM_VARIATIONS,
SPAWNER_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_SPAWNER,
"spawner")
if settings.startup["rampant-waspEnemy"].value then
processUnitClass(0,
0,
WASP_NEST_VARIATIONS,
WASP_NEST_TIERS,
WASP_WORM_VARIATIONS,
WASP_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_WASP,
"wasp")
end
if settings.startup["rampant-spawnerEnemy"].value then
processUnitClass(0,
0,
SPAWNER_NEST_VARIATIONS,
SPAWNER_NEST_TIERS,
SPAWNER_WORM_VARIATIONS,
SPAWNER_WORM_TIERS,
surface,
natives,
BASE_ALIGNMENT_SPAWNER,
"spawner")
end
natives.evolutionTableUnitSpawner = normalizeProbabilities(natives.evolutionTableUnitSpawner)
natives.evolutionTableWorm = normalizeProbabilities(natives.evolutionTableWorm)
end
return baseUtils

View File

@ -21,7 +21,7 @@ constants.VERSION_41 = 41
constants.VERSION_44 = 44
constants.VERSION_51 = 51
constants.VERSION_57 = 57
constants.VERSION_69 = 69
constants.VERSION_70 = 70
-- misc
@ -50,7 +50,7 @@ constants.INTERVAL_SPAWNER = constants.TICKS_A_SECOND * 10
constants.INTERVAL_RALLY = constants.TICKS_A_SECOND * 10
constants.INTERVAL_RETREAT = constants.TICKS_A_SECOND * 10
constants.RESOURCE_NORMALIZER = 1 / 1024
constants.RESOURCE_NORMALIZER = 1 / 1024
constants.PLAYER_PHEROMONE_MULTIPLER = 500
@ -168,44 +168,127 @@ constants.BASE_PROCESS_INTERVAL = constants.TICKS_A_SECOND * 2
-- local decayingPath = {}
-- decayingPath[constants.BASE_ALIGNMENT_UNDYING] = true
local electricPath = {
-- constants.BASE_ALIGNMENT_ENERGY_THIEF,
constants.BASE_ALIGNMENT_LASER
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE = {
[constants.BASE_ALIGNMENT_NEUTRAL] = 0
}
constants.BASE_ALIGNMENT_PATHS = {}
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_NEUTRAL] = {
constants.BASE_ALIGNMENT_ACID,
constants.BASE_ALIGNMENT_FIRE,
constants.BASE_ALIGNMENT_WASP,
constants.BASE_ALIGNMENT_PHYSICAL,
constants.BASE_ALIGNMENT_ELECTRIC,
constants.BASE_ALIGNMENT_SUICIDE,
constants.BASE_ALIGNMENT_TROLL,
constants.BASE_ALIGNMENT_FAST
}
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_FIRE] = { constants.BASE_ALIGNMENT_INFERNO }
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_SUICIDE] = { constants.BASE_ALIGNMENT_NUCLEAR }
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_WASP] = { constants.BASE_ALIGNMENT_SPAWNER }
-- constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_NEUTRAL] = {
-- constants.BASE_ALIGNMENT_ACID,
-- constants.BASE_ALIGNMENT_FIRE,
-- constants.BASE_ALIGNMENT_WASP,
-- constants.BASE_ALIGNMENT_PHYSICAL,
-- constants.BASE_ALIGNMENT_ELECTRIC,
-- constants.BASE_ALIGNMENT_SUICIDE,
-- constants.BASE_ALIGNMENT_TROLL,
-- constants.BASE_ALIGNMENT_FAST
-- }
local function pushBasePath(x)
local tbl = constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_NEUTRAL]
if not tbl then
tbl = {}
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_NEUTRAL] = tbl
end
tbl[#tbl+1] = x
end
if settings.startup["rampant-acidEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_ACID)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_ACID] = 0.1
end
if settings.startup["rampant-physicalEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_PHYSICAL)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_PHYSICAL] = 0.4
end
if settings.startup["rampant-suicideEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_SUICIDE)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_SUICIDE] = 0.3
end
if settings.startup["rampant-fireEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_FIRE)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_FIRE] = 0.4
end
if settings.startup["rampant-electricEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_ELECTRIC)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_ELECTRIC] = 0.2
end
if settings.startup["rampant-nuclearEnemy"].value then
if settings.startup["rampant-suicideEnemy"].value then
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_SUICIDE] = { constants.BASE_ALIGNMENT_NUCLEAR }
end
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_NUCLEAR] = 0.7
end
if settings.startup["rampant-fastEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_FAST)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_FAST] = 0.5
end
if settings.startup["rampant-trollEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_TROLL)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_TROLL] = 0.5
end
if settings.startup["rampant-laserEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_LASER)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_LASER] = 0.4
end
if settings.startup["rampant-waspEnemy"].value then
pushBasePath(constants.BASE_ALIGNMENT_WASP)
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_WASP] = 0.5
end
-- constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_FIRE] = { constants.BASE_ALIGNMENT_INFERNO }
-- constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_SUICIDE] = { constants.BASE_ALIGNMENT_NUCLEAR }
-- constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_WASP] = { constants.BASE_ALIGNMENT_SPAWNER }
-- constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_ACID] = acidPath
-- constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_DECAYING] = decayingPath
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_ELECTRIC] = electricPath
-- constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_ELECTRIC] = { constants.BASE_ALIGNMENT_LASER }
-- [constants.BASE_ALIGNMENT_WASP] = 0.5,
-- [constants.BASE_ALIGNMENT_SPAWNER] = 0.7,
-- [constants.BASE_ALIGNMENT_INFERNO] = 0.6,
if settings.startup["rampant-infernoEnemy"].value then
if settings.startup["rampant-fireEnemy"].value then
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_FIRE] = { constants.BASE_ALIGNMENT_INFERNO }
end
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_INFERNO] = 0.6
end
if settings.startup["rampant-spawnerEnemy"].value then
if settings.startup["rampant-waspEnemy"].value then
constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_WASP] = { constants.BASE_ALIGNMENT_SPAWNER }
end
local tbl = constants.BASE_ALIGNMENT_EVOLUTION_BASELINE
tbl[constants.BASE_ALIGNMENT_SPAWNER] = 0.7
end
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE = {
[constants.BASE_ALIGNMENT_NEUTRAL] = 0,
[constants.BASE_ALIGNMENT_ACID] = 0.1,
[constants.BASE_ALIGNMENT_ELECTRIC] = 0.2,
[constants.BASE_ALIGNMENT_SUICIDE] = 0.3,
[constants.BASE_ALIGNMENT_PHYSICAL] = 0.4,
[constants.BASE_ALIGNMENT_LASER] = 0.4,
[constants.BASE_ALIGNMENT_WASP] = 0.5,
[constants.BASE_ALIGNMENT_FIRE] = 0.4,
[constants.BASE_ALIGNMENT_FAST] = 0.5,
[constants.BASE_ALIGNMENT_TROLL] = 0.5,
[constants.BASE_ALIGNMENT_SPAWNER] = 0.7,
[constants.BASE_ALIGNMENT_INFERNO] = 0.6,
[constants.BASE_ALIGNMENT_NUCLEAR] = 0.7
}
constants.ENABLED_NE_UNITS = settings.startup["rampant-enableNEUnits"].value and (settings.startup["NE_Difficulty"] ~= nil)
@ -218,19 +301,19 @@ end
if constants.ENABLED_NE_UNITS then
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE] = 0.1
if settings.startup["NE_Blue_Spawners"].value then
if settings.startup["NE_Blue_Spawners"].value then
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_BLUE] = 0.1
end
if settings.startup["NE_Red_Spawners"].value then
if settings.startup["NE_Red_Spawners"].value then
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_RED] = 0.1
end
if settings.startup["NE_Pink_Spawners"].value then
if settings.startup["NE_Pink_Spawners"].value then
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_PINK] = 0.1
end
if settings.startup["NE_Green_Spawners"].value then
if settings.startup["NE_Green_Spawners"].value then
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_GREEN] = 0.1
end
if settings.startup["NE_Yellow_Spawners"].value then
if settings.startup["NE_Yellow_Spawners"].value then
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_YELLOW] = 0.1
end
end

View File

@ -92,7 +92,7 @@ end
processing is not consistant as it depends on the number of chunks that have been generated
so if we process 400 chunks an iteration and 200 chunks have been generated than these are
processed 3 times a second and 1200 generated chunks would be processed once a second
In theory, this might be fine as smaller bases have less surface to attack and need to have
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(map, surface, natives, tick, evolutionFactor)
@ -100,7 +100,7 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
local index = map.processIndex
local chunkToBase = map.chunkToBase
if (index == 1) then
roll = mRandom()
map.processRoll = roll
@ -108,7 +108,7 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
local newEnemies = natives.newEnemies
local scentStaging = map.scentStaging
local squads = canAttack(natives, surface) and (0.11 <= roll) and (roll <= 0.35) and (natives.points >= AI_SQUAD_COST)
local settlers = canMigrate(natives, surface) and (0.90 <= roll) and (natives.points >= AI_SETTLER_COST)
@ -116,8 +116,8 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
local endIndex = mMin(index + PROCESS_QUEUE_SIZE, #processQueue)
local i = 1
for x=index,endIndex do
local chunk = processQueue[x]
local chunk = processQueue[x]
if (chunk[CHUNK_TICK] ~= tick) then
processPheromone(map, chunk, scentStaging[i])
@ -125,7 +125,7 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
if squads then
squads = formSquads(map, surface, natives, chunk, AI_SQUAD_COST)
end
if natives.enabledMigration and settlers then
if settlers then
settlers = formSettlers(map, surface, natives, chunk, AI_SETTLER_COST, tick)
end
end
@ -135,24 +135,24 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
if base and ((tick - base.tick) > BASE_PROCESS_INTERVAL) and (mRandom() < 0.10) then
processBase(map, chunk, surface, natives, tick, base, evolutionFactor)
end
end
end
end
i = i + 1
end
i = 1
for x=index,endIndex do
local chunk = processQueue[x]
if (chunk[CHUNK_TICK] ~= tick) then
chunk[CHUNK_TICK] = tick
commitPheromone(map, chunk, scentStaging[i])
scents(map, chunk)
end
i = i + 1
end
if (endIndex == #processQueue) then
map.processIndex = 1
else
@ -163,7 +163,7 @@ end
--[[
Localized player radius were processing takes place in realtime, doesn't store state
between calls.
vs
vs
the slower passive version processing the entire map in multiple passes.
--]]
function mapProcessor.processPlayers(players, map, surface, natives, tick)
@ -178,12 +178,12 @@ function mapProcessor.processPlayers(players, map, surface, natives, tick)
local scentStaging = map.scentStaging
local squads = allowingAttacks and (0.11 <= roll) and (roll <= 0.20) and (natives.points >= AI_SQUAD_COST)
for i=1,#playerOrdering do
local player = players[playerOrdering[i]]
if validPlayer(player, natives) then
if validPlayer(player, natives) then
local playerChunk = getChunkByPosition(map, player.character.position)
if (playerChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
playerScent(playerChunk)
end
@ -191,22 +191,22 @@ function mapProcessor.processPlayers(players, map, surface, natives, tick)
end
local i = 1
-- not looping everyone because the cost is high enough already in multiplayer
if (#playerOrdering > 0) then
local player = players[playerOrdering[1]]
if validPlayer(player, natives) then
if validPlayer(player, natives) then
local playerChunk = getChunkByPosition(map, player.character.position)
if (playerChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
local vengence = (allowingAttacks and
(natives.points >= AI_VENGENCE_SQUAD_COST) and
((getEnemyStructureCount(map, playerChunk) > 0) or (playerChunk[MOVEMENT_PHEROMONE] < natives.retreatThreshold)))
for x=playerChunk.x - PROCESS_PLAYER_BOUND, playerChunk.x + PROCESS_PLAYER_BOUND, 32 do
for y=playerChunk.y - PROCESS_PLAYER_BOUND, playerChunk.y + PROCESS_PLAYER_BOUND, 32 do
local chunk = getChunkByXY(map, x, y)
local chunk = getChunkByXY(map, x, y)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
processPheromone(map, chunk, scentStaging[i])
@ -217,17 +217,17 @@ function mapProcessor.processPlayers(players, map, surface, natives, tick)
if vengence then
vengence = formSquads(map, surface, natives, chunk, AI_VENGENCE_SQUAD_COST)
end
end
end
end
i = i + 1
end
end
i = 1
i = 1
for x=playerChunk.x + PROCESS_PLAYER_BOUND, playerChunk.x - PROCESS_PLAYER_BOUND, -32 do
for y=playerChunk.y + PROCESS_PLAYER_BOUND, playerChunk.y - PROCESS_PLAYER_BOUND, -32 do
local chunk = getChunkByXY(map, x, y)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
chunk[CHUNK_TICK] = tick
commitPheromone(map, chunk, scentStaging[i])
scents(map, chunk)
@ -257,13 +257,13 @@ function mapProcessor.scanMap(map, surface, natives, tick)
local processQueue = map.processQueue
local endIndex = mMin(index + SCAN_QUEUE_SIZE, #processQueue)
for x=index,endIndex do
local chunk = processQueue[x]
chunkBox[1] = chunk.x
chunkBox[2] = chunk.y
offset[1] = chunk.x + CHUNK_SIZE
offset[2] = chunk.y + CHUNK_SIZE
@ -291,7 +291,7 @@ function mapProcessor.scanMap(map, surface, natives, tick)
if closeBy then
local deadGroup = surface.count_entities_filtered(unitCountQuery) > 300
if deadGroup then
recycleBiters(natives, surface.find_enemy_units(chunk, TRIPLE_CHUNK_SIZE))
end

View File

@ -11266,6 +11266,20 @@ rampant-unitSpawnerSpawnScaler=Unit Spawner Spawn Count Scaler
rampant-unitSpawnerRespawnScaler=Unit Spawner Respawn Rate Scaler
rampant-raidAIToggle=AI: Enable Raiding AI
rampant-seigeAIToggle=AI: Enable Seige AI
rampant-laserEnemy=Laser Biter Faction
rampant-waspEnemy=Wasp Biter Faction
rampant-spawnerEnemy=Spawner Biter Faction
rampant-trollEnemy=Troll Biter Faction
rampant-fastEnemy=Fast Biter Faction
rampant-infernoEnemy=Inferno Biter Faction
rampant-nuclearEnemy=Nuclear Biter Faction
rampant-electricEnemy=Electric Biter Faction
rampant-fireEnemy=Fire Biter Faction
rampant-suicideEnemy=Suicide Biter Faction
rampant-physicalEnemy=Physical Biter Faction
rampant-acidEnemy=Acid Biter Faction
[mod-setting-description]
rampant-useDumbProjectiles=Turns off homing projectiles for worms and spitters
@ -11330,4 +11344,18 @@ rampant-unitSpawnerOwnedScaler=Scales by a percentage all new enemy nest max num
rampant-unitSpawnerSpawnScaler=Scales by a percentage all new enemy nest number of units spawned at any one time
rampant-unitSpawnerRespawnScaler=Scales by a percentage all new enemy nest time to spawn new units
rampant-raidAIToggle=Toggles the ai raiding parties from outside your pollution cloud
rampant-raidAIToggle=Toggles the ai raiding parties from outside your pollution cloud
rampant-seigeAIToggle=Toggles the ai seige parties from outside your pollution cloud that attack or nest
rampant-laserEnemy=Laser Biter Faction
rampant-waspEnemy=Wasp Biter Faction
rampant-spawnerEnemy=Spawner Biter Faction
rampant-trollEnemy=Troll Biter Faction
rampant-fastEnemy=Fast Biter Faction
rampant-infernoEnemy=Inferno Biter Faction
rampant-nuclearEnemy=Nuclear Biter Faction
rampant-electricEnemy=Electric Biter Faction
rampant-fireEnemy=Fire Biter Faction
rampant-suicideEnemy=Suicide Biter Faction
rampant-physicalEnemy=Physical Biter Faction
rampant-acidEnemy=Acid Biter Faction

View File

@ -86,7 +86,7 @@
(makeZip modFolder))
(define (run)
(copyFiles modFolder)
;; (copyFiles modFolder)
;;(copyFiles zipModFolder)
;; (makeZip modFolder)
(makeZip modFolder)
(system*/exit-code "/data/games/factorio/bin/x64/factorio")))

View File

@ -9,7 +9,7 @@ data:extend({
order = "a[modifier]-a[projectiles]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-useNEUnitLaunchers",
@ -27,7 +27,7 @@ data:extend({
order = "a[modifier]-b[projectiles]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-attackWaveGenerationUsePollution",
@ -36,7 +36,7 @@ data:extend({
order = "b[modifier]-a[trigger]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-attackWaveGenerationUsePlayerProximity",
@ -55,7 +55,7 @@ data:extend({
order = "b[modifier]-c[threshold]",
per_user = false
},
{
type = "double-setting",
name = "rampant-attackWaveGenerationThresholdMax",
@ -75,7 +75,7 @@ data:extend({
order = "b[modifier]-e[threshold]",
per_user = false
},
{
type = "int-setting",
name = "rampant-attackWaveMaxSize",
@ -127,7 +127,7 @@ data:extend({
order = "c[modifier]-a[safe]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-safeBuildings-curvedRail",
@ -137,7 +137,7 @@ data:extend({
per_user = false
},
{
type = "bool-setting",
name = "rampant-safeBuildings-straightRail",
@ -164,7 +164,7 @@ data:extend({
order = "c[modifier]-e[safe]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-safeBuildings-railChainSignals",
@ -191,7 +191,7 @@ data:extend({
order = "c[modifier]-h[safe]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-addWallResistanceAcid",
@ -210,7 +210,7 @@ data:extend({
order = "c[modifier]-k[trigger]",
per_user = false
},
{
type = "double-setting",
@ -223,7 +223,7 @@ data:extend({
order = "d[modifier]-a[ai]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-newEnemies",
@ -232,7 +232,7 @@ data:extend({
default_value = false,
order = "e[modifier]-a[unit]",
per_user = false
},
},
{
type = "int-setting",
@ -323,7 +323,7 @@ data:extend({
order = "l[modifier]-i[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-enableNEUnits",
@ -355,6 +355,114 @@ data:extend({
per_user = false
},
{
type = "bool-setting",
name = "rampant-acidEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-n[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-physicalEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-o[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-suicideEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-p[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-fireEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-q[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-electricEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-r[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-nuclearEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-s[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-infernoEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-t[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-fastEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-u[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-trollEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-v[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-spawnerEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-w[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-waspEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-x[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-laserEnemy",
setting_type = "startup",
default_value = true,
order = "l[modifier]-y[unit]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-disableVanillaAI",
@ -383,7 +491,16 @@ data:extend({
order = "m[total]-c[ai]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-seigeAIToggle",
setting_type = "runtime-global",
default_value = true,
order = "m[total]-d[ai]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-removeBloodParticles",
@ -393,7 +510,7 @@ data:extend({
order = "n[modifier]-a[optimize]",
per_user = false
},
{
type = "bool-setting",
name = "rampant-attack-warning",
@ -405,7 +522,7 @@ data:extend({
},
{
type = "double-setting",
name = "rampant-unitBiterHealthScaler",