Magically import images and more into Gamecraft as blocks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

README.md 7.3KB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # Pixi
  2. Gamecraft mod for converting images into coloured blocks.
  3. Think of it like automatic pixel art.
  4. ## Installation
  5. Before installing Pixi, please patch Gamecraft with [GCIPA](https://git.exmods.org/modtainers/GCIPA/releases) and install the latest version of [GamecraftModdingAPI](https://git.exmods.org/modtainers/GamecraftModdingAPI/releases).
  6. To install Pixi, copy `Pixi.dll` (from the latest release) into the `Plugins` folder in Gamecraft's main folder.
  7. Alternately, follow the install guide: https://www.exmods.org/guides/install.html (ignore the part about a zip file -- move Pixi.dll into the Plugins folder instead).
  8. ## Usage
  9. Pixi adds new commands to Gamecraft's command line to import images (and more) into a game.
  10. Since Pixi places vanilla Gamecraft blocks, imported images should be visible without Pixi installed.
  11. ### Commands
  12. `PixiText @"[image]"` converts an image to text and places a text block with that text beside you.
  13. `PixiConsole @"[image]" "[text block id]"` converts an image to text and places a console block beside you which changes the specified text block.
  14. `Pixi2D @"[image]"` converts an image to blocks and places it beside you (along the xy-plane).
  15. Anything between `[` and `]` characters is a command argument you must provide by replacing everything inside and including the square brackets.
  16. An argument like `[dog name]` is an argument named "dog name" and could be a value like `Clifford` or `doggo`,
  17. and `@"[dog name]"` could be a value like `@"Clifford"` or `@"doggo"`.
  18. For example, if you want to add an image called `pixel_art.png`, stored in Gamecraft's installation directory,
  19. execute the command `Pixi2D @"pixel_art.png"` to load the image as blocks.
  20. It's important to include the file extension, since Pixi isn't psychic (yet).
  21. **EXPERIMENTAL**
  22. `PixiBot @"[bot]"` downloads a bot from Robocraft's community Factory and places it beside you.
  23. `PixiBotFile @"[bot]"` converts a `.bot` file from [rcbup](https://github.com/NGnius/rcbup) to blocks and places it beside you.
  24. **NOTE**
  25. For the preceeding commands, do not forget the `@"` before and `"` after the command argument, otherwise the command won't work.
  26. If your image is not stored in the same folder as Gamecraft, you should specify the full filepath (eg `C:\path\to\image.png`) to the image.
  27. This works best with `.PNG` images, but `.JPG` also works -- you just won't be able to use transparency-based features.
  28. Optionally, if you know your command argument won't have a backslash `\` in it, you can omit the `@` symbol.
  29. `PixiThicc [depth]` sets the block thickness for `Pixi2D` image conversion.
  30. The depth should be a positive whole number, like 3 or 42, and not 3.14 or -42.
  31. The default thickness is 1.
  32. ### Behaviour
  33. PixiText and PixiConsole share the same image conversion system.
  34. The conversion system converts every pixel to a [color tag](http://digitalnativestudios.com/textmeshpro/docs/rich-text/#color) followed by a square text character.
  35. Thanks to TextMeshPro's support for the full colour spectrum, colour accuracy for these commands is very good.
  36. For PixiText, the resulting character string is set to the text field of the text block that the command places.
  37. For PixiConsole, the character string is automatically set to a console block in the form `ChangeTextBlockCommand [text block id] [character string]`.
  38. Pixi2D takes an image file and converts every pixel to a coloured block.
  39. Unfortunately, an image file supports over 6 million colours and Gamecraft only has 100 paint colours (and only 90 are used by Pixi2D).
  40. Pixi2D uses an algorithm to convert each pixel in an image into the closest paint colour, but colour accuracy will never be as good as a regular image.
  41. Pixi2D's colour-conversion algorithm also uses pixel transparency so you can cut out shapes.
  42. A pixel which has opacity of less than 50% will be ignored.
  43. A pixel which has an opacity between 75% and 50% will be converted into a glass cube.
  44. A pixel which has an opacity greater than 75% will be converted into an aluminium cube.
  45. This only works with `.PNG` image files since the `.JPG` format doesn't store transparency.
  46. Pixi2D also groups blocks together, since images have a lot of pixels.
  47. After the colour-conversion algorithm, Pixi groups blocks in the same column with the same paint colour together.
  48. The grouping algorithm reduces the block count by over 75% in ideal cases, and it can reduce the block count by 50% in most cases.
  49. Imagine a standard 1080p screen (1920x1080 pixels), which has more than 2 million pixels.
  50. Pixi2D could import that image with less than 500K blocks, which will still hurt Gamecraft's performance even on good PCs but it won't make it completely unusable like 2M blocks will.
  51. PixiBot and PixiBotFile convert robot data to equivalent Gamecraft blocks.
  52. If the conversion algorithm encounters a block it cannot convert, it will place a text block, with additional information, instead.
  53. PixiBot uses the Factory to download robots, which involves a partial re-implementation of [rcbup](https://github.com/NGnius/rcbup).
  54. Robot parsing uses information from [RobocraftAssembler](https://github.com/dddontshoot/RoboCraftAssembler).
  55. ## Suggestions and Bugs
  56. If you find a bug or have an idea for an improvement to Pixi, please create an [issue](https://git.exmods.org/NGnius/Pixi/issues) with an in-depth description.
  57. If you'd like to discuss your issue instead, talk to NGnius on the [Exmods Discord server](https://discord.gg/xjnFxQV).
  58. ## Development
  59. Show your love by offering your help!
  60. ### Setup
  61. Pixi's development environment is similar to most Gamecraft mods, since it's based on HelloModdingWorld's configuration.
  62. This project requires most of Gamecraft's `.dll` files to function correctly.
  63. Most, but not all, of these files are stored in Gamecraft's `Gamecraft_Data\Managed` folder.
  64. The project is pre-configured to look in a folder called ref in the solution's main directory or one level up from that.
  65. You can make sure Pixi can find all `.dll` files it needs by copying your Gamecraft folder here and renaming it to `ref`, but you'll have to re-copy it after every Gamecraft update.
  66. To avoid that, create a symbolic link (look it up) to your Gamecraft install folder named `ref` in this folder instead.
  67. Like most mods, you will have to patch your game with [GCIPA](https://git.exmods.org/modtainers/GCIPA).
  68. Pixi also requires the [GamecraftModdingAPI](https://git.exmods.org/modtainers/GamecraftModdingAPI) library to be installed (in `ref/Plugins/GamecraftModdingAPI.dll`).
  69. ### Building
  70. After you've completed the setup, open the solution file `Pixi.sln` in your prefered C# .NET/Mono development environment.
  71. I'd recommend Visual Studio Community Edition or JetBrains Rider for Windows and Monodevelop for Linux.
  72. If you've successfully completed setup, you should be able to build the Pixi project without errors.
  73. If it doesn't work and you can't figure out why, ask for help on the [Exmods Discord server](https://discord.gg/xjnFxQV).
  74. # Disclaimer
  75. Pixi, Exmods and NGnius are not endorsed or supported by Gamecraft or FreeJam.
  76. Modify Gamecraft at your own risk.
  77. Read the LICENSE file for licensing information.
  78. Please don't sue this project's contributors (that's what all disclaimers boil down to, right?).
  79. Pixi is not a psychic overlord which secretly rules the world.
  80. Well, not this world at least.