Posted by Abregado, Wheybags on 2018-09-28

In FFF-241 we discussed how the game delivers information to the player in a number of confused ways; Blinking arrows and circles, chat messages on the bottom left corner of the screen, objectives in the top left, orange modal boxes bubbles on top of the player, and so on. These problems are exacerbated on high resolution monitors, where the information becomes even further spread apart.

We have tried a few ways to unify this information, but much of it was required to be in the world space, or needed to have a link between the screen space and the world space. The common solution to this is to have the GUI 'point' to an entity in the game world, but we wanted something more interesting.

Hello my name is: Compilatron (Abregado)

The idea for a robot sidekick in a video game is nothing new, but the solution fits to Factorio really well. When I arrived at the office and mentioned the concept, Albert immediately asked “Have you ever notice the forum FactorioBot?" and proceeded to show me some concept renders for the robot. Alberts idea had been discussed several times before as a solution to this very problem, just waiting for the right time. Well, Compilatron your time is now!

Albert's latest render of Compilatron, our companion character.

The Compilatron character allows us to couple text and positional data together, which creates a much tighter connection between the subject of the information and the information itself. Previously, the orange modal boxes and blinking arrows could be used in this way, as they could point to entities in the world. Compilatron can do this without breaking the immersion and game flow.

We don’t want to reveal too much, but you can see that this is already better than the orange modal windows.

Compilatron also gives us a hand with screen space information. If we can successfully style some of the user interface elements (such as the new as-of-yet-unshown objective window) to match the Compilatron style, I believe we can create an even stronger association between text in the screen space and that in the world space.

Another way the Compilatron helps us keep the immersion intact is as a plot agent. Currently campaign plot events just 'happen' when objectives are completed, or when characters internal monologue decides the next move. Now we can have Compilatron act as a driving force to the campaign, it gives the objectives to the player, interacts with entities during cutscenes, and overall makes things less awkward than they are now.

These are two of the major benefits of having Compilatron, there are also some more interesting things we can do with it in the future, The specifics of how Compilatron will work and interact with the player are still in development, so expect some changes from what you see here.

So far I feel like the solution is working out, but not without some issues, the largest of which was working with the current Unit AI...

Compilatron - Technical additions (Wheybags)

I have been working on the technical side of Compilatron, which should be of interest to the modders among you. Compilatron is entirely scripted through Lua, it is not a custom C++ entity at all, which meant we needed to add a few things to our scripting API to make it possible.

First off, The Compilatron is a Unit, which means it is controlled in the same basic manner as the biters. As Units have never been used in the base game for anything but biters, there are quite a few unusual behaviours baked into the Unit control code, that didn't really make sense outside the context of biters. To fix this without breaking the base game, I've been adding prototype flags to units which disable these special behaviours by default, and enabling them only on biters (e.g., trying to return to a spawner every now and again, which can mess up your current command execution). These are being fixed on an ad-hoc basis whenever we run into them, so if you're a modder who's had some pain with this kind of thing, please let us know what you'd like to change.

The most significant change I've made is probably opening up the pathfinder to Lua script. This means that you can issue asynchronous pathfinding requests that are not associated with an actual command, useful for e.g., checking if you can path from one place to another. Later on, we will also include the ability to issue a move order and pass in the computed pathfinding data, which would let you modify paths before executing them, or even write your own totally custom pathfinding in Lua.

Script event on AI command completion, so you know when a Unit has completed its current command.

Allowing units to pathfind through friendly buildings (i.e. walk over to it, destroy it, then continue over the place it used to stand). Only when explicitly requested, of course.

Allowing units to path through and open friendly gates.

Added a whole bunch of flags to go_to_location commands, exposing pathfinder internals such a low priority pathfind requests, and prioritising straight paths.

commands, exposing pathfinder internals such a low priority pathfind requests, and prioritising straight paths. Units will now avoid pathing through all friendly entities, as opposed to the old behaviour of only avoiding same-force entities.

Added new AI command stop , and improved the wander command significantly.

, and improved the command significantly. Added a new HighlightBox entity, that will draw a selection box around a specified entity or at a specific position.

Added a speech bubble entity.

Allow accessing Lua scripts by __MOD-NAME__/script.lua style path, so you can reference the same Lua scripts from multiple scenarios in one mod.

As well as what's mentioned above, there's been a whole host of miscellaneous changes and additions, including:

Klonan has already made a mod to help test and debug all the new modding commands, scripting, and API features:

Webm/Mp4 playback not supported on your device.

We're very interested in the benefits that these changes will bring modders "for free", so if you're an interested modder with some opinions/requests about this topic, let us know, we've started a specific forum thread for the topic here.

As always, let us know what you think on our forum.