Pixi
Convert images, Robocraft bots and more into Gamecraft blocks.

Pixi adds new commands to Gamecraft's command line to import images, and other stuff, into a game. Since Pixi places vanilla Gamecraft blocks, imported files should be visible without Pixi installed. See the background image above this? That's a picture of Super Mario Bros World 1-1 in Gamecraft using the Pixi2D command for image importing.

Installation

Before installing Pixi, please patch Gamecraft with GCIPA and install the latest version of GamecraftModdingAPI. Once that's done, download Pixi's latest release and then copy Pixi.dll into the Plugins folder in Gamecraft's main folder. Alternately, follow the install guide (ignore the part about a zip file -- move Pixi.dll into the Plugins folder instead).

Robot Importing

PixiBot "[bot search text]" downloads the first search result from Robocraft's community Factory and places it beside you.

PixiBotFile "[bot filename]" converts a bot from rcbup to blocks and places it beside you.

In the previous commands, anything between (and including) [ and ] is a command argument that you must replace. Do not remove the quotation marks -- those are required for the command to work. These commands also have a hidden scaling property which is set to 3 by default. Changing the scaling will disable conversion for all Robocraft blocks except simple blocks.

For example, if you want to import a robot from the CRF called Pixi Art, execute the command PixiBot "Pixi Art" to load the robot into your Gamecraft game world.

Under the hood, PixiBot and PixiBotFile read the Robocraft robot save format from the CRF and places the equivalent Gamecraft blocks. For blocks which are in Gamecraft and Robocraft (full cubes, prisms, etc.), direct conversion occurs. If a block does not have a single-block equivalent in Gamecraft, the conversion algorithm will attempt to substitute in an existing blueprint for the block. Failing that, a text block with the name of the Robocraft block will be placed in its place. Currently Pixi comes with blueprints for struts, rods and wheels, but support for more blocks is ongoing. If you'd like a certain block blueprint to be added to Pixi, please contact NGnius on the Exmods Discord server.

Image Importing

Pixi2D "[image filename]" converts an image to blocks and places it beside you. High-opacity (>75%) pixels are converted to the block you're holding, medium-opacity (>50%) pixels are converted to glass and low-opacity (<50%) pixels are skipped.

PixiText "[image filename]" converts an image to text and places a text block with that text beside you.

PixiConsole "[image filename]" "[text block id]" converts an image to text and places a console block beside you which changes the specified text block.

In the previous commands, anything between (and including) [ and ] is a command argument that you must replace. Do not remove the quotation marks -- those are required for the command to work. These commands assume that the specified image is in the same folder as Gamecraft. If your image is in a different folder, please provide the full filepath (eg C:\path\to\image\my_image.png) and put a @ before the quotation marks. The Pixi2D command also has a hidden rotation property. By default, the image will be placed along the xy-plane (rotation 0,0,0).

For example, if you want to import an image called pixi_art.png that's stored in Gamecraft's installation directory, execute the command Pixi2D "pixi_art.png" to load the image as blocks. It's important to include the file extension, since Pixi isn't capable of black magic.

Image to blocks conversion with Pixi2D read a file in PNG or JPG format and converts every pixel to the nearest Gamecraft block colour. Adjacent blocks with the same colour are converted into a single scaled block to reduce the performance impact from larger images. The combination of colour quantization and optimisation usually results in a 50-75% reduction in block count for an image (compared to 1 block per pixel).

Image to text conversion with PixiText and PixiConsole converts every pixel from a PNG or JPG image file into a coloured square text character. This process does not optimise for similar adjacent pixels, so images will become more than 10x larger when converted to text. As a result, images larger than 64x64 pixels are very likely to cause issues with Gamecraft performance and stability. To ensure that everyone can enjoy your game, and to avoid save corruption, use Pixi's image to text commands sparingly and only for small images.

Development

You don't have to be a developer to help out! Please read the Development section of Pixi's README if you're interested in contributing to Pixi.

Acknowledgements

PixiBot uses the Factory to download robots, which involves a partial re-implementation of rcbup. Robot parsing uses information from RobocraftAssembler.

Gamecraft interactions use the GamecraftModdingAPI.

Thanks to TheGreenGoblin, who created the Python app for converting images to coloured square characters which inspired the PixiConsole and PixiText commands.

Thanks to Mr. Rotor for all of the Robocraft blocks used in the PixiBot and PixiBotFile commands.

Disclaimer

Pixi, Exmods and NGnius are not endorsed or supported by Gamecraft or FreeJam. Modify Gamecraft at your own risk. Read the LICENSE file for licensing information. Please don't sue this project or its contributors (that's what all disclaimers boil down to, right?).
For more information, refer to Pixi's source repository: https://git.exmods.org/NGnius/Pixi

Pixi is not magic and is actually just sufficiently advanced technology that's indistinguishable from magic.