Alt-F4 #3 - Tronparty
Table of Contents
Welcome to the third issue of Alt-F4. This weekend, there’ll be an attempt to try and break the record for the highest number of players on a single Factorio server; read on for details of how to join the fun. There’s also an action report about the Big Community Games launch party, which should totally haven been covered last week. Completely my (Therena’s) bad. Finally, Raiguard shares an exciting mod of his with all of us. Let’s get to it!
PS: We’re looking for motivated people that want to help translate each issue of Alt-F4. If you’re interested, you can find more info at the end of this issue. Thanks!
The weekend is here, got any plans? Going to play Factorio for about 25 minutes again, then realise the sun is rising already? Or do you just want to play Factorio with a few friends?
Well, we’ve got some good news. This weekend, we have a few friends getting together to do something simple: completely melt our server’s silicon! Join us for the Molten Silicon event where our only objective is to get as many players onto the same server as possible and launch a rocket. Oh, and melt the server’s CPU at the same time of course! There will be something for every player to do, from building the base to clearing biters with other Red Coats. Our true enemy will probably be ever present as well, so we’ll need some of you to join our Lumberjack team!
So if you’ve got a few hours to spare this weekend, and want to try and help break the previous record of 521 concurrent players, please join our server at 11am UTC this Saturday 5th September. You can easily identify it, because it’ll be the largest server running!
Countdown has passed
The first Alt-F4 was an exciting surprise when my stubborn mind went to factorio.com on Friday 21th August, knowing there wouldn’t be a fresh FFF post #361 waiting for me. I decided I wanted to support this initiative, and the best way to do so was to act fast. So, here’s a field report about one of the fresh 1.0 “not-a-bug”-bug reports.
The second-best thing after an official release party in Prague would be a good old multiplayer server. Multiple release parties sprouted in the Factorio lobby that Friday, all hosting fresh maps with many engineers from all over the world joining in to lay down some ambitious main busses. The Big Community Games Discord was able to catch the most momentum and peaked at 201 players, which was good as you need quite a decent base to chew away at all the science packs that are required to get to the best feature of 1.0. (Hint: It’s spidertron!)
Blessed with dense ore patches and a clever map note (describing team colours and their duties), the server started as a hyperactive ant collective with an instinct for making smelter columns. The map message around the spawn point did a wonderful job at organizing the ever-growing group of engineers. Early on, an isolated factory was raised next to the science factory to keep all the Redshirts fed with gear and ammo. This gave both the troopers and the builders a steady supply to defend and grow the factory.
And grow it did. It took 11 hours to produce a rocket, alongside around 20 spidertrons, a shipload of equipment and armour and a ton of ammo and explosives. By that time, Bilka Bay, Italy, and Lake Twinsen had been christened, according to the map markers left by seasoned engineers.
As soon as the spidertrons came into production it became clear that these legs feel very unusual, but powerful at the same time. The intriguing sight of simply stepping over lakes and machines slowly turned the exploration tour into a test of capabilities for our new toy/tool. Belts soon turned out to be a point of interest for many of the spiders that were running around the map. The shared excitement led the admins to add their own contribution to the party and made spidertron face the ultimate test by turning the release party into a spidertron rave. A colourful dance floor was quickly terraformed so the spiders could stretch their legs:
The combination of belts travelling in opposite directions and gaps in the map drove the brand new spidertron legs to split awkwardly, stretching their legs infinitely. High time to update the devs about these findings with a fresh 1.0 bug report. It ended up as one of the most viewed bug reports, but was quickly marked as duplicate: not-a-bug. Developer V453000 had already responded on one of the first 1.0 bug reports (30 minutes after release) to point out that restricting their movement wouldn’t be desirable, and that our spiders were actually performing just fine. But, the fact that we “could” does not eliminate the question of whether we “should”…
In the end the playthrough was an absolute blast, and we truly fell in love with the spidertron. He’s one of us now.
Mod spotlight: Editor Extensions
Everyone knows about Creative Mod. It provides you with many different ‘cheat’ items that you can use to test your factory layouts. It has been around for quite a long time, and has served people well over the years.
However, if you use Creative Mod for any length of time you’ll start to notice lag spikes here and there. Continue using it more and more and the lag spikes will get more and more frequent. Eventually, your game will begin to slow down as you use more and more of Creative Mod’s tools.
A year and a half ago I started experiencing lag on my creative world. I had just released my first mod at the time, so I had a little bit of experience with the API. Curious, I delved into Creative Mod’s code and tried to see if I could figure out what was going on.
The result was: Creative Mod was very well made… for its time. The mod was created in 0.13, when the modding API was much more limited. Thus, it managed to do all of these awesome things with an extremely limited set of tools. But now the mod API is much more mature and a lot more capable. I set out to create an update to Creative Mod that would take advantage of these new features, thereby decreasing its performance impact.
But eventually I realized that updating Creative Mod was infeasible. It would require too many breaking changes to bring it up to date, so instead I decided to create a new mod altogether. That mod was initially released as Infinity Mode, but was soon deprecated and replaced with Editor Extensions for various reasons.
Editor Extensions does not replace the game’s map editor like Creative Mod and Infinity Mode do — it augments it. Thus, EE does not have a “cheats” window akin to Creative Mod and Infinity Mode. The editor has all of that functionality — and more — buried within its many menus.
Editor Extensions’ main appeal is its performance — it is several orders of magnitude faster than Creative Mod. I’m going to go over some of the methods I used to achieve this.
The first thing I set out to do was create energy sources and energy voids. Creative Mod does this by creating boilers, then filling them with electricity on every tick using a script. However, now the game has a built-in entity that can do this automatically: the Electric Energy Interface (EEI). This entity can magically produce and consume electricity out of nothing, and its parameters are adjustable at runtime.
There are two things about the EEI that I wanted to improve on — the GUI and the usage priority. The EEI’s GUI is functional, but confusing, and an entity can only have one usage priority assigned to it. Of course, I can fix the first problem by creating a custom GUI, but the second problem is solved in a slightly trickier manner.
What you see as an infinity accumulator is actually one of five possible entities, each with a different usage priority. Depending on how you configure it in the GUI, a small script will hot-swap the entity with another one that looks identical, but has a different usage priority. This allows a single “entity” to do everything from producing, consuming, and storing a customizable amount of power (up to 999 yottawatts!).
The next problem I wanted to solve was chests. Creative Mod has a variety of chests, which can spawn, duplicate, or delete items. However, it uses scripts to accomplish all of that functionality, creating a rather large overhead after placing just a few chests.
In 0.16, the base game was graced with the infinity chest, which can do all of this and more. It works by setting infinity filters, which themselves have “at least”, “at most” and “exactly” modes. This offloads all of the item manipulation to the game itself, reducing the scripting overhead to absolutely zero!
EE extends upon the basic infinity chest by adding logistic variants, and adding a special kind of infinity chest called an aggregate chest. The aggregate chest is most similar to the creative chest — it holds a stack of every item in the game. A small script sets its infinity filters when placed, and then the base game handles the rest. There are regular and passive provider variants of this chest as well.
Using infinity and aggregate chests, you can get the exact behaviour you want for testing your builds.
Often you will want to quickly and easily place items on a belt, or get rid of items on a belt, to test your setups. In vanilla, you can do this with an infinity chest and a loader (a hidden entity that you can get in the map editor). However, these loaders are fairly basic, and if you want to have different items on each side of a belt you have to place two loaders and two infinity chests. That’s four entities, and then you have to configure the chests as well, taking up even more time.
To solve this problem, I actually built upon another mod — Miniloader. A lot of the concepts are shared between Miniloader and the infinity loader, so this explanation will give you a sneak peek into how that mod works as well.
The infinity loader is actually a minimum of five entities at once:
From left to right, we have the loader entity itself, an infinity chest, two stack filter inserters, and a constant combinator. All of these entities play a role in making the infinity loader work.
When you place an infinity loader, what you are actually placing is a “dummy combinator”. This is a constant combinator that is disguised to look like a loader. When placed, a script immediately destroys that combinator and replaces it with an invisible one. This combinator is what you actually interact with, and is saved in blueprints so the filters can be preserved. Then the loader entity is added, along with an invisible infinity chest and a minimum of two invisible stack filter inserters with their speed cranked up to max.
When you configure the loader’s filters through its custom GUI, you are actually setting the filters on the invisible stack filter inserters, as well as the infinity chest. These inserters will pull from the chest and put the items on the belt extremely quickly, making it seem as if the items are spawning out of nowhere.
The reverse is also true — if you rotate an infinity loader to consume items, the inserters will pull everything off of the belt and throw it in the infinity chest, making it seem as if the items are magically disappearing. All of this is done behind the scenes and takes advantage of vanilla behaviours. A script is used to “set up” the loader, but from then on, the script does nothing, reducing the scripting overhead for using these loaders — once again — to zero.
Of course, to make things as simple as possible, there is only one infinity loader item that you place. The loader will switch its belt type depending on what it’s connected to automatically and will add or remove inserters to be able to keep up with the belt’s speed. And because there are multiple different inserters, we can set different filters for each side of the belt.
The result is a convenient, easy-to-use entity that can produce and consume items on a belt, while being extremely performance friendly.
While Editor Extensions is primarily meant to be used from the map editor, it is also quite possible and quite easy to use a character as well. By using cheat mode (accessed by typing
/cheat all into the console), you can get access to all the tools mentioned above.
Some of the tools I haven’t mentioned include supercharged equipment:
By using this equipment you can become immortal, run super fast, and see clearly in the darkness. The super roboport, combined with super construction bots, allows you to very quickly construct and deconstruct. The result is you can access many of the editor’s god-like powers while retaining your comfortable body. And in the future, if you ever remove Editor Extensions from your save, the equipment will simply disappear, leaving infinite reach as the only evidence of the mod being there.
Editor Extensions is the result of over a year of testing both in-game builds and mods. There are many, many things that I haven’t covered here — including a
toggle editor shortcut, inventory sync, infinity pipes, and a special testing scenario — but that would make this post even longer than it already is. I hope you enjoyed the read, and I hope you gained some insight into how Factorio’s amazing modding API works.
The Factorio developers spoil us with what we are able to do to their game, and the API only gets more and more capable with every update. Thank you for reading, and thank you to the developers for making this possible!
We’re always looking for people that have something interesting they want to share with the Factorio community. If that’s you, please join the Discord (or the GitHub project) to get started. Pretty much any topic is welcome, so don’t be afraid to contribute!
We’re also looking at getting community translations started this week, which would make Alt-F4 available to many more people than just the English version could. We have already set the website up to accommodate this, so all we need are people to work on the translations. If you’re up for it, join the Discord and look for the #translation channel.