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

see readme

This commit is contained in:
Aaron Veden 2016-11-04 00:26:19 -07:00
parent 79fa92d701
commit 2639741d06
7 changed files with 53 additions and 22 deletions

View File

@ -1,5 +1,5 @@
# Rampant Tactics
Factorio Mod - Improves the enemies tactics by using potential fields/pheromones allowing probing of defenses, retreats, and player hunting
Factorio Mod - Improves the enemies tactics by using potential fields/pheromones allowing probing of defenses, retreats, reinforcements, counterattacking, and player hunting
# Forum Post
@ -21,7 +21,9 @@ Tactical Retreats - these will take place when a unit group is in a chunk that h
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
Player Hunting - unit groups will track the player based on there emitted pheromone cloud
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
@ -34,11 +36,17 @@ Base Expansion
# Version History
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
- 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
0.14.6 -
- Major Fix: Corrected retreat logic having inverted comparison introduced in 14.4, so unit groups stopped retreating after lots of death happened in a chunk
- Major Fix: Corrected pheromone dispersal with negative numbers
- Fix: Adjusted scoring so unit groups try to avoid nest clusters when retreating (Messes up pathfinding)
- Fix: When placing a player building gave credit to enemy as if they destroyed it
- Fix: When placing a player building ai was given credit as if they destroyed it
- Tweak: Reduced retreat time length from 4.5 to 3 seconds
- Tweak: Reduced death pheromone produced on death from 100 to 75
- Tweak: Increased attack radius of unit groups from 16 to 20 tiles

View File

@ -107,7 +107,7 @@ local function onConfigChanged()
-- needs to be on inner logic tick loop interval
natives.stateTick = roundToNearest(game.tick + INTERVAL_LOGIC, INTERVAL_LOGIC)
natives.temperamentTick = roundToNearest(game.tick + INTERVAL_LOGIC, INTERVAL_LOGIC)
global.version = constants.VERSION_11
end
if (global.version < constants.VERSION_12) then
@ -212,7 +212,7 @@ end
local function onSurfaceTileChange(event)
-- local player = game.players[event.player_index]
-- if (player.surface.index==1) then
-- aiBuilding.fillTunnel(global.regionMap, player.surface, global.natives, event.positions)
-- aiBuilding.fillTunnel(global.regionMap, player.surface, global.natives, event.positions)
-- end
end
@ -239,10 +239,10 @@ script.on_event(defines.events.on_player_built_tile, onSurfaceTileChange)
script.on_event({defines.events.on_preplayer_mined_item,
defines.events.on_robot_pre_mined},
onPickUp)
onPickUp)
script.on_event({defines.events.on_built_entity,
defines.events.on_robot_built_entity},
onBuild)
onBuild)
script.on_event(defines.events.on_entity_died, onDeath)
script.on_event(defines.events.on_tick, onTick)

View File

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

View File

