This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Bomb Bloke's profile picture

mapArt

Started by Bomb Bloke, 02 August 2017 - 02:26 PM
Bomb Bloke #1
Posted 02 August 2017 - 04:26 PM
pastebin get gHPs67vj mapArt



So for a while I'd been thinking about making a terminal object which draws directly to Minecraft maps. It would've been neat, but it turns out that's not viable - there's no way to write map data directly from in-game. Short of using external software tools, the only way to modify a map's content is for a player to actually view that map near its associated terrain.

Hence this Command Computer script, which instead generates single terrain "images" according to whatever GIFs you feed it, using what's dubbed "the staircase method".

On first run, the script will offer to "prepare" the build area. Doing so moves the computer and player to the middle of the mapping zone, and re-running the script from that location will trigger the option to actually construct your images.

Each individual map holds 128x128 pixels (regardless of its zoom level). Images are scaled accordingly, but you can opt to spread them out over multiple maps if you want higher resolutions (in which case each section is generated in order from left to right, top to bottom). The script automatically gives you a new map to store the art in as each build completes - simply open it to record that section of image data, and then move it away from your hotbar before telling the script to continue.

Builds are performed at the nearest suitable location to your computer, and are heavily destructive to any pre-existing terrain there. Server time slows to a crawl while the script is active, and it may take a minute or so for the clock to "catch up" after a build.

Once a map is complete, you can safely fill the area back in (or build a new map in that same area) so long as you do not view your old maps in that area again. Perform your builds somewhere remote, and then take your maps back to your home base for display in item frames.

Later versions of Minecraft have better colour depth, but the script should be able to automatically figure out what's available in whatever version you have installed.

Version History2017/08/03
1.0.0
Initial release.

2017/08/07
1.1.0
Fixed bugs concerning transparent and / or very bright images.
Script now teleports user to the center of the best construction zone.
Multi-map builds can now be quit mid-way and then resumed later.

2017/08/10
1.1.1
Uses "tpn" (instead of "teleport") if the server implements it.
Edited on 09 August 2017 - 11:38 PM
Dave-ee Jones #2
Posted 03 August 2017 - 12:43 AM
So it generates the picture onto actual MC terrain, making the map use the terrain as the picture? So does that mean if you flew up really high you could see the picture on the terrain too? :P/>

Pretty clever workaround, but it makes sense.
Bomb Bloke #3
Posted 03 August 2017 - 02:39 AM
You'd need to fly up pretty high, but yes.

The idea is that there're a limited number of blocks that appear with unique colours on a map, but you can adjust their shade by messing with their height relative to whatever's to their direct north. This means that images are made up of "wavy tendrils" - they're pretty hard to make out unless you use a map.
Lyqyd #4
Posted 04 August 2017 - 02:33 AM
Would it be sensible to provide an option in the script to teleport the user to the appropriate map-starting location and then wait for a signal from the user (chat message?) before teleporting them around throughout the area in order to gather the map data? Seems like a way to streamline the production of the actual map once the build is complete.
Bomb Bloke #5
Posted 06 August 2017 - 05:17 PM
I eventually realised that I could simply stick both the computer and the player slap bang in the middle of the building area, so long as I leave them near bedrock level. From there you can fully record any maps without having to move any further at all, and it also resolves any potential chunk-loading issues. So on first run the script now offers a "prepare" button which performs this move, and the "fill" button also moves the computer + player back up to the surface.

I've furthermore added an option to select which map number to start building from (handy for resuming larger builds), and cleaned out a couple of bugs.
LoganDark2 #6
Posted 20 January 2018 - 03:07 PM
Why would you waste such an awesome program by using it to draw anime images?
Bomb Bloke #7
Posted 23 January 2018 - 06:27 AM
Colour depth. There isn't enough for photos to come out well, but more simplistic drawings would undersell it.