1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-28 03:29:34 +02:00

see changelog

This commit is contained in:
Aaron Veden 2019-04-24 23:13:22 -07:00
parent bdab152887
commit 4eeef8b8fc
12 changed files with 192 additions and 101 deletions

View File

@ -9,6 +9,8 @@ local mathUtils = require("libs/MathUtils")
local BASE_AI_STATE_DORMANT = constants.BASE_AI_STATE_DORMANT
local AI_STATE_AGGRESSIVE = constants.AI_STATE_AGGRESSIVE
local INTERVAL_LOGIC = constants.INTERVAL_LOGIC
local CHUNK_SIZE = constants.CHUNK_SIZE
@ -298,7 +300,14 @@ function upgrade.attempt(natives)
game.surfaces[natives.activeSurface].print("Rampant - Version 0.17.18")
global.version = constants.VERSION_88
end
end
if (global.version < 89) then
natives.canAttackTick = 0
game.surfaces[natives.activeSurface].print("Rampant - Version 0.17.22")
global.version = 89
end
return starting ~= global.version, natives
end

View File

@ -1,3 +1,16 @@
---------------------------------------------------------------------------------------------------
Version: 0.17.22
Date: 4. 24. 2019
Tweaks:
- Normalized unit 10 tier evolution spawns ((1, 0%) -> (2, 30%) -> (3, 40%) -> (4, 50%) -> (5, 60%) -> (6, 70%) -> (7, 80%) -> (8, 85%) -> (9, 90%) -> (10, 93%))
- Normalized unit 5 tier evolution spawns ((1, 0%) -> (2, 40%) -> (3, 60%) -> (4, 70%) -> (5, 90%))
- Decreased default new enemy physical decrease for (level, newVal) (1, 1) (3, 3) (7, 8) (8, 10)
- Changed default unit tiers to 10
- Changed aggressive AI state to spawn unit groups with 1 to 3 minutes between groups, (raid, onslaught, siege, and migration still can mass spawn)
Bugfixes:
- Fixed random tick generator not being uniform over provided range
- Fixed AI migration state not respecting peaceful surfaces
---------------------------------------------------------------------------------------------------
Version: 0.17.21
Date: 4. 21. 2019

View File

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

View File

