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

THIS DOES NOT WORK WITH TECHBLOX. Pixi adds two new commands, Pixi and Pixi2, 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 Pixi command for image importing.

Installation

Download and run GCMM, then select and install Pixi from the menu.

ADVANCED USERS (old way): 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

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

Pixi2 "robot" "[bot search text]" is the more verbose equivalent.

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 Pixi "Pixi Art" to load the robot into your Gamecraft game world.

Under the hood, robot importing reads 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

Pixi "[image filename]" and equivalently Pixi2 "canvas" "[image filename]" convert an image to coloured 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.

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

Pixi2 "console" "[image filename]" 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 Pixi coloured block feature 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 Pixi "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 Pixi or Pixi2 "canvas" 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 Pixi2 "text" and Pixi2 "console" 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.

Pixi vs Pixi2

To make your life easier, Pixi and Pixi2 guess what you want to do so you don't have to memorise niche incantations. To accomplish this, Pixi "[thing]" uses the thing to guess what to do. In the background, Pixi uses sneaky info like the file extension (or lack thereof) to guess correctly. Similarly, Pixi2 "[spell]" "[thing]" uses the spell to guess what to do. Behind the scenes, every importer has a name which Pixi uses to match the spell to a caster.

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 Pixi2 "console" and Pixi2 "text" commands.

Thanks to Mr. Rotor for all of the Robocraft blocks used in the Pixi2 "robot" command.

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.