1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-26 03:20:07 +02:00

reduced collision box sizes and reduced memory footprint more

This commit is contained in:
Aaron Veden 2017-11-26 14:10:56 -08:00
parent 4f4945971b
commit 3b33cc3af0
22 changed files with 76 additions and 48 deletions

View File

@ -7,9 +7,6 @@ https://forums.factorio.com/viewtopic.php?f=94&t=31445
# Notes
When playing on low sprite resolution, item collector range will appear to be less than it is. (By roughly a half chunk on all sides)
This is due to the max sprite size being 2048px on low and 4096px on high resolution.
0.14.14 factorio version fixed save corruption
0.14.10 factorio version fixed more pathing issues
0.14.4 factorio version fixed some issues with unit groups commands
@ -27,7 +24,6 @@ If experiencing desyncs, after an update, please do the following:
Configure Options not in game menu:
- Ramp up to max biter wave size
# Features
- Difficulty Scaling - A mod option to control how quickly the ai can perform actions like making attack waves.

View File

@ -1,5 +1,16 @@
local vanillaBuildings = require("prototypes/buildings/UpdatesVanilla")
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 = {
{unit.collision_box[1][1] * 0.40, unit.collision_box[1][2] * 0.40},
{unit.collision_box[2][1] * 0.40, unit.collision_box[2][2] * 0.40}
}
end
end
end
if settings.startup["rampant-addWallResistanceAcid"].value then
vanillaBuildings.addWallAcidResistance()
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

View File

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

View File