@ -20,10 +20,15 @@ local PLAYER_PHEROMONE = constants.PLAYER_PHEROMONE
local MOVEMENT_PHEROMONE = constants.MOVEMENT_PHEROMONE
local RESOURCE_PHEROMONE = constants.RESOURCE_PHEROMONE
local AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION = constants.AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION
local AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION = constants.AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION
local AI_SQUAD_COST = constants.AI_SQUAD_COST
local AI_SETTLER_COST = constants.AI_SETTLER_COST
local AI_MAX_SQUAD_COUNT = constants.AI_MAX_SQUAD_COUNT
local AI_VENGENCE_SQUAD_COST = constants.AI_VENGENCE_SQUAD_COST
local AI_STATE_AGGRESSIVE = constants.AI_STATE_AGGRESSIVE
local INTERVAL_RALLY = constants.INTERVAL_RALLY
@ -50,6 +55,8 @@ local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
-- imported functions
local randomTickEvent = mathUtils.randomTickEvent
local mRandom = math.random
local positionFromDirectionAndChunk = mapUtils.positionFromDirectionAndChunk
@ -250,7 +257,7 @@ function aiAttackWave.formVengenceSquad(map, surface, natives, chunk)
return (natives.points - AI_VENGENCE_SQUAD_COST) > 0
end
function aiAttackWave.formSquads(map, surface, natives, chunk)
function aiAttackWave.formSquads(map, surface, natives, chunk, tick)
if attackWaveValidCandidate(chunk, natives, map) and
(mRandom() < natives.formSquadThreshold) and
(#natives.squads < AI_MAX_SQUAD_COUNT)
@ -280,6 +287,12 @@ function aiAttackWave.formSquads(map, surface, natives, chunk)
if (foundUnits > 0) then
natives.pendingAttack[#natives.pendingAttack+1] = squad
natives.points = natives.points - AI_SQUAD_COST
if tick and (natives.state == AI_STATE_AGGRESSIVE) then
natives.canAttackTick = randomTickEvent(tick,
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
return false
end
else
if (squad.group.valid) then
squad.group.destroy()

View File

@ -21,6 +21,8 @@ local AI_STATE_MIGRATING = constants.AI_STATE_MIGRATING
local AI_STATE_ONSLAUGHT = constants.AI_STATE_ONSLAUGHT
local AI_STATE_SIEGE = constants.AI_STATE_SIEGE
local AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION = constants.AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION
local AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION = constants.AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION
local AI_UNIT_REFUND = constants.AI_UNIT_REFUND
@ -103,6 +105,9 @@ function aiPlanning.planning(natives, evolution_factor, tick)
roll = mRandom()
if (roll < 0.65) then
natives.state = AI_STATE_AGGRESSIVE
natives.canAttackTick = randomTickEvent(tick,
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
elseif ((natives.enabledMigration) and (natives.expansion) and (roll < 0.75)) then
natives.state = AI_STATE_MIGRATING
elseif ((natives.siegeAIToggle) and (natives.expansion) and (roll < 0.80)) then

View File

@ -30,6 +30,7 @@ function aiPredicates.canMigrate(natives, surface)
return ((natives.state == AI_STATE_MIGRATING) or
(natives.state == AI_STATE_SIEGE))
and natives.expansion
and not surface.peaceful_mode
and ((not natives.aiNocturnalMode) or
(natives.aiNocturnalMode and surface.darkness > 0.65))
end

View File

@ -132,6 +132,9 @@ constants.BASE_AI_STATE_OVERDRIVE = 4
constants.BASE_AI_STATE_MUTATE = 5
constants.AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION = 1
constants.AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION = 3
constants.AI_MIN_STATE_DURATION = 7
constants.AI_MAX_STATE_DURATION = 17
constants.AI_MIN_TEMPERAMENT_DURATION = 25

View File

@ -33,6 +33,7 @@ local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
local AI_SQUAD_COST = constants.AI_SQUAD_COST
local AI_VENGENCE_SQUAD_COST = constants.AI_VENGENCE_SQUAD_COST
local AI_SETTLER_COST = constants.AI_SETTLER_COST
local AI_STATE_AGGRESSIVE = constants.AI_STATE_AGGRESSIVE
local RAIDING_MINIMUM_BASE_THRESHOLD = constants.RAIDING_MINIMUM_BASE_THRESHOLD
@ -124,6 +125,9 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
local scentStaging = map.scentStaging
local squads = canAttack(natives, surface) and (0.11 <= roll) and (roll <= 0.35) and (natives.points >= AI_SQUAD_COST)
if squads and (natives.state == AI_STATE_AGGRESSIVE) and (tick < natives.canAttackTick) then
squads = false
end
local settlers = canMigrate(natives, surface) and (0.90 <= roll) and (natives.points >= AI_SETTLER_COST)
local processQueue = map.processQueue
@ -136,7 +140,7 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
processPheromone(map, chunk, scentStaging[i])
if squads then
squads = formSquads(map, surface, natives, chunk)
squads = formSquads(map, surface, natives, chunk, tick)
end
if settlers and (getNestCount(map, chunk) > 0) then
settlers = formSettlers(map, surface, natives, chunk, tick)

View File

@ -35,7 +35,8 @@ function mathUtils.roundToNearest(number, multiple)
end
function mathUtils.randomTickEvent(tick, low, high)
local minutesToTick = mMax(high * mRandom(), low)
local range = high - low
local minutesToTick = (range * mRandom()) + low
local nextTick = mathUtils.roundToNearest(TICKS_A_MINUTE * minutesToTick, INTERVAL_LOGIC)
return tick + nextTick
end

View File

@ -12532,7 +12532,7 @@ rampant-newEnemyNestTiers=This number corresponds to number of tiers. The higher
rampant-newEnemyWormVariations=This number corresponds to the number of variations per tier. This adds randominess to each tier. Min 1, Max 20
rampant-newEnemyWormTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve. Enemy level for the tiers start at the enemy level and increase linearly till the end level. The default tier of 5 with enemy levels 1-4 will create the set (1,2,3,3,4). See enemy levels for rough health approximation of each level.
rampant-newEnemyUnitVariations=This number corresponds to the number of variations per tier. This adds randominess to each tier. Min 1, Max 20
rampant-newEnemyUnitTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve. Enemy level for the tiers start at the enemy level and increase linearly till the end level. The default tier of 5 with enemy levels 1-4 will create the set (1,2,3,3,4). See enemy levels for rough health approximation of each level.
rampant-newEnemyUnitTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve. Enemy level for the tiers start at the enemy level and increase linearly till the end level. The default tier of 5 with enemy levels 1-4 will create the set (1,2,3,3,4). See enemy levels for rough health approximation of each level. This is recommended to be 10.
rampant-enableBobsUnits=Adds bobs spawners, units, and worms to the base upgrade and placement list
rampant-enableNEUnits=Adds NE spawners, units, and worms to the base upgrade and placement list
rampant-disallowFriendlyFire=Prevents enemy spitters and worms from damaging units or buildings from the same force through splash damage

View File

@ -373,7 +373,7 @@ local function addUnitDefaults(template, upgrades)
[9] = 1.4,
[10] = 1.5
})
elseif (template.type == "spitter") then
pushUpgrade(upgrades,
{
@ -803,14 +803,14 @@ local function addUnitSpawnerDefaults(template, upgrades)
type = "resistance",
name = "physical",
decrease = {
[1] = 2,
[1] = 1,
[2] = 2,
[3] = 4,
[3] = 3,
[4] = 4,
[5] = 6,
[6] = 6,
[7] = 10,
[8] = 12,
[7] = 8,
[8] = 10,
[9] = 12,
[10] = 14
},
@ -990,8 +990,8 @@ local function addWormDefaults(template, upgrades)
[8] = 1.3,
[9] = 1.4,
[10] = 1.4
})
})
pushUpgrade(upgrades,
{
type = "attribute",
@ -1023,7 +1023,7 @@ local function addWormDefaults(template, upgrades)
[9] = 39,
[10] = 40
})
pushUpgrade(upgrades,
{
type = "resistance",
@ -1199,95 +1199,138 @@ local function addWormDefaults(template, upgrades)
})
end
local function fillUnitTable(result, unitSet, tier, probability)
for x=1,#unitSet[tier] do
result[#result+1] = {unitSet[tier][x], probability}
end
end
local function unitSetToProbabilityTable(unitSet, tier)
local dividers = {}
-- local dividers = {}
for i=1,#unitSet do
dividers[i] = 1
end
local points = #unitSet * 2
for _=1,points do
local index
if (tier == 1) then
index = mFloor(gaussianRandomRangeRG(tier, 1.3, 1, 2.5, xorRandom))
else
index = mFloor(gaussianRandomRangeRG(tier, 2, tier * 0.1, mMin(tier * 1.1, #unitSet), xorRandom)+1)
end
dividers[index] = dividers[index] + (((index < tier) and 4) or 1)
end
local total = 0
for i=1,#dividers do
total = total + dividers[i]
end
local runningTotal = 0
for i=1,#dividers do
runningTotal = runningTotal + (dividers[i] / total)
dividers[i] = runningTotal
end
local stepUnit = 1 / (#unitSet[1] + 1)
local probabilityTable = {}
for i=1,#unitSet do
local result
if (i == 1) then
result = {
{
0,
stepUnit
},
{
dividers[i],
0
}
}
elseif (i == #unitSet) then
result = {
{
dividers[i-2],
0
},
{
1,
stepUnit
}
}
else
result = {
{
((i - 2) > 0 and dividers[i-2]) or (dividers[i-1] * 0.4),
0
},
{
dividers[i-1],
stepUnit
},
{
dividers[i],
0
}
}
end
probabilityTable[i] = result
end
-- for i=#unitSet,1,-1 do
-- dividers[i] = 0.
-- end
local result = {}
for i=1, #probabilityTable do
local probability = probabilityTable[i]
for x=1, #unitSet[i] do
result[#result+1] = {unitSet[i][x], probability}
end
if (#unitSet == 10) then
-- dividers[10] = 0.05
-- dividers[9] = 0.05
-- dividers[8] = 0.05
-- dividers[7] = 0.05
-- dividers[6] = 0.10
-- dividers[5] = 0.10
-- dividers[4] = 0.10
-- dividers[3] = 0.10
-- dividers[2] = 0.10
-- dividers[1] = 0.30
fillUnitTable(result, unitSet, 1, {{0, 1}, {0.35, 0.0}})
fillUnitTable(result, unitSet, 2, {{0.3, 0}, {0.35, 0.5}, {0.45, 0.0}})
fillUnitTable(result, unitSet, 3, {{0.4, 0}, {0.45, 0.5}, {0.55, 0.0}})
fillUnitTable(result, unitSet, 4, {{0.5, 0}, {0.55, 0.5}, {0.65, 0.0}})
fillUnitTable(result, unitSet, 5, {{0.6, 0}, {0.65, 0.5}, {0.75, 0.0}})
fillUnitTable(result, unitSet, 6, {{0.7, 0}, {0.75, 0.5}, {0.85, 0.0}})
fillUnitTable(result, unitSet, 7, {{0.8, 0}, {0.825, 0.5}, {0.875, 0.0}})
fillUnitTable(result, unitSet, 8, {{0.85, 0}, {0.875, 0.5}, {0.925, 0.0}})
fillUnitTable(result, unitSet, 9, {{0.90, 0}, {0.925, 0.5}, {0.975, 0.0}})
fillUnitTable(result, unitSet, 10, {{0.93, 0}, {1, 1.0}})
else
-- dividers[5] = 0.15
-- dividers[4] = 0.15
-- dividers[3] = 0.20
-- dividers[2] = 0.20
-- dividers[1] = 0.40
fillUnitTable(result, unitSet, 1, {{0, 1}, {0.45, 0.0}})
fillUnitTable(result, unitSet, 2, {{0.4, 0}, {0.5, 0.5}, {0.65, 0.0}})
fillUnitTable(result, unitSet, 3, {{0.6, 0}, {0.7, 0.5}, {0.75, 0.0}})
fillUnitTable(result, unitSet, 4, {{0.70, 0}, {0.775, 0.5}, {0.95, 0.0}})
fillUnitTable(result, unitSet, 5, {{0.9, 0}, {1, 1}})
end
-- local points = #unitSet * 2
-- for _=1,points do
-- local index
-- if (tier == 1) then
-- index = mFloor(gaussianRandomRangeRG(tier, 1.3, 1, 2.5, xorRandom))
-- else
-- index = mFloor(gaussianRandomRangeRG(tier, 2, tier * 0.1, mMin(tier * 1.1, #unitSet), xorRandom)+1)
-- end
-- dividers[index] = dividers[index] + (((index < tier) and 4) or 1)
-- end
-- local total = 0
-- for i=1,#dividers do
-- total = total + dividers[i]
-- end
-- local runningTotal = 0
-- for i=1,#dividers do
-- runningTotal = runningTotal + (dividers[i] / total)
-- dividers[i] = runningTotal
-- end
-- local stepUnit = 1 / (#unitSet[1] + 1)
-- local probabilityTable = {}
-- for i=1,#unitSet do
-- local result
-- if (i == 1) then
-- result = {
-- {
-- 0,
-- stepUnit
-- },
-- {
-- dividers[i],
-- 0
-- }
-- }
-- elseif (i == #unitSet) then
-- result = {
-- {
-- dividers[i-2],
-- 0
-- },
-- {
-- 1,
-- stepUnit
-- }
-- }
-- else
-- result = {
-- {
-- ((i - 2) > 0 and dividers[i-2]) or (dividers[i-1]) * 0.95,
-- 0
-- },
-- {
-- dividers[i-1],
-- stepUnit
-- },
-- {
-- dividers[i],
-- 0
-- }
-- }
-- end
-- probabilityTable[i] = result
-- end
-- local result = {}
-- for i=1, #probabilityTable do
-- local probability = probabilityTable[i]
-- for x=1, #unitSet[i] do
-- result[#result+1] = {unitSet[i][x], probability}
-- end
-- end
return result
end
@ -1376,7 +1419,7 @@ local function scaleAttributes (upgrade, entity)
end
if (upgrade.name == "damagePerTick") then
entity.attack[upgrade.name] = entity.attack[upgrade.name] * settings.startup["rampant-unitDroneDamageScaler"].value
end
end
if (upgrade.name == "range") then
entity.attack[upgrade.name] = entity.attack[upgrade.name] * settings.startup["rampant-unitDroneRangeScaler"].value
end
@ -1539,7 +1582,7 @@ function swarmUtils.buildUnits(template, attackGenerator, upgradeTable, variatio
unit.attributes,
attackGenerator(unit.attack, unit.attributes, t),
unit.resistances)
elseif (unit.type == "drone") then
elseif (unit.type == "drone") then
entity = makeDrone(unit.name,
unit.attributes,
unit.resistances,
@ -1614,7 +1657,7 @@ function swarmUtils.buildUnitSpawner(templates, upgradeTable, attackGenerator, v
end
-- ent()
end
function swarmUtils.buildWorm(template, upgradeTable, attackGenerator, variations, tiers)

View File

@ -109,7 +109,6 @@ data:extend({
per_user = false
},
{
type = "bool-setting",
name = "rampant-safeBuildings-straightRail",
@ -269,7 +268,7 @@ data:extend({
name = "rampant-newEnemyUnitTiers",
description = "rampant-newEnemyUnitTiers",
setting_type = "startup",
default_value = 5,
default_value = 10,
allowed_values = { 5, 10 },
order = "l[modifer]-g[unit]",
per_user = false