Playing Minecraft Inside Terraria | Project Showcase 4
Vložit
- čas přidán 10. 07. 2024
- Fairly quick project I cooked up using Terraria as a digital display for anything you want including images, videos, and games. Took me about 3 days to fully implement in code and another week or so to edit.
This project was tons of fun, thanks for watching! I hope you all enjoyed.
Quick note: the code for the Terraria mod is super spaghetti, I didn't program it very structured at all. I might clean it up in the future and update the github but for the time being it'll be pretty messy and convoluted. Also all the file paths in the mod/python files are removed since they were for my local machine so you'll have to put those in and recompile the mod yourself but it's pretty straight forward. If you want to get it up and running just create a template mod in tmod loader then replace testsword.cs with mine.
GitHub - github.com/Brendan-Kirtlan/Te...
Music Used (in order)
Scott Lloyd Shelly - Overworld Day
Scott Lloyd Shelly - Alternate Day
Scott Lloyd Shelly - Corruption
jin601 - underwater potion ( / underwater-potion )
jin601 - magic pixel ( / magic-pixel )
jin601 - cafescene ( / cafescene )
jin601 - SOMeONE!! ( / someone )
jin601 - explanation ( / explanation )
jin601 - phlegm ( / phlegm )
jin601 - / jin601
Video Chapters
0:00 - Intro
0:24 - Background
0:53 - Converting pictures to blocks
3:21 - Playing videos with blocks
3:40 - Displaying games
4:00 - Huge problem
6:48 - Attempting to find diamonds in MC in Terraria
23:17 - Outro
obligatory forsen reference
>no identification header
>no checksum
>no blocks
Absolutely based, best image format
Will probably become the industry standard for storing images I’d imagine
i prefer it this way
does away with a couple extra bytes for maximum compression
It has no checksum, but does it have .chumseck?
Chum actually isnt a bad idea if you wanna have something really computationally innexpensive to export with. Not practical after that tho.
For someone’s first terraria mod this is insane.
You know, when Terraria first came out, a lot of people were calling it 2D Minecraft. Now I can safely deny those claims, because Terraria is apparently just 3D Minecraft.
You mean minecraft is just 3D terraria 😂
huh?
Minecraft is 3D forager, and even forager has more content.
terraria actually released before minecraft
Out of 4 replies how did no one understand the comment 💀
The problem you are trying to solve is called real time color quantization, and there are a number of cool ways to optimize it. If you represent RGB as 3D space, you could store your pallet in an octree which would drastically reduce search times
Never heard of these, thanks! Will definitely look into these
@@BKBinary Would be cool to have a follow up where you optimize it, maybe have the computation shared on more cores(if possible) and try and win a CS go bot match
@@jambosussSince the pixels are largely independent, it should be trivially parallelizable
sRGB is honestly a pretty terrible color space for this kind of thing. Converting to a perceptual cookie space would take more processing power, but should make things more visible with less cookie distortion.
+ one other idea would be to just precalculate a big lookup table. All 256,256,256 would only be 16MB (or 32 if you need 16-bit index for blocks). Should be real-time even without threading assuming terraria can keep up
edit: since you're quantizing anyway, you could group nearby rgb values as well. Divide everything by 4 and you save 64x the storage. You could also use 2 tables - one for converting rgb to hsv or whatever color scheme you want (doesn't matter how expensive the conversion is), then another for converting hsv to terraria block. though at this point, I'm sure the biggest bottleneck is probably Terraria updating the blocks/map, I doubt getting the screenshot is so expensive
For more accurate colors, maybe you could have considered converting RGB to YCbCr and calculating according to the distance of the Y (luminance or relative brightness) component. You could consider CbCr slightly in your calculations, but matching to Y first will get much better results since humans see differences in relative brightness much more than differences in chroma (the Cb and Cr)
This is a principle used in image compression algorithms if you are curious, where most of the Cb and Cr information is thrown away with very little loss in perceived image quality
Very interesting I didn’t know this, thanks for the comment!
My first version of picture conversion used luminance with seemingly random scalars (but didn’t take account for color so it was grayscale). I didn’t know you could combine luminance as well as the colors to make it more accurate.
This is often seen in the JPEG format if I am not mistaken
1:50 Congratulations, you just invented .BMP format
*ppm
It's literally just a ppm.
Bmp doesn't has alpha?
@@quedtion_marks_kirby_modding bmp has a secret hidden third half assed 32 bit export option in gimp
@@quedtion_marks_kirby_modding He made a binary-ppm it's physically the same.
@@quedtion_marks_kirby_moddingit does but according to the Wiki it requires compression to support the alpha channel, so default bitmap is just a header with RGB bytes repeating until EOF
Using a picture of ray william johnson for the word "until" is hilarious
My guy did something so unthinkable, so undone before to such a degree that people thought he was trolling.
what my cs teammates are playing on:
what im playing on:
this video is infact epic
You are epic sir
Most controller mods specifically disable Minecraft's pausing and keep registering inputs when unfocused, because a primary use for them is running multiple games on the same computer for a 'split screen' experience.
_Primary_ use? I thought the primary use was to play it with a controller.
@@blu3260
_A_ primary use.
Obviously the _main_ purpose is to just have the game with a controller, but doing it split-screen has been a big thing for these controller mods since 1.7.10 at least, and that tradition has carried on.
The association of RGB color to terraria block is called color quantization. The way you are quantizing RGB color pixel wise is, while simple, suboptimal in term of result quality. The problem with this algorithm can be seen with the following example. Let say you want to quantize an image full of the same purple pixel but you only have red and blue color in your quantization set (no purple). The result of your algorithm would be an image full of red or full of blue (depending on the distance between the purple color and the red and blue color). A better result would have been to place blue and red pixel next to each other to obtain an image that, for the human eye, would look purple ! This process is called dithering, you can check the Floyd-Steinberg dithering algorithm that does exactly that. Great video nonetheless, looking forward for the next one !
I also think it would be possible to use a kd-tree with 3-dimensional coordinates (rgb values) and find the closest euclidean distance in logN time, instead of the linear search he was preforming
Dithering would result in better image quality, but it would also take more processing power.
im so happy i found this channel, just binged watched all your uploads and excited for whats tuned keep it up bro💪💪
excuse me it's not a leather helmet, it's a leather cap
Leather helmet til the day I die baby
Instead of calculating the euclidean distance for each vector, you could take the dot product. The largest dot product will signify the most similar vector. For vectors x and y, rather than calculating dist(x, y) = sqrt( (r_x - r_y)^2 + (g_x - g_y)^2 + (b_x - b_y)^2 ) for the euclidean distance (or even calculating the squared distance to avoid computing square roots every check), you can save computation time by instead calculating dot(x, y) = ( r_x*r_y + g_x*g_y + b_x*b_y ) this has the same number of additions and multiplications, but saves on 3 subtractions and potentially a square root per calculation.
Though, this is probably a micro-optimization and you won't see too much benefit. Love chum btw, never change it.
Thought the same. Hidden advantage is that you can batch many dot products in a vector matrix multiplication
Could also trade memory for computation time and instead create a lookup array where the index is R + G
Bro decided to do the opposite of the computer in Minecraft where you can play terraria on 💀, this madlad
I think if you wanted to improve performance, you could use a custom texture pack that limits MC's colors to what your screen supports, and then apply fullbright.
OMG, your mining luck seemed terrible - which adds to the reward for sticking to it until achieving it.
Cool project!
We appreciate the torture you put yourself through to make this ❤😂
this is insane man, gj
The palette looks amazing, i'd definitely play that (in Minecraft, full speed and resolution)
I can't wait to see .chum used everywhere
man I can't wait for part 2
You’re a friggin legend wtf
Your image format is cool, but why didn't you just use the Bitmap image format?
🤔
bump
this is giving me such like minecraft beta vibes for some reason. I feel like this is what my memories of playing minecraft beta look like in my head. Would love to play this way or at least have like a texture pack or something with these colors
Loved the video!
I just wanted to share a couple of tips that might be useful to you or others from my experiences with topics close to this. For reading the window without obs showing up above it or if other windows are dragged over the window I like to use win32 and PrintScreen from that module as it allows you to read the windows image even if other windows are above it or the window is inactive. I also like to use win32 for sending keypresses and cursor movement (tho that's a bit buggy) as it also allows you to control the game from inside other games with something like a custom item. Instead of like in your case having to plug in a seperate controller and changing config files, however this can restrict some movement as it isn't as easy to control. Also I don't fully know if you in counted this issue with minecraft opening the pause menu every time you tabed out but if you did you can press F3+P to stop auto pausing from happening when minecraft goes out of focus.
Anyways sorry for such a long paragraph. Hope that is helpful to someone atleast.
3:20 THE DANIEL LARSON IM CRYING
Bro actually played it pretty awesome
This is ludicrously cool
Very cool! for future reference your chum file exists and is the .BMP format
“Also try terraria!” - The Minecraft splash text
Not sure if you check but terraria has 32 paint which can be applied to almost every block which will provide you with a very broad spectrum of colors, also not 100% sure but I believe in the configs file you can also change the render distance as I believe resolution is somewhat of a limiting factor in this.
pretty sure paints only show the paint color in the map, without regards for the original map appearance。
next video be like: "playing minecraft inside terraria inside minecraft inside terraria"
I think part of the horrid frame rate is due to the fact that you’re making screenshots, converting them to CHUM, picking up the file in Terraria, then converting that to Terraria blocks.
I think you could cut the first png to CHUM conversion entirely by instead of screenshotting, individually taking each pixel of the screen and writing it into a CHUM file.
I’d personally do it in C (or at least Cython) to make it faster as well.
Also writing and reading files is really slow, some form of in-memory IPC would help i think
I'm impressed.
this is pretty cool
1:45 it also lets you store an image with a width or height of 0, even if the other dimension is not 0
Ok, this is crazy
Great video
Qoi may have been an image format worth considering.
You are a genius
Woah mister chill with the big words
Now there’re the caveats of the paint colours which can radically change the colours of the blocks and possibly improve image clarity significantly
Now I can’t wait to play terraria in minecraft
I'm so sorry, but if you had been mining about 50 blocks upwards you would have increased your chances of finding diamonds significantly. Mining right above bedrock is not great for diamonds.
Great pfp
False
the graphics are certainly something but my god the aesthetic is unparalleled.
Terraria: Try Minecraft!
Minecraft: Also try Terraria!
* Static sound. *
Terraria: WAIT-
Minecraft: NOT LIKE THIS-
* Demon core sounds. *
1:29 HOLY SHIT A DEV JUST REFUSED LITTLE ENDIAN LETS GOOOOOOOOOOO
1 minute in and this guy has already made an entire new file format💀
One thing you could try for a larger color palette (other than dot products as people have mentioned) is divide the 256x256x256 RGB cube into equally-sized cubes (ex. 64x64x64) with 1 Terraria block per cube, then integer divide each Minecraft pixel's rgb values by the cube size (ex. 64) and use them to refer to a 3D array of Terraria blocks. Basically constant-time lookup at that point, and 64x64x64 would allow for a 64-block palette I think
MAKE BAD APPLE :) in terraria for sure
Funny Project, I might have a idea to adjust the color rendering speeds, which would also make it possible to add more variations
Did u try to split your big table of colors into smaller ones?
Idk if it is doable to sort the coloring to sub tables, but if yes u could safe like alot of time for each pixel, so you search like a equal thing on the colors or like a range or smth
and then u can check if the desired color for this pixel is inside of this sub table
if the sub tables still have like alot objects, u could try to put them in another table etc
Only a Conceptional Idea, cant promise its doable, but might be in my opinion
Soon enough we will have terraria inside terraria inside minecraft terraria
have you considered threading haha. sick project
now he just needs to play terraria in minecraft, and then use terraria to play minecraft to complete the loop
"playing" minecraft inside terraria.
Honestly thought any kind of game like this would likely come through to be able to display something, using some way to do it. Cool.
Real neat!
very cool
Now we need minecraft in minecraft in Terrarien
Chum sounds like a fancy bmp
You could have premade a lookup table for each colour, if you used 2 bytes per colour and excluded the alpha value then it'd only be around 35mb of ram, then you can store the block to map each rgb pixel to in a massive array and then you can look up the colour in constant time.
great video though!
To optimize transformation from color to block you could precompute the mapping of blocks (16mb of data is not much) into the array
you could cache the block palette in a lookup table so it would have to do it 16 milion times and after the entire lookup table it should run pretty smooth. it would be nice if you had access to the minecraft frame buffer but i don't know how hard that would be but it would be more efficient than taking a screenshot then encoding it in a different format
now we need playing terraria in minecraft!
Been done before.
Instrad of doing euclidian distances to find the best block, you could do a dot product and pick the greatest value.
Performing dot product by many vectors at the same time is a matrix multiplication and it would be very efficient to do thzt in numpy. At least more so than looping xD
you could try using the dot product for the palette, less expensive to compute afaik and maybe even more accurate
It would be cool if you gave this tech to Luke The Notable , i am sure he is notable enough to survive 100 days in it , maybe even beat the game .
Now we just have to wait for somebody to make Minecraft in Terraria, in Minecraft.
Your work is amazig!
Appreciate it!
The fact that ive seen a playing Terraria inside minecraft and seeing this the day after
Terraria in minecraft is one thing, but this is just mad
We need to watch john on this
Perfect
Isn’t your .chum file just a slightly simplified .bmp?
I’m not sure, I looked into using BMPs to use but there was a lot of junk I didn’t need for my use case so I quickly abandoned the idea
It's not bmp its more like ppm
Lil bro really said lets add 3D dimension to Terraria 💀
You know what? I’m done.
(unpapers your minecraft)
🤓☝️Umm..Actually D in 3D means dimension so you don't have to write it again 🤓☝️
@@abdullaheta It was supposed to be 3rd but lazy to ad r
as a bro im shitting and farting a lil too much
@@LOL_MANNthats crazy
Just now need some how to play terraria in minecraft
No way checking his channel was the person who also created the "file storage on CZcams" video time ago when I wasn't even interested in Terraria and this video wasn't created. You for sure deserve my sub
Thank you! Really appreciate you sticking around since day one :)
Finally, actually 2D Minecraft
have you tried making in higher do frames per second, maybe deleting the screenshots after they are used? idk that just seemed like a cool idea
playing peak inside peak
Now you should make Terraria playable in Terraria
This was awesome! And also why would you do this to yourself x.x
It's evolving, just backwards.
Hell yeah someone has finally fixed terarria
Have you considered using your GPU to speed up the conversion of RGB values to terraria blocks in parallel? You could also try disabling smooth lighting in Minecraft to dumb down the colors and improve visibility in Terraria
An idea:
Instead of streaming the image from Minecraft - create a mod for Minecraft, which streams a slice of world from player into the -Z +Z direction. Stream that straight into the terraria worldgen class. Terraria's worldgen is not multithreaded (unlike Minecraft) so it should be easy to just suspend the thread to wait for the connection with Minecraft and just stream blocks right into the Terraria worldgen and map the blocks from one game to another (you could default to stone if a block is "exotic"). Then make the games communicate such that a move forward in terraria - moves your player in Minecraft forward. If you also handled destroying blocks - you technically can PLAY Minecraft from inside of Terraria.
Crafting could also be theoretically possible as Terraria has similar items as Minecraft - you would just need to map them. And Minecraft's Mobs could be spawned inside of terraria, but that would require overriding AI and a lot of work in general.
But the simple concept of walking on Minecraft's world in terraria is very possible.
If you're considering this - hit me up, I can help.
If i ever have to describe a migraine to someone imma show them your terraria display
Now imagine trying to run Terraria in Minecraft in Terraria
As an alternative to play minecraft with a controller, you could've used a small local Minecarft server.
You play minecraft in another computer that opens it's world in LAN.
Then, connect to that world in the computer you're gonna be recording and make the player spectate the server's host player, so you'll be seeing all of that player's actions and then, just stream that directly into terraria, while being able to play MC with no problems in the other computer.
This would be a cool affect from a potion or plant in Minecraft
congrats you are playing minecraft in 16 colors in terria
Bmps might also have been able to accomplish your image file needs
every block does have a color it displays on the map coded into the game, i assume those colors would be better to use if you were to upgrade this display
Maybe adding caching to the euclidean distance calculations could improve speed?
Warzone in viva pinata next pls
I love you Benjamin
What about trading resolution for palette/performance? Would that help?
Mans ended that video so fucking fast when he found Diamonds lmfaooooooooo
One creeper and this guys computer explodes
I am still in the beginning part of this video, but already wondering if you could use Terraria as a graphical shell for Linux lol.