Friday Facts #380 - Remote view

Posted by kovarex, Hrusa on 2023-10-13

Hello,
we would like to talk about the remote view changes coming in the 2.0 base game update. This is one of the foundations to be able to talk about the space platform and planets later, so lets get into it!


Remote viewkovarex

In the FFF-362 we explained the reasoning to improve the remote and ghost building as it became more important with spidertrons present. With the introduction of planets and space platforms in the Space Age expansion, the importance of the remote building grew even more. You just can't be everywhere at the same time.

The goal is to be able to use remote view for everything you can do locally. The motivation is also to remove as many inconsistencies as possible between the local and remote building, so your muscle memory works almost the same everywhere.

Remote opening

In the current 1.1 you can't remotely open an assembling machine to change the recipe, an inserter to set a filter, etc. But you can use "the blueprint trick" to do it remotely anyway. This is a similar problem as the remote wiring described in the last FFF-379.

So we implemented remote opening of every entity, this was only possible for train stops and locomotives in 1.1. This allows you to configure anything in the entity, but obviously, you can't just teleport your inventory items there.


Notice the ghost picker on the left side in remote view.

Ghost items

Since we want to allow you to do almost everything, we needed a way to work with items remotely.
The biggest motivation that arose from playtesting was to be able to add fuel to stuck locomotives, remove random items from places where they don't belong, and to add/upgrade/remove modules.

So the solution is, that you can just simply click a ghost cursor in an inventory slot to make a ghost item, which will be delivered to the slot by local construction robots. The same for removal, which makes the deconstruction cross and orders robots to take it out.

Rotating stuff

In 1.1 you can already remotely change the direction of entities. The problem is, that you can do so only by ghost-rebuilding the entity, while the "R" button to just rotate doesn't work, which makes another inconsistency compared to local building. Internally we had quite a lot of logic related to "real direction" and "future direction", which had to be considered in a lot of places and it was always bringing more and more problems.


The rotation order also doesn't give the nice feedback of whether the belt rotates/connects or not.

While solving yet another problem related to this, we realized that making rotation just an instant action might be the way out. It doesn't break the immersion too much and simplifies everything greatly for us and for the player, so we just did that.

Opening ghosts

Once we allowed the remote entity configuration, a new annoying problem popped up. Locally, you might be used to just building an assembling machine and configuring it right away. But with remote building, you had to place the ghost, wait until the robots built it, and then finally you're able to configure it.

Surprisingly, it wasn't technically that hard to allow opening ghosts and configuring them.

Blueprinting spidertrons and equipment

Another thing that you couldn't do remotely was building spidertrons, or reconfigure their equipment.
The main technical cost was to add equipment ghosts, so when you blueprint the spider, the robots can install the equipment into the spidertrons.

The extra bonus is, that you can put a ghost equipment into your armor now, so you don't have to do one-time orders for things for the armor, which happens much more in the expansion because of the quality.

Ghosts entities on ghost tiles

This is especially important for the platform building, so you don't need to wait for all the space platform tiles to be delivered to the skies and physically built to be able to place ghost entities on top of them. Even outside of this context, being able to build ghost entities on ghost landfill was a long time wish of ours and also a lot of players.

Deconstruction

The ALT+D shortcut for a deconstruction planner is part of my muscle memory now, but still, the inconsistency of being able to use the mine button to remove entities locally, but not remotely was there. This is why now you can just "mine" entities remotely to mark them for deconstruction.


Remote view contextkovarex

With the planets and space platforms present, we had to make a way to remotely move to these other places. It was just natural to make new buttons on the right as an access to these places.

Which leads to the GUI where you can see a preview of the different places and have a way to "jump" there through the view button.

But once we started playing, it became obvious, that this system is horrible. For example, if you want to check something on a planet, and then switch to a platform you have to do:
Planets GUI → Select planet → View → Close → Platforms GUI → Select platform → View → Close