@ -20,6 +20,7 @@ local ENEMY_BASE_GENERATOR = constants.ENEMY_BASE_GENERATOR
local AI_MAX_SQUAD_COUNT = constants.AI_MAX_SQUAD_COUNT
local AI_SQUAD_COST = constants.AI_SQUAD_COST
local AI_VENGENCE_SQUAD_COST = constants.AI_VENGENCE_SQUAD_COST
local HALF_CHUNK_SIZE = constants.HALF_CHUNK_SIZE
local CHUNK_SIZE = constants.CHUNK_SIZE
@ -116,9 +117,14 @@ function aiBuilding.scouting(regionMap, natives)
--]]
end
function aiBuilding.formSquads(regionMap, surface, natives, chunk, evolution_factor)
if (natives.points > AI_SQUAD_COST) and (chunk[ENEMY_BASE_GENERATOR] ~= 0) and (#natives.squads < (AI_MAX_SQUAD_COUNT * evolution_factor)) then
local valid = attackWaveValidCandidate(chunk, surface, evolution_factor)
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 valid and (math.random() < mMax((0.25 * evolution_factor), 0.10)) then
local squadPosition = {x=0, y=0}
local squadPath, squadScore = scoreNeighbors(chunk,
@ -129,12 +135,12 @@ function aiBuilding.formSquads(regionMap, surface, natives, chunk, evolution_fac
surface,
squadPosition,
false)
if (squadPath ~= nil) and (squadScore > 0) then
if (squadPath ~= nil) then
squadPosition.x = squadPath.pX + HALF_CHUNK_SIZE
squadPosition.y = squadPath.pY + HALF_CHUNK_SIZE
local squad = createSquad(squadPosition, surface, natives)
if (math.random() < 0.03) then
squad.rabid = true
end
@ -146,7 +152,7 @@ function aiBuilding.formSquads(regionMap, surface, natives, chunk, evolution_fac
unit_count = scaledWaveSize,
unit_search_distance = (CHUNK_SIZE * 3)})
if (foundUnits > 0) then
natives.points = natives.points - AI_SQUAD_COST
natives.points = natives.points - cost
end
end
end

View File

@ -28,12 +28,13 @@ constants.INTERVAL_LOGIC = 40
constants.AI_POINT_GENERATOR_AMOUNT = 6
constants.AI_SCOUT_COST = 45
constants.AI_SQUAD_COST = 175
constants.AI_VENGENCE_SQUAD_COST = 50
constants.AI_SETTLER_COST = 75
constants.AI_BASE_BUILDING_COST = 500
constants.AI_TUNNEL_COST = 100
constants.AI_MAX_POINTS = 10000
constants.AI_MAX_SQUAD_COUNT = 30
constants.AI_MAX_SQUAD_COUNT = 40
constants.AI_STATE_PEACEFUL = 1
constants.AI_STATE_AGGRESSIVE = 2

View File

@ -11,6 +11,9 @@ local mapUtils = require("MapUtils")
local PROCESS_QUEUE_SIZE = constants.PROCESS_QUEUE_SIZE
local ENEMY_BASE_PHEROMONE_GENERATOR_AMOUNT = constants.ENEMY_BASE_PHEROMONE_GENERATOR_AMOUNT
local RETREAT_MOVEMENT_PHEROMONE_LEVEL = constants.RETREAT_MOVEMENT_PHEROMONE_LEVEL
local SCAN_QUEUE_SIZE = constants.SCAN_QUEUE_SIZE
local CHUNK_SIZE = constants.CHUNK_SIZE
@ -20,6 +23,11 @@ local AI_STATE_AGGRESSIVE = constants.AI_STATE_AGGRESSIVE
local PROCESS_PLAYER_BOUND = constants.PROCESS_PLAYER_BOUND
local CHUNK_TICK = constants.CHUNK_TICK
local AI_SQUAD_COST = constants.AI_SQUAD_COST
local AI_VENGENCE_SQUAD_COST = constants.AI_VENGENCE_SQUAD_COST
local MOVEMENT_PHEROMONE = constants.MOVEMENT_PHEROMONE
-- imported functions
local scents = pheromoneUtils.scents
@ -88,7 +96,7 @@ function mapProcessor.processMap(regionMap, surface, natives, evolution_factor)
makeScouts(surface, natives, chunk, evolution_factor)
end
if squads then
formSquads(regionMap, surface, natives, chunk, evolution_factor)
formSquads(regionMap, surface, natives, chunk, evolution_factor, AI_SQUAD_COST)
end
processPheromone(regionMap, chunk)
@ -114,6 +122,7 @@ function mapProcessor.processPlayers(players, regionMap, surface, natives, evolu
local scouts = false
local squads = false
local vengenceThreshold = -(evolution_factor * RETREAT_MOVEMENT_PHEROMONE_LEVEL)
local roll = math.random()
if (0.05 <= roll) and (roll <= 0.7) then
@ -142,19 +151,26 @@ function mapProcessor.processPlayers(players, regionMap, surface, natives, evolu
local playerChunk = getChunkByPosition(regionMap, playerPosition.x, playerPosition.y)
if (playerChunk ~= nil) then
local vengence = false
if (playerChunk[ENEMY_BASE_GENERATOR] ~= 0) or (playerChunk[MOVEMENT_PHEROMONE] < vengenceThreshold) then
vengence = true
end
for x=playerChunk.cX - PROCESS_PLAYER_BOUND, playerChunk.cX + PROCESS_PLAYER_BOUND do
for y=playerChunk.cY - PROCESS_PLAYER_BOUND, playerChunk.cY + PROCESS_PLAYER_BOUND do
local chunk = getChunkByIndex(regionMap, x, y)
if (chunk ~= nil) and (chunk[CHUNK_TICK] ~= tick) then
chunk[CHUNK_TICK] = tick
scents(chunk)
if scouts then
makeScouts(surface, natives, chunk, evolution_factor)
end
if squads then
formSquads(regionMap, surface, natives, chunk, evolution_factor)
formSquads(regionMap, surface, natives, chunk, evolution_factor, AI_SQUAD_COST)
end
if vengence then
formSquads(regionMap, surface, natives, chunk, evolution_factor, AI_VENGENCE_SQUAD_COST)
end
processPheromone(regionMap, chunk)

View File

@ -73,8 +73,8 @@
(copyDirectory "graphics" modFolder)
(copyDirectory "prototypes" modFolder)))
(copyFiles modFolder)
;; (copyFiles modFolder)
;; (copyFiles zipModFolder)
;;(makeZip modFolder)
(makeZip modFolder)
;;(makeZip zipModFolder)
)