Alt-F4 #2 - SPIDERTRON!!!
Table of Contents
Welcome to the second issue of Alt-F4, the community-driven follow-on to the Factorio Friday Facts. And man, am I always pleasantly surprised by the community. Within hours of publishing the first issue, the Discord was filled with enthusiastic people that were willing to help at all stages of the process. One thing you might have noticed is that the page you’re reading this on got a small upgrade here and there. Thanks to everyone who has been so enthusiastic about the project!
But this blog is not about the blog, it’s about the game. As we all know, the devs surprised us on release day by adding Spidertron, a giant mechanical spider with freakishly stretchy legs. It’s been teased since FFF #120 (4.5 years ago), so to commemorate the occasion we want to focus on this very versatile vehicle and all the ways the community has already experimented with it.
I think I speak for the majority of the early-access community when I say that I was pleasantly surprised when I saw the release notes for version 1.0! As your friendly neighborhood mod creator, I had to take a closer look under the hood to see how spidertron is built, opening my mind so new mod ideas could start to grow.
Like most fans of Arch666Angel already know, I am one of the contributors to the Angel’s mods. Since Angel’s Exploration is in a very early stage of development, I could not imagine a better place to put spidertron to good use. I will not spoil what I have brewing, instead I would rather take this moment to share some of the struggles of the development process.
Let us meet Crawlertron, the Angel-branded spidertron that will join the Crawler family in Angel’s vehicles. One requirement I have for my new Crawlertron is his size. I want him to be smaller, quite a bit smaller actually. This meant I had to introduce a scaling factor to the spidertron definitions in order to be able to scale him down. As some of you fellow mod creators have surely already noticed, he has one of the largest prototypes in the game. A few hours and a few cups of deliciousness later, after defining everything with a scaling factor, I could start loading up the game to see my result. Scaling Crawlertron down (scaling factor < 1) would not show me obvious mistakes in my coding, so I decided to scale him up instead (scaling factor > 1), with this being the result:
As you probably noticed, his legs look like tiny sticks! It’s a wonder that he hasn’t broken a leg yet! Returning to my Crawlertron leg definitions, I could not find anything wrong with them, so I chose to ask for help in the Factorio Discord modding channel. Klonan (a Wube team member, seen on this page enjoying two beers at the same time) even said that it would require some Factorio engine rewrite to allow his legs to scale correctly. In the meantime, Klonan asked me to scale him down, to see if that would work at least. Well, have a look:
I guess you can spot what the issue is in this case, because it’s the same as before! We can see that not everything works directly out of the box, which can have some fun side effects. I am sure this will be fixed in a future update; in the meantime I already registered a bug report about it with the developers. I may come back in a future update to showcase what Crawlertron has become, and how his legs have healed.
Mod Spotlight: Spidertron Engineer
A synthetic race of arthropod replicators plagues this galaxy. A single member of the silicon-based life form can convert an entire planet’s resources into grinding metal and searing heat, dedicated to one singular purpose: creating more. The robots will slaughter the local flora and fauna wherever they dare to wander, and methodically build increasingly complex machinery and more powerful weapons. The process will continue without end until they are finally capable of launching uncountable numbers of their bastard clones to the stars; seeking out rich, unsuspecting planets. The spidertron is unfeeling, unneeding, and unyielding. They do not sleep, they do not show mercy. Their factory must grow.
The storyline of Factorio as we know it is similar to many familiar base-building/survival games today: The Engineer crashes onto an unknown world and must survive until they can progress their technology enough to escape (read: shoot lots of rockets). This is an engaging enough idea, but stays mostly on the edges of the mind as we engage in the core Factorio gameplay.
Spidertron Engineer simply replaces The Engineer we all know and love with a cold spidertron robot from the very start of the game. There are technologies along the way that upgrade your character (i.e. spider) and replace the armour upgrades from vanilla. Even this relatively small change really gives the game a different feel. With this mod, I find I am able to engage in the greater universe of the game way more readily. I know it won’t be for everyone (especially arachnophobes) but for me, it takes a minimal part of the game and gives it a twist that ultimately makes the premise and endgame very engaging.
Spidertron Weapon Switcher is a mod that allows spidertron to fire any kind of weapon. In this post, I will be talking about how it works behind the scenes. But first, a peek at how awesome this looks in action:
If you’ve never written a mod before, you may not know that many things in Factorio cannot be changed during the game, for example the range of a gun, the graphics of a machine and, importantly for me, the weapon slots that a vehicle has. Of course, the weapons that spidertron has can be changed by mods, but only by creating a new ‘type’ of spidertron during the loading phase of the game.
The way that I got around this limitation is by creating five ‘types’ of spidertron, one for each type of weapon. So, when you switch weapons in-game, what the mod actually does is:
- Save all relevant data about the spidertron, such as its inventory contents and position
- Delete the current spidertron
- Create a new spidertron with the next weapon in its place
- Insert all the saved data into the new spidertron
All of these steps happen within a single tick, which makes it appear (almost) seamless to the player. (Some side effects, such as all remotes becoming disconnected from the spidertron, have to be mitigated with further work that is outside the scope of this blog.)
That all works great for transferring data about the spidertron but there is one thing that makes no sense to transfer: ammo. If you have the shotgun enabled with 300 shotgun shells loaded and you switch to the flamethrower, the shotgun shells should not (and cannot) be transferred into the flamethrower ammo slots.
I get around this by having a table for each spidertron so in step 1 the current ammo inventory is stored in the table under the key “shotgun”, and in step 4 the ammo under the key “flamethrower” is retrieved and placed into the new spidertron’s ammo slots. When the player picks up the spidertron, all the ammo for that spidertron is retrieved and placed in the player’s inventory, or spilled on the ground if there is no space left in the inventory.
Since last week, the contribution process has been massively refined (as in, there actually is a proper procedure for it now). If you’re familiar with GitHub, take a look at the project repo which explains how you can contribute. If you’re not, don’t despair, because the Discord and its members are always there to help. Just join up and ask around! If you’re wondering about what to write about, check out the first issue, it has advice for you at the bottom.
I want to give a special thank you to Thaui, Dr.MagPie, xthexder, Lovely_Santa and Conor for being the brains behind this whole operation, getting a fantastic website up and running within a day or two. Also, thanks to Landmine, we now have a logo and stuff!