I Wrote Minecraft for a Calculator

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this is a port of Minecraft running on a TI-84 now really you can place blocks move around save and load worlds all in real time on a device about a thousand times less powerful than a modern computer but full disclosure this isn't the first time the game Minecraft has been brought to a graphing calculator in fact there's a proud tradition of calculator Minecraft ports going back to at least 2011 from what I can tell a common Trend you'll find between all of these is that they use a 2d side view of the game rather than 3D one of the better ports I found was Minecraft 2D for the ti Inspire by Jens kolpinger despite being 2D it's a pretty extensive Port of the game with different game modes mobs crafting furnaces and more obviously it's not going to beat the PC version in terms of content but for a port of the game flattened down into 2D it's got enough to be compelling the other notable Port I found was crafty by vogtinator this one is probably the most impressive Port there is it's able to pack in full 3d Graphics chunk loading and even Redstone onto a calculator I'd say that program of the Year award from tikalc.org was well earned that being said there are some things about these two that I don't particularly care for for one crafty uses affine texture mapping instead of perspective which causes this really ugly warping to happen whenever you get too close to a block but more importantly both of these ports are only available on the ti Inspire which is someone who didn't have an Inspire going through High School makes me just a little salty so here's the goal get a 3D version of Minecraft running on the TI-84 and it's already a pretty tall order even though they look similar on the outside under the hood the TI-84 and Inspire couldn't be more different in terms of power the Inspire has 64 megabytes of ram which doesn't sound like much until you realize the TI-84 has 256 kilobytes the Inspire runs at nearly 400 megahertz in the latest model the d84 runs it 48 megahertz now let's be clear here that doesn't mean the Inspire is just eight times faster the Inspire is using a 32-bit arm processor whereas the 84 has a kinda 8-bit kinda 24-bit easy 80. the arm has way more registers and more powerful instructions which basically means that cycle for cycle the armchip can still do more work than the easy 80. about the only thing even remotely similar between these two calculators is that they both have the same 320 by 240 pixel display Hardware with that in mind perspective 3D is basically out of the question it involves doing a bunch of projections and texture warpings to draw each face of a block and for a world with as many polygons as Minecraft a TI-84 would absolutely crawl but thankfully there is another way to do 3D that's been used in games as far back as the mid 80s isometric projection you can think of it like having the three 3D axes oriented like this each of the dimensions has a unique Direction so you can still perceive 3D structure even as we project down to 2D the big difference here from perspective 3D is that things don't change in size when they get closer or further away from the viewer and this ends up being a big help for games since we don't need to warp or scale an object to get it to look like it's moving around in 3D all it takes is sliding it around the screen something tile map and Sprite Hardware can do really fast that's why so many 3D retro games from Marvel Madness to Sonic 3D Blast to SimCity 2000 all use isometric Graphics you just need to render each object from one fixed perspective and you're good so let's make some isometric Sprites to use creating these 3D blocks out of 2D textures ends up being a pretty simple task you just take the 2D face of a block and shift all the pixels down from left to right it's similar for the right face and you do a slightly more complicated but still affine transformation for the top with that we now have some 2D Sprites of 3D blocks to play around with it's actually really simple to place them on the screen and get something that looks 3D even moving them around a you can see how nicely they all tile together the only real problem is that drawing the world like this on the calculator is slow take a look at this scene since almost every block is covered on one side we need to start from the back and draw all the way to the front otherwise the blocks will draw over each other in the wrong order like this for a typical Scene It takes up to 10 seconds to render in which is just unacceptable the problem is rendering this way wastes a lot of work drawing in pixels only to draw over them again later you can speed this up a little bit by avoiding drawing faces covered directly by their neighbors though that won't help for blocks further apart what we need is a fast way to be able to tell at each pixel what block is the one on top and only draw that one so here's the trick I worked out if you stare at the grid long enough you might begin to notice that each block can be divided into six equal sized triangular slices two for each face more importantly when projecting blocks from the 3D grid it should always line up on these triangular boundaries in fact we can actually represent the entire Minecraft world here as a triangular grid like this every time we place a block we fill in the Triangles around it and now we have a map to look up the closest block to the camera for any position on the screen now this representation alone can already make things a lot faster since it's cheaper to waste time writing 6 bytes to memory updating the grid compared to the 768 bytes it takes to write pixels to the screen and we can add more data to this grid to help keep track of things as we're drawing in this case for each triangle we can track the distance of the blocks on the grid to the camera normally when we're drawing in the world we need to start with the blocks all the way in the back and work our way forward so that any block that gets covered up is drawn before we draw the block that covers it but with a depth map we can just check and see if the block we're adding should be in front of or behind each tile if the depth of the block we're adding is greater than what's already there we skip it and if it's closer to the camera we draw it over top this lets us update the triangle Grid in any order and it'll be pretty helpful later on when we get around to the user placing blocks now this triangle grid here already helps speed up the graphics significantly going from 10 seconds to draw the full screen to under one second it's a pretty serious Improvement but still not enough to have animations like scrolling look smooth so time to dive into the technical stuff yet again the TI-84 doesn't have much by way of Graphics Hardware no Sprites no tile map about the only thing it does have is double buffering basically the Vroom is split into two sections so that one is shown on the screen and the other is invisible the idea is that watching things get drawn onto the screen would make things look flickery so instead we draw our Graphics to the back buffer then when we're done the screen makes a quick flip and starts showing that buffer while we start drawing the next frame in on the old buffer one thing you might have noticed is that it's pretty wasteful to redraw the whole screen when scrolling since thanks to the isometric perspective most of the image stays completely the same besides being shifted over a bit and that's a good observation because on the easy 80 it's much cheaper to copy pixels around than it is to run new ones in fact there's a hardware instruction that makes copying large chunks of memory super fast so when the program is scrolling the screen what it really does is copy most of the previous frame over to the other buffer then it fills in the empty bits around the edges altogether this saves a ton of time drawing The Scene It manages to get us up to frame rates of about 10 FPS it's probably the first time I've ever been happy to see Minecraft running at 10 frames per second but compared to the 10 seconds per frame we were dealing with earlier I'll take this speed in a heartbeat at this point things were starting to come together there's a 3D world you can look around a couple of different types of blocks I even added a function to create trees just to make things feel a little more alive but one thing I wanted to try to add to really make the graphics pop was water water is a pretty tricky thing to implement in the current system I have here I mean the cheap way is just to make a solid Blue Block and call it a day but that doesn't look very good since you can't actually see what's under the water the real Minecraft has transparent water and I simply refuse to be outdone problem is transparency on the TI-84 isn't really an option in a traditional Graphics pipeline transparency is pulled off by taking the current RGB color on the screen blending each of the components with another color and then replacing the original with the Blended color but here I'm using palletized or indexed color which means that I chose 256 colors to draw my Graphics beforehand and then each pixel I write is just an index into that palette like a paint by numbers the only way to get a specific RGB color is to find the closest one in the palette which would take too long to do for every pixel here's the thing though all the graphics you've been seeing so far were only made to use a quarter of the total palette space that's right I was sneakily planning ahead I figured the easiest way to find the color you want is to already have it in your palette so for each of the 64 colors used to draw this Minecraft world there are three other copies blended with blue for water black for shading and both for well both lay them out in the right order and adding shading or watercolor to a pixel is as easy as adding one bit to get the same color from a different palette now that it's easy to Tin pixels with different colors I threw in some water blocks and shaded the right faces of each block to give everything a bit more depth since I figured I had the graphics down pretty well I started moving my focus toward making this an actually playable game I added a little cursor Sprite for the player putting a block select GUI which takes advantage of my prior palette trickery to dim the background and finally added the ability to place and remove blocks into the world it wasn't quite as easy as I'm making it sound here but on the bright side the game now feels a lot more like Minecraft you can go around and build the obligatory dirt house or a pyramid of gold or even a Shameless attempted self-promotion the only real issue I saw at this point was that moving around the world it's not always easy to tell where things are in space that's the one big drawback to isometric projections like this since things don't shrink away with depth there's an ambiguity between 3D positions like if I place a block here and then move South and up and place a block here they end up in the same spot on the screen you can actually use this ambiguity to make some neat geometry like these impossible stairs but in terms of usability it makes it really hard to make sure you're placing blocks where you want to one quick fix I did was incorporating the depth map into the player Sprite so now if the cursor is behind the block it shows up as occluded it's not a perfect solution but it does let you line up with something familiar like the ground or a wall I did have one other idea though and that was to add Shadows originally I was just testing around with some graphics in taking screenshots I had generated in-game and hand drying Shadows over the top to see what they would look like and after a little bit I started to notice a pattern with regards to the triangle grid for each face of a block there are only four states the Shadows can be in totally empty totally shadowed or half shadowed on each side and surrendering Shadows on the Block really just boils down to picking which Shadow pattern to use and then combining a pre-drawn shadow mask to the block texture using the same palette trick I used earlier for water in other words we can pick a block pick the effects we want to render on it and then combine all these textures together when drawing to get the Sprite we want the only tricky part now is figuring out which patterns we want to use the sunlight shines in from the top left side so for each block if there's something in between it and the Sun the block should be in Shadow in other words only the top leftmost block should be in the Sun but how do we tell which blocks those are well if you're starting to think this sounds like the visibility problem I had all the way back at the start you're completely right turns out it's the same exact question but rotated 90 degrees so I added another depth map but this one measures the distance of the closest block to the Sun for each triangle when adding in a block all you have to do is check if it's at the top of the depth map and if not draw it in Shadow I think these Shadows do a lot to make these Graphics look aesthetically pleasing on one hand they're functional since they give some cues to help you resolve depth but they're also good at adding a little bit of variety in Worlds with lots of repeated textures plus I don't know in some places they give off a bit of a moody Vibe or at least as Moody as the bright colors a Minecraft can be anyways it's something the original Minecraft doesn't have so check mate Mojang and now it's time for the rest of the owl part of the video we're adding a bunch of less interesting parts to finish this thing out stuff like adding save support or a nicer cursor Sprite putting in a main menu and also some more natural looking World Gym plus lots and lots of little bug fixes to cover the Myriad ways water and shadows can interact here's what I ended up with a realistic world where you can scroll around and build things Everything feels pretty quick and responsive in the graphics for a calculator look pretty good in fact I actually think isometric Minecraft looks best on a tiny screen like this being able to see the whole world makes everything seem small but zoomed in like this if it's just about right now obviously this Minecraft Port is missing a lot even compared to other Minecraft ports there's no Redstone no mobs basically nothing Dynamic like Falling Sand or flowing water but I think there's a pleasant Simplicity to it regardless at least that's the excuse I'm going with kind of evokes a Minecraft classic Vibe back when the whole point of the game was just to build things in fact in some sense it's a lot like classic trees they might to cram in as many textures as I can there are only 24 different blocks to play with here the 256k of memory fills up fast you know same thing with the world size I played around with a few different dimensions before settling on 48 by 16 by 48 is a reasonable space to play in it's just big enough for a device this small but it is an infinite I actually did think about adding a chunk loading system like in real Minecraft but the more I thought about it the more complex it sounded plus by the time I was debugging graphical glitches I was getting pretty worn down on this project and as the saying goes perfect is the enemy of good enough and hopefully this is good enough for everyone out there I mean it is free after all you get what you pay for but still it's a version of Minecraft you can play right on a TI-84 calculator it certainly met my expectations for this project and I gotta say it is pretty fun to build stuff in my apologies in advance to all the High School Math teachers who are bound to catch students playing this instead of paying attention save this game for after class promise okay but anyways there you have it 3D MineCraft finally available for the first time ever on the TI-84 download the link in the description except a funny thing that turns out just about a month after I started working on my version of Minecraft Michael 23b of the chem attack Farms released his own isometric Minecraft port for the TI-84 unfortunately wasn't able to get it running locally to try it out but going by the screenshots he posted it looks pretty nice it has some features I didn't Implement in mind like Redstone and gravity and the lighting system is pretty impressive no other way to put it that's a massive L for me so I'll have to be content instead with making the second 3D Port of Minecraft for the TI-84 and you know what I'll take it foreign [Music]
Info
Channel: The Science Elf
Views: 1,384,771
Rating: undefined out of 5
Keywords:
Id: Bj9CiMO66xk
Channel Id: undefined
Length: 14min 43sec (883 seconds)
Published: Mon Aug 28 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.