Page 1 of 1

Game Limitations

Posted: Mon Oct 10, 2016 1:21 pm
by SoulForge
Can someone give me some more information on this error. I have a number of mods installed but I didn't think I was at this kinda wall yet;
14.428 Error Util.cpp:57: Reached id limit for equipment-grid. The game can't contain more than 255 instances of this prototype due to hardcoded limits of the engine.

Re: Game Limitations

Posted: Mon Oct 10, 2016 1:49 pm
by aubergine18
Looks like a mod has been creating crazy numbers of equipment item prototypes. Do you have any mods that add lots of equipments (or maybe lots of equipment tech upgrades)?

Re: Game Limitations

Posted: Mon Oct 10, 2016 2:00 pm
by SoulForge
I did just update Cursed-Exp-Remake_0.5.4. I didn't think it added anything like that.

Re: Game Limitations

Posted: Wed Oct 12, 2016 5:03 pm
by Rseding91
I'd be interested in known which mod is making so many different kinds of equipment grids and why if you do find out.

Re: Game Limitations

Posted: Wed Oct 12, 2016 7:15 pm
by daniel34
Cursed-Exp-Remake_0.5.4 (https://mods.factorio.com/mods/PhoNoThe ... Exp-Remake) creates 250 different armors in prototypes/items/cursed-armors.lua, the amount is defined in data.lua.

AFAIK it's a mod that allows you to get experience points by doing different tasks and lets you level up your character/equipment.
It probably works when used alone but if you use other mods that also add a few armors you hit the 255 limit.

Re: Game Limitations

Posted: Wed Oct 12, 2016 7:20 pm
by Rseding91
daniel34 wrote:Cursed-Exp-Remake_0.5.4 (https://mods.factorio.com/mods/PhoNoThe ... Exp-Remake) creates 250 different armors in prototypes/items/cursed-armors.lua, the amount is defined in data.lua.

AFAIK it's a mod that allows you to get experience points by doing different tasks and lets you level up your character/equipment.
It probably works when used alone but if you use other mods that also add a few armors you hit the 255 limit.
Is it actually making 250 different kinds of equipment grids or is it just making a new identical grid with different armor stats?

Re: Game Limitations

Posted: Wed Oct 12, 2016 7:34 pm
by Klonan
Rseding91 wrote:
daniel34 wrote:Cursed-Exp-Remake_0.5.4 (https://mods.factorio.com/mods/PhoNoThe ... Exp-Remake) creates 250 different armors in prototypes/items/cursed-armors.lua, the amount is defined in data.lua.

AFAIK it's a mod that allows you to get experience points by doing different tasks and lets you level up your character/equipment.
It probably works when used alone but if you use other mods that also add a few armors you hit the 255 limit.
Is it actually making 250 different kinds of equipment grids or is it just making a new identical grid with different armor stats?
Its doing some crazy stuff:

Code: Select all

local r = -- resistances starting level
{
	p = 1, -- physical
	a = 5, -- acid
	l = 10, -- laser
	e = 15, -- explosion
	i = 20, -- impact
	po = 25, -- poison
	f = 30 -- fire
}
local armordatos = {}
armordatos.minflat = 2.5 --flat reduction at lvl 1
armordatos.maxflat = 8 - armordatos.minflat -- flat reduction at level [ breakflatlevel ]
armordatos.maxmaxflat = 15 -- max flat reduction at level [ datos.maxarmor ]
armordatos.breakflatlevel = 50 -- break level, finish maxflat, starts maxmaxflat
armordatos.minperc = 20 -- percent reduction at lvl 1
armordatos.maxpercent = 50 - armordatos.minperc -- max percent reduction at level [ breakpercentlevel ]
armordatos.breakpercentlevel = 50 -- final level for percent reduction
armordatos.mingrid = 2 -- min grid :lol:
armordatos.maxgrid = 42 - armordatos.mingrid -- max grid

for i = 1, datos.maxarmor do

	local armor = util.table.deepcopy(data.raw["armor"]["modular-armor"])
	armor.name = "cursed-armor-" .. i
	local f = math.ceil(i * datos.maxarmorimg / datos.maxarmor)
	armor.icon = "__Cursed-Exp-Remake__/graphics/icons/armor/cursed-armor-" .. f .. ".jpg"
	armor.durability = 50000
	armor.subgroup = "cursed-armor"
	armor.order = "c-b"
	armor.stack_size = 1
    data:extend({{
    type = "equipment-grid",
    name = "cursed-equipment-grid-" .. i,
    width = math.floor(i * armordatos.maxgrid / 250) + armordatos.mingrid,
    height = math.floor(i * armordatos.maxgrid / 250) + armordatos.mingrid,
    equipment_categories = {"armor"}
    }})
	armor.equipment_grid = "cursed-equipment-grid-" .. i
	armor.resistances = {}
	if i >=  r.p then
		armor.resistances[#armor.resistances + 1] = {}
		armor.resistances[#armor.resistances].type = "physical"
		if i < armordatos.breakflatlevel then
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.p - 1)) * armordatos.maxflat / (armordatos.breakflatlevel - (r.p - 1))) * 100) / 100 + armordatos.minflat
		else
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.p - 1) - armordatos.breakflatlevel) * armordatos.maxmaxflat / (datos.maxarmor - (r.p - 1) - armordatos.breakflatlevel)) * 100) / 100 + armordatos.minflat + armordatos.maxflat
		end
		if i < armordatos.breakpercentlevel then 
			armor.resistances[#armor.resistances].percent = math.floor(((i - (r.p - 1)) * armordatos.maxpercent / (armordatos.breakpercentlevel - (r.p - 1)) ) * 100) / 100 + armordatos.minperc
		else
			armor.resistances[#armor.resistances].percent = armordatos.maxpercent + armordatos.minperc
		end
	end
	if i >= r.a then
		armor.resistances[#armor.resistances + 1] = {}
		armor.resistances[#armor.resistances].type = "acid"
		if i < armordatos.breakflatlevel then
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.a - 1)) * armordatos.maxflat / (armordatos.breakflatlevel - (r.a - 1))) * 100) / 100 + armordatos.minflat
		else
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.a - 1) - armordatos.breakflatlevel) * armordatos.maxmaxflat / (datos.maxarmor - (r.a - 1) - armordatos.breakflatlevel)) * 100) / 100 + armordatos.minflat + armordatos.maxflat
		end
		if i < armordatos.breakpercentlevel then 
			armor.resistances[#armor.resistances].percent = math.floor(((i - (r.a - 1)) * armordatos.maxpercent / (armordatos.breakpercentlevel - (r.a - 1)) ) * 100) / 100 + armordatos.minperc
		else
			armor.resistances[#armor.resistances].percent = armordatos.maxpercent + armordatos.minperc
		end
	end
	if i >= r.l then
		armor.resistances[#armor.resistances + 1] = {}
		armor.resistances[#armor.resistances].type = "laser"
		if i < armordatos.breakflatlevel then
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.l - 1)) * armordatos.maxflat / (armordatos.breakflatlevel - (r.l - 1))) * 100) / 100 + armordatos.minflat
		else
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.l - 1) - armordatos.breakflatlevel) * armordatos.maxmaxflat / (datos.maxarmor - (r.l - 1) - armordatos.breakflatlevel)) * 100) / 100 + armordatos.minflat + armordatos.maxflat
		end
		if i < armordatos.breakpercentlevel then 
			armor.resistances[#armor.resistances].percent = math.floor(((i - (r.l - 1)) * armordatos.maxpercent / (armordatos.breakpercentlevel - (r.l - 1)) ) * 100) / 100 + armordatos.minperc
		else 
			armor.resistances[#armor.resistances].percent = armordatos.maxpercent + armordatos.minperc
		end
	end
	if i >= r.e then
		armor.resistances[#armor.resistances + 1] = {}
		armor.resistances[#armor.resistances].type = "explosion"
		if i < armordatos.breakflatlevel then
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.e - 1)) * armordatos.maxflat / (armordatos.breakflatlevel - (r.e - 1))) * 100) / 100 + armordatos.minflat
		else
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.e - 1) - armordatos.breakflatlevel) * armordatos.maxmaxflat / (datos.maxarmor - (r.e - 1) - armordatos.breakflatlevel)) * 100) / 100 + armordatos.minflat + armordatos.maxflat
		end
		if i < armordatos.breakpercentlevel then 
			armor.resistances[#armor.resistances].percent = math.floor(((i - (r.e - 1)) * armordatos.maxpercent / (armordatos.breakpercentlevel - (r.e - 1)) ) * 100) / 100 + armordatos.minperc
		else 
			armor.resistances[#armor.resistances].percent = armordatos.maxpercent + armordatos.minperc
		end
	end
	if i >= r.i then
		armor.resistances[#armor.resistances + 1] = {}
		armor.resistances[#armor.resistances].type = "impact"
		if i < armordatos.breakflatlevel then
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.i - 1)) * armordatos.maxflat / (armordatos.breakflatlevel - (r.i - 1))) * 100) / 100 + armordatos.minflat
		else
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.i - 1) - armordatos.breakflatlevel) * armordatos.maxmaxflat / (datos.maxarmor - (r.i - 1) - armordatos.breakflatlevel)) * 100) / 100 + armordatos.minflat + armordatos.maxflat
		end
		if i < armordatos.breakpercentlevel then 
			armor.resistances[#armor.resistances].percent = math.floor(((i - (r.i - 1)) * armordatos.maxpercent / (armordatos.breakpercentlevel - (r.i - 1)) ) * 100) / 100 + armordatos.minperc
		else 
			armor.resistances[#armor.resistances].percent = armordatos.maxpercent + armordatos.minperc
		end
	end
	if i >= r.po then
		armor.resistances[#armor.resistances + 1] = {}
		armor.resistances[#armor.resistances].type = "poison"
		if i < armordatos.breakflatlevel then
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.po - 1)) * armordatos.maxflat / (armordatos.breakflatlevel - (r.po - 1))) * 100) / 100 + armordatos.minflat
		else
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.po - 1) - armordatos.breakflatlevel) * armordatos.maxmaxflat / (datos.maxarmor - (r.po - 1) - armordatos.breakflatlevel)) * 100) / 100 + armordatos.minflat + armordatos.maxflat
		end
		if i < armordatos.breakpercentlevel then 
			armor.resistances[#armor.resistances].percent = math.floor(((i - (r.po - 1)) * armordatos.maxpercent / (armordatos.breakpercentlevel - (r.po - 1)) ) * 100) / 100 + armordatos.minperc
		else
			armor.resistances[#armor.resistances].percent = armordatos.maxpercent + armordatos.minperc
		end
	end
	if i >= r.f then
		armor.resistances[#armor.resistances + 1] = {}
		armor.resistances[#armor.resistances].type = "fire"
		if i < armordatos.breakflatlevel then
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.f - 1)) * armordatos.maxflat / (armordatos.breakflatlevel - (r.f - 1))) * 100) / 100 + armordatos.minflat
		else
			armor.resistances[#armor.resistances].decrease = math.floor(((i - (r.f - 1) - armordatos.breakflatlevel) * armordatos.maxmaxflat / (datos.maxarmor - (r.f - 1) - armordatos.breakflatlevel)) * 100) / 100 + armordatos.minflat + armordatos.maxflat
		end
		if i < armordatos.breakpercentlevel then 
			armor.resistances[#armor.resistances].percent = math.floor(((i - (r.f - 1)) * armordatos.maxpercent / (armordatos.breakpercentlevel - (r.f - 1)) ) * 100) / 100 + armordatos.minperc
		else 
			armor.resistances[#armor.resistances].percent = armordatos.maxpercent + armordatos.minperc
		end
	end
	data.raw[armor.type][armor.name] = armor
end



Re: Game Limitations

Posted: Wed Oct 12, 2016 7:44 pm
by daniel34
It creates a new equipment grid for each armor, at level 1 the grid size is 2x2 which grows linearly until at level 250 it is 42x42. At level 50 for example it would be 10x10. Although it creates 250 equipment grids numbered 1 to 250 there are only ~40 distinct grids.

It also does something similar with all the resistances, it scales them with the level so each armor has different resistances.
It picks the icon for the armor from a pool of 110 different images it has, so that each image corresponds to 2 or 3 armors.