Stormworks: Build and Rescue

Stormworks: Build and Rescue

34 ratings
Lua imaging
By PenguinO and 1 collaborators
Lua imaging guide

Well, since we have some draw commands but no direct I/O access from in-game lua code, just go ahead and draw things.
With knowledge of bitmap anyone can draw images with in-game command.
To save time doing labor works, PenguinO (Me), Tajin and CrazyFluffyPony made some tools that work differently for similar goal.

Tajin's lua paint tool was later dropped
   
Award
Favorite
Favorited
Unfavorite
PenguinO's Tool
PenguinO's Tool

Intro:
I find that there is no I/O access from lua code/script which is good in terms of security.
I want some nice pictures on the screen so I first started with RGB332 but this did not end well.
Next, I realized that 8-bit bitmap has many advantages including transparency so I have to make a tool to turn pixel data and color data into readable number.
From the list/table of number, I put some lua code to draw.
And from the early goal, the tool was made to create logo screen so it's named like that.
It's also the reason that "Scale to Fullscreen" was made Mode1 (default).

First Version:


V 3.0:


Link to my tool is here:
http://project.gfcom.info/swlogogen/


Instructions
1. Choose your image file
2. Set desired parameters
3. Upload
4. Copy the output code

Tell your friends if this tool is useful

Some screenshot from code generated

Advantages
  • First to be available
  • Show analyzed image data
  • Generated codes and data are to be readable
  • Has customizable settings for code generation
  • Support transparency
  • Image conversion was added to V3 update to support other image types

Limitations
  • Has limited total colors per image
  • May require to process multiple passes to adjust some settings
  • Require manual selection to split code into multiple blocks

PS About the tool
My Lua code generator for Logo for Stormworks was initially made specifically for Uncompressed Windows BMP 8-bit indexed color only.
Then later I added ImageMagick to do conversion from other type but it comes with some limitations.
- image with less than 17 colors becomes 4-bit BMP =>>> Error
- GIF with multiple frames is unhandled =>>> Error

I'm not a great writer for documentation things
CrazyFluffyPony's Tool
CrazyFluffyPony's Tool

This tool can convert any image file your browser is supporting.

The tool creates a compressed string of the image data and some lua code.
The lua code uncrompresses the string back (once on vehicle spawn) into a two dimensional table, each entry containing the hex value of one pixel.
Every time onDraw() is called the code paints all the pixels onto the monitor.
That means you can adjust the image data on the fly.



Advantages
  • Supports many image file types
  • You can customize the lua code used to paint the image
  • Select the color depth
  • Splits code into multiple lua scripts if the code exceeds the maximum character length of lua scripts.
  • Can be used offline



Link
https://image-to-lua.flaffipony.rocks/

7 Comments
Neurosys420 18 Feb, 2023 @ 11:29am 
@Dansky - y u no learn2code?
Dansky 24 Feb, 2021 @ 4:49pm 
So do I need a degree in game development to have this? Looks complicated, and I don't know code.
sunblock50 22 Jul, 2020 @ 8:52am 
Nice job.
Jesse1125XD 17 Oct, 2019 @ 9:32pm 
Thanks
Catmandoe1 2 Jul, 2019 @ 10:25am 
great!
powder12321 26 Jun, 2019 @ 7:39am 
Thanks
Schoenwax 22 Jun, 2019 @ 2:48am 
helpful