@ -114,10 +114,9 @@ local function addEnemyStructureToChunk(regionMap, chunk, entity, base)
local entityCollection = lookup[chunk]
if not entityCollection then
entityCollection = {}
lookup[chunk] = entityCollection
lookup[chunk] = 0
end
entityCollection[#entityCollection+1] = entity
lookup[chunk] = lookup[chunk] + 1
-- if base then
-- local baseCollection = regionMap.chunkToBases[chunk]
@ -127,6 +126,7 @@ local function addEnemyStructureToChunk(regionMap, chunk, entity, base)
-- end
-- baseCollection[base.id] = chunk
-- end
end
local function removeEnemyStructureFromChunk(regionMap, chunk, entity)
@ -138,6 +138,7 @@ local function removeEnemyStructureFromChunk(regionMap, chunk, entity)
else
return
end
-- local base = indexChunk[entity.unit_number]
-- local indexBase
-- if base then
@ -152,15 +153,9 @@ local function removeEnemyStructureFromChunk(regionMap, chunk, entity)
-- end
-- indexBase[entity.unit_number] = nil
-- end
local collection = lookup[chunk]
if collection then
for i=1,#collection do
local e = collection[i]
if e.valid and (e == entity) then
table.remove(collection, i)
break
end
end
if lookup[chunk] then
lookup[chunk] = lookup[chunk] - 1
end
end
@ -304,13 +299,11 @@ function chunkUtils.registerChunkEnemies(regionMap, chunk, surface, tempQuery)
end
function chunkUtils.getNestCount(regionMap, chunk)
local nests = regionMap.chunkToNests[chunk]
return (nests and #nests) or 0
return regionMap.chunkToNests[chunk] or 0
end
function chunkUtils.getWormCount(regionMap, chunk)
local worms = regionMap.chunkToWorms[chunk]
return (worms and #worms) or 0
return regionMap.chunkToWorms[chunk] or 0
end
function chunkUtils.getRetreatTick(regionMap, chunk)

View File

@ -12,24 +12,6 @@ small-fire-spitter=Small Fire Spitter
biter-spawner-hive-rampant=Small Hive
small-tendril-biter-rampant=Small Tendril
item-collector-base-rampant=Item Collector
item-collector-base-overlay-rampant=Item Collector
item-collector-chest-rampant=Item Collector Storage
[item-description]
item-collector-base-rampant=Scans the area surrounding this chest and collects the items on the ground. When low resolution sprites are being used the visual display will be a half chunk less then what is actually collected
[item-name]
item-collector-base-rampant=Item Collector
[recipe-name]
item-collector-base-rampant=Item Collector
[technology-name]
short-range-electrodynamics-1-rampant=Short-range Electrodynamics
[technology-description]
short-range-electrodynamics-1-rampant=Buildings that generate strong electromagnetic fields
[entity-description]
tunnel-entrance-rampant=This tunnel is used by the biters to bypass player defenses. Fill the hole using landfill.
@ -44,9 +26,6 @@ small-fire-spitter=These biters will spit fire
biter-spawner-hive-rampant=Small Hive
small-tendril-biter-rampant=Small Tendril
item-collector-base-rampant=Scans the surrounding area for items on the ground, if any items are found they are pulled into the storage chest when the sector is finished scanning.
item-collector-base-overlay-rampant=Scans the surrounding area for items on the ground, if any items are found they are pulled into the storage chest when the sector is finished scanning. When low resolution sprites are being used the visual display will be a half chunk less then what is actually collected
item-collector-chest-rampant=Stores the items the scanner finds on the ground around this collector
[mod-setting-name]
rampant-useDumbProjectiles=Use Dumb Projectiles
@ -70,8 +49,9 @@ rampant-addWallResistanceAcid=Increase wall resistance to spitters
rampant-useCustomAI=Use Custom AI (Alpha)
rampant-safeBuildings-lamps=Make lamps safe from biters
rampant-removeBloodParticles=Remove blood particles (Reduces lag spikes)
rampant-enableBuildings=Enable buildings and Technology
# rampant-enableBuildings=Enable buildings and Technology
rampant-attack-warning=Enable attack wave warnings
rampant-enableSwarm=Enable the swarm
[mod-setting-description]
rampant-useDumbProjectiles=Turns off homing projectiles for worms and spitters
@ -95,5 +75,6 @@ rampant-aiPointsScaler=Between 0.0 and 5.0. This scales how many action points t
rampant-addWallResistanceAcid=Toggling this will cause a %60 acid resistance to be added to all wall entities to reduce the damage done by spitters to walls back to vanilla levels.
rampant-useCustomAI=Having this enabled will completely remove the vanilla ai and change how biters build, produce units, and attack.
rampant-removeBloodParticles=The blood particles that are created when biters are being killed can cause UPS spikes, this removes them.
rampant-enableBuildings=Enable buildings and technologies rampant offers
# rampant-enableBuildings=Enable buildings and technologies rampant offers
rampant-enableSwarm=This reduces the size of the unit collision_mask causing them to reduce pathing collisions and smooth out the attacks
rampant-attack-warning=Shows a message warning players that an attack wave is incoming

View File

@ -200,8 +200,18 @@ data:extend({
description = "rampant-attack-warning",
setting_type = "runtime-per-user",
default_value = true,
order = "a",
order = "j[modifer]-a[message]",
per_user = true
},
{
type = "bool-setting",
name = "rampant-enableSwarm",
description = "rampant-enableSwarm",
setting_type = "startup",
default_value = true,
order = "k[modifier]-a[unit]",
per_user = false
}
-- {

View File

@ -49,9 +49,46 @@ end
function tests.activeSquads()
print("--")
for i=1, #global.natives.squads do
print("-")
local squad = global.natives.squads[i]
local squadHealth = 0
local squadMakeup = {}
local squadResistances = {}
if squad.group.valid then
print(math.floor(squad.group.position.x * 0.03125), math.floor(squad.group.position.y * 0.03125), squad.status, squad.group.state, #squad.group.members)
for x=1,#squad.group.members do
local member = squad.group.members[x].prototype
if not squadMakeup[member.name] then
squadMakeup[member.name] = 0
end
local resistances = member.resistances
if resistances then
for key,resistance in pairs(resistances) do
local pack = squadResistances[key]
if not pack then
pack = {}
squadResistances[key] = pack
end
if resistance.percent then
if (pack.percent == nil) then
pack.percent = 0
end
pack.percent = pack.percent + resistance.percent
end
if resistance.decrease then
if (pack.decrease == nil) then
pack.decrease = 0
end
pack.decrease = pack.decrease + resistance.decrease
end
end
end
squadHealth = squadHealth + member.max_health
squadMakeup[member.name] = squadMakeup[member.name] + 1
end
print(math.floor(squad.group.position.x * 0.03125), math.floor(squad.group.position.y * 0.03125), squad.status, squad.group.state, #squad.group.members, squadHealth)
print(serpent.dump(squadResistances))
print(serpent.dump(squadMakeup))
print(serpent.dump(squad))
end
end
@ -123,8 +160,8 @@ end
function tests.registeredNest(x)
local entity = tests.createEnemy(x)
chunk.registerEnemyBaseStructure(global.regionMap,
entity,
nil)
entity,
nil)
end
function tests.attackOrigin()