stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Day 326

Day 326 of 365 · Expert · Month 11: Optimisation and debugging

Surviving game updates

Surviving game updates: new and deprecated LogicTypes, checking prefab names against the current list and testing old scripts systematically.

Lesson 18 min Week 47

What you learn today

  • New and deprecated LogicTypes
  • Check prefab names
  • Test old scripts

After a game update the production counter stops counting. No error on the housing, the autolathe simply keeps running. What changed is written nowhere in the chip. Updates are a special kind of silent error: the code is the same, the world around it is not.

What can change in updates

WhatEffect in the chip
new LogicTypesnothing – old scripts keep running, new ones can do more
LogicType marked as deprecatedis still read, but returns nothing on newer devices
device no longer knows a LogicTypeerror IncorrectLogicType or silently 0, depending on the case
prefab name different or misspeltHASH("…") finds no device, Average silently returns NaN
deprecated instructions (ld, sd, getd, putd, label)keep running, l and s do the same

An example of a name that never existed: RatioVolatiles. In the chip volatiles are called RatioMethane, a script with the wrong name does not even load. And some prefab names contain typos of the game itself, such as StructurePipeAnalysizer. Whoever “corrects” them no longer finds the device.

Checking prefab names

Every name in HASH("Structure…") must be exactly as in the current list – including upper and lower case. StructureAutoLathe and StructureAutolathe are two different hashes. The checker in the IC10 coder knows the list and marks unknown prefabs.

So that a wrong name does not stay silent, the script checks whether its device answers at all:

lbn present DREHBANK HASH("Drehbank") On Average      # NaN if the name does not match
snanz present present
lbn pieces DREHBANK HASH("Drehbank") ExportCount Sum

Testing old scripts

After an update go through every important script like this:

  1. Open it in the IC10 coder. The checker marks deprecated LogicTypes and instructions yellow, unknown ones red.
  2. Switch on strict mode in the simulator. It only allows LogicTypes the device really knows.
  3. Repeat the script's test cases in the game: normal case, edge case, failure.
  4. Enter the new GameVersion in the instruction.xml once everything fits.
Warning

Sum is right for piece counts, but does not reveal a missing device: without a match Sum returns 0, not NaN. That is why you check for presence via a second value with Average.

Exercise

Task

The script from the forum was written for an older game version. Bring it up to date: correct prefab name of the autolathe, ExportCount instead of the deprecated ExportQuantity, no deprecated instruction. The autolathe “Drehbank” runs until 20 pieces are made, the display “Stueckzahl” shows the count – and -1 if the autolathe is not found.

Hints

Hint 1

The prefab is called StructureAutolathe – with a lower-case l.

Hint 2

label d0 … is deprecated and unnecessary here: the autolathe is already called “Drehbank” in the game.

Hint 3

Check presence via lbn … On Average and snanz, then show the fault value with select.

Quiz

4 questions. You pass from 60 % – the server does the grading.

Complete the day

  • Passed the simulator exercise
  • Passed the quiz with at least 60 %

Without an account progress is saved in this browser only.

Report a mistake in this lesson

Please sign in to report. Sign in

Esc
↑ ↓ selectEnter open/ opens search anywhere