Also, the preview in the planets GUI kind of lured you into trying to do stuff in there directly, as if it was the remote view already. So we repeatedly felt stupid for trying to click into the non-functional preview widget.

The solution was to integrate everything together. Whenever you open the remote view (the map), it always shows the planet/platform selection on the left, so you can use remote view normally and do everything, but also switch between places.

So the previous example gets simplified to:
Remote view → Select planet → Select platform → Close

This is the reason, why the access to the planet/platform travel and platform creation is in a little bit of an unintuitive place at first glance. It just works way better in the long run.
P.S. We used the same strategy for trains, so it is just a "glued" piece of GUI to the remote view, so you can interact with the world around the selected train the usual way, instead of seeing just the map which is otherwise non-interactable.


Ghost shaderHrusa

You may have noticed the ghosts in the previous images/videos looked a little bit different from what you may be familiar with, and there is a good reason for that.

Touching up the appearance of ghost entities had internally been haunting our minds since before the base game release. In 1.1, ghosts are simply drawn semi-transparent with no extra flare. It gets the job done, but can get somewhat cluttered and hard to distinguish. As remote interaction plays a major role in Space Age, it was a great opportunity to put my GPU hardware wrestling skills to use. I took it upon myself to breathe some life and clarity into the ghosts.

To tint or not to tint

The behemoth biter in the room is the color change/tint. Many entities are only distinguished by their color, for instance inserters and logistic chests. If the ghosts are tinted, it would be more difficult to tell these entities apart when they are ghosts.

However throughout our testing it became increasingly obvious that distinguishing the ghosts as a whole from real entities was by far the more important feature. You tend to care more whether it is a ghost or not, rather than what type of ghost it is. And we do have a few tricks up our sleeve to preserve the colors.

The anatomy of a ghost

Eager to flaunt the full power of shader magic, we've tried many types of distortion, blueprint grids, hazard stripes, eerie static, jack-o-lanterns, but ultimately decided on a fairly unobtrusive overlay. Instead of being a simple multiplicative tint, the image is split based on brightness. Each part has its own set of colored blend modes applied. We can really ramp up the blue factor on the shadows without entirely washing away the midtones and highlights.

The second piece of the puzzle is a shimmering distortion. Under normal circumstances 2D game sprites are trimmed to rectangular bounds. To give myself more room to work with and to avoid clipping, I had to find a way to retroactively stretch each ghost rectangle while keeping the picture in the right spot. Ideally without rewriting the draw function of every entity in the process. Furthermore, the previous ghost drawing did not really need to pass along its exact location on the map. In my case the effect must absolutely stick to the world and not be floaty. (It's really dizzying when it doesn't)


Yellow illustrates the added rectangle margins which allow the texture to distort without clipping.

To get the actual numbers to drive our shimmering, I decided to use simplex noise. Factorio map coordinates can get huge on top of me cramming them into whatever spare video memory I could find. The simplest solution is to tile the effect every few chunks. To accommodate that I had to customize the inner workings of simplex noise and account for the tiling seams.

Before the update, many entities were difficult to make out. For instance, setting up this refinery remotely would really strain your eyes.

But at what cost?

While the GPU can perform herculean amounts of operations extremely fast, the connection through which your PC sends the instructions is very narrow. This hologram effect is all fine and dandy, but if it makes the game choppy it's no good. Therefore, keeping the size of each instruction low is paramount.

Luckily, the standard Factorio draw call had several unused numbers in it for very specific things such as tree leaves moving in the wind. This allowed me to bit pack all the necessary information in without inflating the size of draw calls whatsoever!

One more thing

Since we now tint the ghosts, we can use it to provide a little bit of extra information to the player. Specifically, the ghosts will change tint when they have been assigned a robot to construct them, so you can tell at a glance if there is a robot on the way and/or if you have the required materials in the network.


As always, remotely let us know what you think at the usual places.