Skip to main content

Quality of Life Improvement Update

· 3 min read
VeraDev
ScrapComputers Owner

This update isn't huge, but it improves how you use the mod and fixes some bugs along the way. We’ve also made several optimizations to make things run smoother.

General Optimizations

We’ve worked on making the mod faster and more efficient. One big change is that we’ve now optimized the LuaVM for the first time. These changes may not be obvious right away, but you should notice things running more smoothly, especially when doing more complex tasks.


LuaVM Optimizations

While adding image support, we were using one long string to handle image data. This caused a lot of slowdown, especially with larger images (like 256x256). The problem was with the LuaVM’s interpreter, Yueliang, which wasn’t good at handling long strings.

After VeraDev optimized it, the difference was huge. Check out the performance graph below:

LuaX String Reading Optimization Graph
Each dot shows a test of reading a 100 KiB string.

As you can see, this is a massive improvement. Now, large data can be stored and processed without slowing down the computer. (At least until Scrap Mechanic corrupts it!)


Semi-Live Syntax Highlighting

We’ve added Semi-Live Syntax Highlighting for the in-game computer. This makes your code much easier to read and understand.

Syntax Highlighting Image

It automatically highlights code as you type, but due to game limitations, it only works when typing at the end of the entire code. You can press a button to manually refresh the highlighting when needed.

Syntax highlighting also helps you find errors faster. Look at this example:

Syntax Highlighting Error Image

The line with the error turns red, and related functions show up as dark red. This makes finding and fixing mistakes much easier!


Translation Support

We’ve added a LanguageManager so you can now add translations to the mod. You can include any language, even those not supported by Scrap Mechanic. However, some fonts might not work if the game doesn’t support them, especially for non-Latin languages.

Note: This doesn’t work for inventory descriptions. because those are stored in json, where we cant modify them via Lua.


Addons Can Now Add Examples

(For addon developers)

We’ve added an ExampleManager, which allows addon developers to include code examples for the computer. This is a simple feature to make it easier for users to learn how to use your addons.


New Fonts

We’ve added new fonts in this update. Although 4 old fonts were removed, we’ve added 5 new ones. 4 of these come from Minecraft, and the last one is a custom font created by VeraDev, designed for smaller screens.


Display Optimization

Ben Bingo has optimized the display even more. He’s always looking for ways to make things faster, and VeraDev (the writer of this blog) is trying to tell him to stop optimizing as he is going too far.


Image Generator

You can now convert PNG images to a special format that works with our Image Renderer Example. Once converted, you can display these images directly on the computer screen, giving you new ways to add visuals in the game.


Thats it!

Thats the entire update, we will warn you tho, the next update will be a majour update so expect no updates for the following weeks! If you want to get teased on what the next update would contain, Check our discord! thats where you can get the latest teasers and talk to the team!