Alt-F4 #55 - The Dark Alleys of Modding

Post all other topics which do not belong to any other category.
Post Reply
AlternativeFFFF
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Fri Aug 28, 2020 12:07 pm
Contact:

Alt-F4 #55 - The Dark Alleys of Modding

Post by AlternativeFFFF »

For issue #55 of Alt-F4, stringweasel prepared a very special treat for everyone, getting various modders to talk about the deepest, dankest hacks they’ve come up with to make their mods work. We’ve got MagmaMcFry, raiguard, Deadlock989, Anachrony, PFQNiet, and Earendel all confessing their sins!

Continue reading: https://alt-f4.blog/ALTF4-55/

vjbone
Fast Inserter
Fast Inserter
Posts: 141
Joined: Sun Feb 14, 2016 10:02 am
Contact:

Re: Alt-F4 #55 - The Dark Alleys of Modding

Post by vjbone »

:o great post

mmmPI
Smart Inserter
Smart Inserter
Posts: 2675
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Alt-F4 #55 - The Dark Alleys of Modding

Post by mmmPI »

yes !

User avatar
MEOWMI
Filter Inserter
Filter Inserter
Posts: 307
Joined: Wed May 22, 2019 12:21 pm
Contact:

Re: Alt-F4 #55 - The Dark Alleys of Modding

Post by MEOWMI »

Very interesting stories. As a long-time modder for various games, engine limitations have always been a particularly tricky thing to deal with, but sometimes people come up with the most amazing solutions.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Alt-F4 #55 - The Dark Alleys of Modding

Post by Ranakastrasz »

For my Modular Armor Revamp mod, back when modular armor solar panels were terrible, I had two things I wanted to do which I had to work around.
Burner generators, and fusion reactors running on alien artifacts, both just looked at your inventory, but had to loop through the whole equipment grid to manually just add power to stuff. Not ideal. As for conduits, letting you get power from the grid, I think I used an accumulator, until those were forbidden from having priorities, then I used a laser turret dummy. Invisible and no pathing, just constantly teleporting to the player. Since then, burner equipment is a thing, if not in vanilla, and solar panels got buffed, so there isn't much need for that mod anymore. As for conduits, I could use the Electric interface now, If I wanted to recreate it.

I think the only other thing was my attempts to use cluster grenades to chain effects together, like to give a gun inaccuracy. It would shoot, cluster grenade effect to throw a second effect in a random direction, which would then causes the explosion randomly offset. But sadly cluster grenade was for 2+ effects only, and last I checked was never changed.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Zaflis
Filter Inserter
Filter Inserter
Posts: 414
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Alt-F4 #55 - The Dark Alleys of Modding

Post by Zaflis »

I can share one issue i had with VehicleSnap. I'm still not 100% on why it worked like this but it's probably some weird case of internal vehicle physics.

If you drove a vehicle towards a coastline or cliff at an angle that was not along a snap axis, for example 11, 70, 350... or you name it - degrees, the vehicle would become stuck. As much as you tried to drive backwards it just wouldn't budge.

The issue as far as i saw it was that the control loop of my mod was trying to turn the vehicle towards the snap angle but it was unable to because it collided with the coast. And when that same tick registered a collision it "signaled" the game engine that the vehicle should just remain stopped. The act of collision probably sets speed to 0 regardless of input direction.

The solution at first was to only snap when vehicles speed was higher than some arbitrary X threshold. And obviously when you drive backwards the speed is negative, so you deal with Abs() values that turn all numbers positive. It did work but if you had a vehicle that was innately very slow it wouldn't be able to snap... And it was only through trial and error with many X values to find one that works for most vehicles.

While still not solving the slow vehicle problem, i still went another route. Instead of focusing on vehicle speed i could be looking at distance travelled in a period of time, in order to enable or disable snapping. This felt much more robust way to control the threshold, and it would never activate the snapping the same tick the speed goes high. Imagine some super car with insane acceleration, with the speed method it would probably remain stuck in the wall forever.

Later on the distance method was further supported by discovery of onPlayerChangedPosition() event which enabled the entire onTick event to disable itself when not needed. With this the script time when no player was driving was also reduced to nothing.

CaptainSlide
Burner Inserter
Burner Inserter
Posts: 15
Joined: Mon Feb 17, 2020 1:30 am
Contact:

Re: Alt-F4 #55 - The Dark Alleys of Modding

Post by CaptainSlide »

Currently Steam tells me I have over 5800 hours in Factorio. Unlike most of the posters above I have only been playing since 0.18, so 2 years or so and yes I guess that is kind of sad, at leas t my wife would tell me so.

That said if it wasn't for all the wonderful mods you guys have provided for this game I probably would have tapped out 4000 hours ago and found something else to play.

So to all the modders out there a very BIG THANK YOU for keeping a wonderful game alive, fresh and interesting, at least for this addict.

Post Reply

Return to “General discussion”