Page 1 of 1
Let graphic-tweak mods not demand multiplayer synch
Posted: Sat Apr 23, 2016 5:19 pm
by Taehl
Hard to fit all that in the title, sorry. But what I mean is, currently, if anyone makes a mod which only changes some graphics (like updated icons or that bright-colors terrain one), Factorio sees this as "making a change to game state" which requires everyone else in a multiplayer game to have the same mod. Since these mods don't change gameplay, why would one person having a dark monitor necessitate every player to have brighter graphics?
Currently, the only way I know of around this is to take the graphics from the mod(s) and overwrite Factorio's default images. That's a horrible way to do it. I'm not sure how this change would fit with the data.raw schema... Perhaps it would better if Factorio, like many other games, automatically updates default images to mods' images* when they have an identical name and folder structure? I mean, if the mod has the file /graphics/icons/basic-mining-drill.png but no .lua files, it would be safe to assume the mod just wants to update the graphic (and having no code prevents changing game state!).
The only real argument I can think of against allowing such easy graphics swaps is that someone might replace enemy graphics with super-visible red circles and run an aimbot or something... But you already auto-aim in Factorio.
*It should probably do a few other file types too, for sounds and whatnot. Perhaps any audio files placed in sound/music likewise get loaded and added to the playlist with no code required.
Re: Let graphic-tweak mods not demand multiplayer synch
Posted: Sun Apr 24, 2016 7:13 am
by Koub
I think it's already the case. the CRC check is only made on what would cause problems if non identical.
Yes, found it :
viewtopic.php?p=145702#p145702
Re: Let graphic-tweak mods not demand multiplayer synch
Posted: Sun Apr 24, 2016 11:13 pm
by ssilk
It means, that the sizes etc. needs to be exactly the same, just the bitmaps (the linked picure-files) can change.
Re: Let graphic-tweak mods not demand multiplayer synch
Posted: Mon Apr 25, 2016 7:52 am
by bobingabout
I think the issue is that the graphics are defined in the data files, under animation. Although it shouldn't change anything in game except the graphics.
Re: Let graphic-tweak mods not demand multiplayer synch
Posted: Tue Apr 26, 2016 4:46 am
by Taehl
Here's an example of what I mean:
- Shows icon change mod requiring synch
- synch-needed.png (185.96 KiB) Viewed 2638 times
Here's the complete code for IconFix (in data-updates.lua):
Code: Select all
local dat = data.raw
dat.item["basic-mining-drill"].icon = "__IconFix__/graphics/icons/basic-mining-drill.png"
dat.item["solar-panel"].icon = "__IconFix__/graphics/icons/solar-panel.png"
dat.item["steel-chest"].icon = "__IconFix__/graphics/icons/steel-chest.png"
dat.container["steel-chest"].picture.filename = "__IconFix__/graphics/entity/steel-chest.png"
dat.blueprint["blueprint"].icon = "__IconFix__/graphics/icons/blueprint.png"
dat["deconstruction-item"]["deconstruction-planner"].icon = "__IconFix__/graphics/icons/deconstruction-planner.png"
dat.item["construction-robot"].icon = "__IconFix__/graphics/icons/construction-robot.png"
dat.item["logistic-robot"].icon = "__IconFix__/graphics/icons/logistic-robot.png"
dat.item["flying-robot-frame"].icon = "__IconFix__/graphics/icons/flying-robot-frame.png"
dat.item["alien-artifact"].icon = "__IconFix__/graphics/icons/alien-artifact.png"
dat.item["battery"].icon = "__IconFix__/graphics/icons/battery.png"
dat.item["explosives"].icon = "__IconFix__/graphics/icons/explosives.png"
dat.capsule["defender-capsule"].icon = "__IconFix__/graphics/icons/defender-capsule.png"
dat.capsule["distractor-capsule"].icon = "__IconFix__/graphics/icons/distractor-capsule.png"
dat.capsule["destroyer-capsule"].icon = "__IconFix__/graphics/icons/destroyer-capsule.png"
dat.item["land-mine"].icon = "__IconFix__/graphics/icons/land-mine.png"
dat.item["gun-turret"].icon = "__IconFix__/graphics/icons/gun-turret.png"
dat.item["laser-turret"].icon = "__IconFix__/graphics/icons/laser-turret.png"
dat.item["car"].icon = "__IconFix__/graphics/icons/car.png"
dat.item["tank"].icon = "__IconFix__/graphics/icons/tank.png"
dat["movement-bonus-equipment"]["basic-exoskeleton-equipment"].sprite.filename = "__IconFix__/graphics/equipment/basic-exoskeleton-equipment.png"
dat.item["battery-equipment"].icon = "__IconFix__/graphics/icons/battery-equipment.png"
dat["battery-equipment"]["battery-equipment"].sprite.filename = "__IconFix__/graphics/equipment/battery-equipment.png"
dat.item["battery-mk2-equipment"].icon = "__IconFix__/graphics/icons/battery-mk2-equipment.png"
dat["battery-equipment"]["battery-mk2-equipment"].sprite.filename = "__IconFix__/graphics/equipment/battery-mk2-equipment.png"
dat.item["energy-shield-equipment"].icon = "__IconFix__/graphics/icons/energy-shield-equipment.png"
dat["energy-shield-equipment"]["energy-shield-equipment"].sprite.filename = "__IconFix__/graphics/equipment/energy-shield-equipment.png"
dat.item["energy-shield-mk2-equipment"].icon = "__IconFix__/graphics/icons/energy-shield-mk2-equipment.png"
dat["energy-shield-equipment"]["energy-shield-mk2-equipment"].sprite.filename = "__IconFix__/graphics/equipment/energy-shield-mk2-equipment.png"
dat.item["solar-panel-equipment"].icon = "__IconFix__/graphics/icons/solar-panel-equipment.png"
dat["solar-panel-equipment"]["solar-panel-equipment"].sprite.filename = "__IconFix__/graphics/equipment/solar-panel-equipment.png"
dat.item["fusion-reactor-equipment"].icon = "__IconFix__/graphics/icons/fusion-reactor-equipment.png"
dat["generator-equipment"]["fusion-reactor-equipment"].sprite.filename = "__IconFix__/graphics/equipment/fusion-reactor-equipment.png"
I think the issue is that Factorio (understandably) needs data.raw to be synchronized (that CRC check) for clients to have any hope of synching in multiplayer. So by having to update data.raw to change the graphics, the game wants it it synchronized.
(Incidentally, this synch-being-required thing even happens to a mod I'm making which does nothing but change the colors of things on the map)