WEBVTT
Kind: captions
Language: en

00:00:00.160 --> 00:00:04.400
Every block in this Minecraft world&nbsp;
is a file on my computer. This means&nbsp;&nbsp;

00:00:04.400 --> 00:00:08.000
that the arrangement of files on my&nbsp;
hard drive determines the landscape,&nbsp;&nbsp;

00:00:08.000 --> 00:00:12.080
and yes, breaking blocks in-game&nbsp;
deletes the files from my system.

00:00:12.080 --> 00:00:15.040
In this video, we’ll take a&nbsp;
look at how I made this happen,&nbsp;&nbsp;

00:00:15.040 --> 00:00:18.640
and we’ll try to see what it would&nbsp;
take to break your computer this way.

00:00:18.640 --> 00:00:22.400
Before we can get into all of the fun stuff&nbsp;
like terrain generation, we first have to figure&nbsp;&nbsp;

00:00:22.400 --> 00:00:27.840
out how to interface with the game. The obvious&nbsp;
solution would be to create a mod, but that would&nbsp;&nbsp;

00:00:27.840 --> 00:00:33.360
require learning a new modding API. Even so, the&nbsp;
tools that do exist are geared towards gameplay&nbsp;&nbsp;

00:00:33.360 --> 00:00:39.520
mods, such as adding items or crafting recipes.&nbsp;
We’re gonna be going way outside of that box.

00:00:39.520 --> 00:00:44.480
For a moment, I considered using the code from my&nbsp;
last project about the world’s smallest Minecraft&nbsp;&nbsp;

00:00:44.480 --> 00:00:48.000
server – do check out that video if you’re&nbsp;
interested. Since I’m intimately familiar&nbsp;&nbsp;

00:00:48.000 --> 00:00:52.160
with that codebase, It would be fairly&nbsp;
trivial to change how the game works. And,&nbsp;&nbsp;

00:00:52.160 --> 00:00:57.360
by the nature of that project, it would also&nbsp;
be relatively lightweight and performant.

00:00:57.360 --> 00:01:02.000
However, the one major downside of this&nbsp;
is the limited feature set that comes&nbsp;&nbsp;

00:01:02.000 --> 00:01:06.000
with a custom server. What if I want&nbsp;
to blow up my files with TNT or spawn&nbsp;&nbsp;

00:01:06.000 --> 00:01:10.960
a Wither? Both of these are things&nbsp;
that my Bareiron server cannot do.

00:01:10.960 --> 00:01:16.240
So, the solution I ended up with was to&nbsp;
directly modify the level data. After all,&nbsp;&nbsp;

00:01:16.240 --> 00:01:20.480
that’s really all that my program needs to&nbsp;
do – convert the file tree to blocks in-game,&nbsp;&nbsp;

00:01:20.480 --> 00:01:23.280
and read those blocks to&nbsp;
see if any have been broken.

00:01:23.280 --> 00:01:26.800
Now, you’d think that something as popular&nbsp;
as Minecraft would have dozens of tools&nbsp;&nbsp;

00:01:26.800 --> 00:01:30.960
for parsing level data. And, for the&nbsp;
most part, you’d be technically right.

00:01:30.960 --> 00:01:35.600
I did find a Python tool that claimed to&nbsp;
do just that, but every query just turned&nbsp;&nbsp;

00:01:35.600 --> 00:01:39.760
up empty. Similarly, there’s a JavaScript&nbsp;
tool that claims to parse region files,&nbsp;&nbsp;

00:01:39.760 --> 00:01:43.760
but that one crashes with errors about&nbsp;
compression. I did try switching to a&nbsp;&nbsp;

00:01:43.760 --> 00:01:48.080
version of the game that would’ve been out&nbsp;
when these tools released, but no dice.

00:01:48.080 --> 00:01:53.720
So, when none of the tools you need are available,&nbsp;
the only choice you’ve got is to give up…

00:01:53.720 --> 00:01:56.480
... and write one yourself.

00:01:56.480 --> 00:02:00.160
Yeah, it’s not the cleanest thing in the&nbsp;
world, but it gets the job done – this&nbsp;&nbsp;

00:02:00.160 --> 00:02:04.720
cobbled-together pair of functions can read and&nbsp;
write level data just well enough to be viable&nbsp;&nbsp;

00:02:04.720 --> 00:02:09.920
for what I intend to do. Thus, the next&nbsp;
step is to figure out terrain generation.

00:02:09.920 --> 00:02:12.880
Now, I have already covered procedural&nbsp;
generation on this channel before,&nbsp;&nbsp;

00:02:12.880 --> 00:02:16.240
in that same video about the world’s&nbsp;
smallest Minecraft server. But this&nbsp;&nbsp;

00:02:16.240 --> 00:02:20.800
time is a bit different. Instead of generating&nbsp;
a noise gradient and converting that to blocks,&nbsp;&nbsp;

00:02:20.800 --> 00:02:24.880
I’ll be using a recursive approach&nbsp;
that generates one block at a time.

00:02:24.880 --> 00:02:29.760
This is a lot less efficient, but since we only&nbsp;
have to do this once while generating the terrain,&nbsp;&nbsp;

00:02:29.760 --> 00:02:34.800
I don’t really mind how long it takes. The&nbsp;
crucial benefit of this technique is control.&nbsp;&nbsp;

00:02:34.800 --> 00:02:40.480
I want the shape of the terrain to resemble the&nbsp;
layout of files on my computer. In other words,&nbsp;&nbsp;

00:02:40.480 --> 00:02:43.520
I want nearby blocks to represent nearby files,&nbsp;&nbsp;

00:02:43.520 --> 00:02:48.800
and distant blocks to represent&nbsp;
distant files. Here’s how that works.

00:02:48.800 --> 00:02:52.080
Assume for a moment that we’ve got a&nbsp;
list of all of the files on my computer,&nbsp;&nbsp;

00:02:52.080 --> 00:02:55.520
sorted by their distance to each other.&nbsp;
Every now and then, there’s a break in&nbsp;&nbsp;

00:02:55.520 --> 00:02:59.360
the list separating distinct sections,&nbsp;
such as major folders. We’ll get to how&nbsp;&nbsp;

00:02:59.360 --> 00:03:02.960
I got this list in just a moment, but&nbsp;
for now, that’s all you need to know.

00:03:02.960 --> 00:03:07.200
Our algorithm also has two more&nbsp;
lists – one containing open block&nbsp;&nbsp;

00:03:07.200 --> 00:03:10.320
positions that we plan to consider,&nbsp;
and one containing the blocks that&nbsp;&nbsp;

00:03:10.320 --> 00:03:15.200
we’ve already placed. These lists start out&nbsp;
nearly empty, with the only exception being&nbsp;&nbsp;

00:03:15.200 --> 00:03:20.240
a starting point in the “open” list.&nbsp;
This is where our algorithm begins.

00:03:20.240 --> 00:03:22.880
First, we grab the leftmost element of the “open”&nbsp;&nbsp;

00:03:22.880 --> 00:03:27.360
list – that’s our starting point – and we&nbsp;
pair it up with a file from the file list.

00:03:27.360 --> 00:03:32.560
Then, we generate 6 new neighbors on each side&nbsp;
of this block, and add them to the “open” list.

00:03:32.560 --> 00:03:34.960
Our current node has now&nbsp;
entered the “closed” list,&nbsp;&nbsp;

00:03:34.960 --> 00:03:39.760
and has officially become part of the&nbsp;
terrain. That’s the end of this iteration.

00:03:39.760 --> 00:03:43.920
For the next iteration, we once again&nbsp;
grab the first element of the “open” list,&nbsp;&nbsp;

00:03:43.920 --> 00:03:47.360
this time a neighbor of the first&nbsp;
block, and assign it a file.

00:03:47.360 --> 00:03:50.480
After that, we again generate&nbsp;
up to 6 new neighbors,&nbsp;&nbsp;

00:03:50.480 --> 00:03:53.840
making sure that none of them&nbsp;
overlap with existing elements.

00:03:53.840 --> 00:03:58.160
Let’s fast-forward a bit to see how this&nbsp;
algorithm takes its shape. You’ll quickly&nbsp;&nbsp;

00:03:58.160 --> 00:04:01.600
start to notice that this looks nothing&nbsp;
like Minecraft terrain. By default,&nbsp;&nbsp;

00:04:01.600 --> 00:04:06.320
this algorithm naturally generates these diamond&nbsp;
shapes. That’s because, if you think about it,&nbsp;&nbsp;

00:04:06.320 --> 00:04:11.520
all we’re really doing is iteratively mapping out&nbsp;
the shortest distance to the next available point.&nbsp;&nbsp;

00:04:11.520 --> 00:04:16.880
Normally, that would create a sphere. But in this&nbsp;
cube-based world, we get the next best thing.

00:04:16.880 --> 00:04:21.760
To flatten this out a bit, we can simply make&nbsp;
vertical neighbors less likely to generate.&nbsp;&nbsp;

00:04:21.760 --> 00:04:26.480
This definitely helps on the surface, but&nbsp;
laterally we’ve still got the same problem.&nbsp;&nbsp;

00:04:26.480 --> 00:04:31.440
The way I fixed this was to randomly inhibit&nbsp;
generating neighbors in one of four cardinal&nbsp;&nbsp;

00:04:31.440 --> 00:04:35.680
directions. That has the effect of&nbsp;
rounding down those sharp corners,&nbsp;&nbsp;

00:04:35.680 --> 00:04:39.520
which eventually forms a somewhat&nbsp;
believable-looking island.

00:04:39.520 --> 00:04:45.520
Let’s keep going until we reach the first section&nbsp;
break in the file list. This indicates a big jump&nbsp;&nbsp;

00:04:45.520 --> 00:04:50.240
in the semantic significance to our next file.&nbsp;
Because of this, we’ll be clearing the “open”&nbsp;&nbsp;

00:04:50.240 --> 00:04:55.680
list and starting fresh from just the current&nbsp;
node. This has the effect of creating a new island&nbsp;&nbsp;

00:04:55.680 --> 00:05:00.720
connected to the previous one, yet still visually&nbsp;
distinct enough to indicate a new section.

00:05:00.720 --> 00:05:06.080
Now, full disclosure, this is likely not the best&nbsp;
way to generate terrain. Not even close. I chose&nbsp;&nbsp;

00:05:06.080 --> 00:05:10.160
this method because it lets me incorporate&nbsp;
the file structure into the shape of the&nbsp;&nbsp;

00:05:10.160 --> 00:05:14.560
terrain. Even so, I’m sure there’ll be plenty of&nbsp;
armchair experts in the comments telling me how&nbsp;&nbsp;

00:05:14.560 --> 00:05:18.800
to do this properly, but I just don’t think&nbsp;
it matters for the sake of what I’m doing.

00:05:18.800 --> 00:05:23.600
Finally, let’s get back to how I built that&nbsp;
file list. If you think about it, the files on&nbsp;&nbsp;

00:05:23.600 --> 00:05:28.960
your computer couldn’t be further from a linear&nbsp;
list. Rather, the data structure they represent&nbsp;&nbsp;

00:05:28.960 --> 00:05:35.280
is a tree. To extract a list from a tree, you&nbsp;
can apply one of many tree-search algorithms.&nbsp;&nbsp;

00:05:35.280 --> 00:05:39.760
If you’ve ever formally studied computer&nbsp;
science, you’ll have heard of these ad nauseam.

00:05:39.760 --> 00:05:44.240
In this case, we’ll be using depth-first search,&nbsp;
which involves diving as deep into the tree&nbsp;&nbsp;

00:05:44.240 --> 00:05:49.360
as is possible before noting down what you find.&nbsp;
By the way, the inverse of this algorithm, which&nbsp;&nbsp;

00:05:49.360 --> 00:05:54.080
is breadth-first search, was what I described&nbsp;
earlier for generating the actual terrain.

00:05:54.080 --> 00:05:57.920
Anyway, this process naturally puts&nbsp;
adjacent nodes next to each other&nbsp;&nbsp;

00:05:57.920 --> 00:06:02.400
in the list, while nodes from completely&nbsp;
different branches end up far apart. And,&nbsp;&nbsp;

00:06:02.400 --> 00:06:08.400
to create that “separator”, we just have to&nbsp;
cut the branches somewhat high up in the tree.

00:06:08.400 --> 00:06:13.040
Here’s what this whole thing looks like in-game.&nbsp;
The different colors of wool represent the&nbsp;&nbsp;

00:06:13.040 --> 00:06:17.760
different groups of files. You’ll also notice that&nbsp;
some islands are floating off on their own – this&nbsp;&nbsp;

00:06:17.760 --> 00:06:22.400
is due to a fallback system, used when a new&nbsp;
group of files doesn’t have space to generate&nbsp;&nbsp;

00:06:22.400 --> 00:06:27.840
on a previous island. On its own, this is already&nbsp;
a pretty cool visualization of my file system,&nbsp;&nbsp;

00:06:27.840 --> 00:06:34.000
but we’re not stopping here. My ultimate goal&nbsp;
is to turn this into a playable skyblock world.

00:06:34.000 --> 00:06:39.280
First, let’s paint the surface. We’ll replace all&nbsp;
of the wool with grass, except for the blocks that&nbsp;&nbsp;

00:06:39.280 --> 00:06:44.400
are covered – those will become dirt. This makes&nbsp;
apparent another issue that makes these islands&nbsp;&nbsp;

00:06:44.400 --> 00:06:48.960
look uncanny – there are lots of these jagged&nbsp;
puzzle-piece patterns all across the surface,&nbsp;&nbsp;

00:06:48.960 --> 00:06:52.880
which are very different from the relatively&nbsp;
smooth terrain of vanilla Minecraft.

00:06:52.880 --> 00:06:56.000
This is where I took&nbsp;
inspiration from an old friend:

00:06:56.000 --> 00:06:59.760
“The best solution to a problem&nbsp;
is usually the easiest one.”

00:06:59.760 --> 00:07:05.760
So, with that in mind, I solved this by simply&nbsp;
moving these lonely blocks closer to each other.&nbsp;&nbsp;

00:07:05.760 --> 00:07:10.800
There’s no fancy math here, it really is just as&nbsp;
crude as it sounds. Again, this is not the best&nbsp;&nbsp;

00:07:10.800 --> 00:07:16.560
way to solve this problem, but for a program that&nbsp;
only has to run once, it really doesn’t matter.

00:07:16.560 --> 00:07:21.280
Next, it was time to add some foliage. You’ll&nbsp;
notice that our current algorithm doesn’t really&nbsp;&nbsp;

00:07:21.280 --> 00:07:27.360
support landscape features like trees. All it does&nbsp;
is carve out a general shape for each island. You&nbsp;&nbsp;

00:07:27.360 --> 00:07:31.520
might think that fixing this is just a matter&nbsp;
of sprinkling in some trees after the fact,&nbsp;&nbsp;

00:07:31.520 --> 00:07:36.480
but that doesn’t let us assign relevant&nbsp;
files to the blocks in that tree.

00:07:36.480 --> 00:07:40.000
Instead, when generating the&nbsp;
terrain, at random points in time,&nbsp;&nbsp;

00:07:40.000 --> 00:07:45.200
I set aside exactly 62 files from the current&nbsp;
list, and note down the coordinates of the&nbsp;&nbsp;

00:07:45.200 --> 00:07:49.120
current node. This is so that, after the&nbsp;
whole segment has finished generating,&nbsp;&nbsp;

00:07:49.120 --> 00:07:54.080
I can plant those trees on the surface and&nbsp;
map them to semantically relevant files.

00:07:54.080 --> 00:07:59.280
This already makes a huge difference to the&nbsp;
overall vibe of the islands, but we’re still not&nbsp;&nbsp;

00:07:59.280 --> 00:08:05.200
done. What we’re missing now are bodies of water&nbsp;
on the surface, and precious metals under ground.

00:08:05.200 --> 00:08:10.400
For water, I actually just repurposed the same&nbsp;
algorithm used for generating the terrain. Except,&nbsp;&nbsp;

00:08:10.400 --> 00:08:15.200
instead of growing blocks outward, it’s carving&nbsp;
blocks inward. This is why you’ll often find&nbsp;&nbsp;

00:08:15.200 --> 00:08:20.160
the same puzzle-piece pattern on the edges. But,&nbsp;
unlike before, we can’t just shift these blocks&nbsp;&nbsp;

00:08:20.160 --> 00:08:24.960
around, as that would require either breaking the&nbsp;
barrier and introducing new blocks unaccounted&nbsp;&nbsp;

00:08:24.960 --> 00:08:31.360
for, or even worse – replacing a water block, thus&nbsp;
completely eliminating a file from the mapping.

00:08:31.360 --> 00:08:36.400
Ultimately, I found that this probably isn’t a big&nbsp;
enough issue to bother worrying about. Instead,&nbsp;&nbsp;

00:08:36.400 --> 00:08:40.480
I turned my attention to shaping&nbsp;
the area underneath the surface.

00:08:40.480 --> 00:08:44.560
The first order of business was to add&nbsp;
stone by converting all dirt more than&nbsp;&nbsp;

00:08:44.560 --> 00:08:48.800
3 blocks below the surface. For ores,&nbsp;
the easy way out would’ve been to just&nbsp;&nbsp;

00:08:48.800 --> 00:08:53.280
randomly pepper them throughout this&nbsp;
volume, but that’s not very Minecrafty.

00:08:53.280 --> 00:08:58.000
Instead, veins are grown by taking steps&nbsp;
in random directions, kind of like a snake,&nbsp;&nbsp;

00:08:58.000 --> 00:09:02.800
for a random amount of iterations. This is&nbsp;
still not exactly how Minecraft does it,&nbsp;&nbsp;

00:09:02.800 --> 00:09:06.800
but in casual gameplay the results&nbsp;
are practically indistinguishable.

00:09:06.800 --> 00:09:11.840
Lastly, before we get to blowing up the&nbsp;
world and my computer in spectacular fashion,&nbsp;&nbsp;

00:09:11.840 --> 00:09:15.920
it would be nice to know what file&nbsp;
is associated with each block.

00:09:15.920 --> 00:09:18.880
Now, as a reminder, this&nbsp;
isn’t a native Minecraft mod,&nbsp;&nbsp;

00:09:18.880 --> 00:09:23.600
so I can’t easily add an on-screen display&nbsp;
telling me which block I’m looking at,

00:09:23.600 --> 00:09:25.440
or can I?

00:09:25.440 --> 00:09:31.600
I mean, I have all of the level data, so all&nbsp;
I’m missing is information about the player.

00:09:31.600 --> 00:09:35.760
Did you know that by pressing F3&nbsp;
and C, a chat command containing&nbsp;&nbsp;

00:09:35.760 --> 00:09:40.000
your current position and angles is&nbsp;
copied to your clipboard? My program&nbsp;&nbsp;

00:09:40.000 --> 00:09:45.280
can then automatically read the contents&nbsp;
of the clipboard and extract these values.

00:09:45.280 --> 00:09:49.840
With this, we can model a pretty good&nbsp;
approximation of the player’s camera in relation&nbsp;&nbsp;

00:09:49.840 --> 00:09:55.600
to their surrounding blocks. All that’s left is&nbsp;
to detect which block is in direct line of sight.

00:09:55.600 --> 00:09:59.280
Checking when a line goes through an&nbsp;
object is a very common problem in&nbsp;&nbsp;

00:09:59.280 --> 00:10:03.040
game development. There are tons&nbsp;
of algorithms that do just that.

00:10:03.040 --> 00:10:08.400
The naive approach would be to check points&nbsp;
along this line in regular steps. In most cases,&nbsp;&nbsp;

00:10:08.400 --> 00:10:11.440
this is good enough, but in certain situations,&nbsp;&nbsp;

00:10:11.440 --> 00:10:16.320
those points can easily overshoot&nbsp;
or undershoot the edge of a block.

00:10:16.320 --> 00:10:21.360
On the other hand, fancier algorithms that do&nbsp;
full ray-to-axis-aligned-box collision detection&nbsp;&nbsp;

00:10:21.360 --> 00:10:26.400
will quickly get overwhelmed by the hundreds&nbsp;
of thousands of blocks present in the scene.

00:10:26.400 --> 00:10:30.960
What we’re looking for is a cheap, iterative&nbsp;
algorithm that doesn’t miss the edges of&nbsp;&nbsp;

00:10:30.960 --> 00:10:36.400
blocks. And for that, there’s the&nbsp;
3D Digital Differential Analyzer.

00:10:36.400 --> 00:10:39.120
Yeah, it’s... not as bad as it sounds.

00:10:39.120 --> 00:10:42.880
Basically, this is almost the same&nbsp;
algorithm that’s used for drawing&nbsp;&nbsp;

00:10:42.880 --> 00:10:47.360
straight lines on your screen. The only&nbsp;
difference is that, instead of 2D pixels,&nbsp;&nbsp;

00:10:47.360 --> 00:10:52.320
it assumes a grid of 3D voxels,&nbsp;
just like the blocks in Minecraft.

00:10:52.320 --> 00:10:56.480
For us, this means that looking&nbsp;
at a block and pressing "F3 + C"&nbsp;&nbsp;

00:10:56.480 --> 00:10:59.040
will instantly print information about the block,&nbsp;&nbsp;

00:10:59.040 --> 00:11:05.920
and the file it’s associated with. Now all that’s&nbsp;
left is to introduce the destructive element.

00:11:05.920 --> 00:11:09.200
Simply put, I want the program to&nbsp;
detect when a block has been broken,&nbsp;&nbsp;

00:11:09.200 --> 00:11:12.880
and react to that by deleting&nbsp;
the file associated with it.

00:11:12.880 --> 00:11:17.280
So, let’s start with detection. While it might&nbsp;
seem simple enough to just repeatedly scan the&nbsp;&nbsp;

00:11:17.280 --> 00:11:21.280
game’s region files for any changes,&nbsp;
it’s easy to underestimate the sheer&nbsp;&nbsp;

00:11:21.280 --> 00:11:27.440
amount of blocks that need to be checked.&nbsp;
Each region houses a 32-by-32 chunk area,&nbsp;&nbsp;

00:11:27.440 --> 00:11:36.080
which comes out to 1024 individual chunks. Each&nbsp;
of those chunks contains 16-by-16-by-384 blocks,&nbsp;&nbsp;

00:11:36.080 --> 00:11:43.440
which multiplies to just under 100,000 blocks&nbsp;
per chunk, leaving a total of one hundred million&nbsp;&nbsp;

00:11:43.440 --> 00:11:49.200
blocks per region file. And, by default,&nbsp;
there are 4 region files in an empty world.

00:11:49.200 --> 00:11:53.440
To avoid some very expensive repeat&nbsp;
calculations, I first compute a hash&nbsp;&nbsp;

00:11:53.440 --> 00:11:56.720
of the region file to check if it’s even&nbsp;
changed since the last time I checked,&nbsp;&nbsp;

00:11:56.720 --> 00:12:01.920
before computing a hash of the chunk data to see&nbsp;
if that has changed, and only then do I actually&nbsp;&nbsp;

00:12:01.920 --> 00:12:07.680
parse the chunk to see what has changed. This way,&nbsp;
if either the chunk or the region hash turns up&nbsp;&nbsp;

00:12:07.680 --> 00:12:12.400
identical to my previous query, I can be&nbsp;
sure that there’s no reason to keep going.

00:12:12.400 --> 00:12:16.960
Now on to actually deleting the files. If you&nbsp;
thought this was going to be as simple as running&nbsp;&nbsp;

00:12:16.960 --> 00:12:22.640
one command, boy were you wrong. I mean, yes,&nbsp;
most files can be deleted this way, even without&nbsp;&nbsp;

00:12:22.640 --> 00:12:27.600
special permissions, but what about the files&nbsp;
that are actively in use by a running program?

00:12:27.600 --> 00:12:32.560
Windows just outright refuses the operation,&nbsp;
and while Linux seems capable of doing it,&nbsp;&nbsp;

00:12:32.560 --> 00:12:39.040
it’ll actually secretly keep that file alive until&nbsp;
no programs are using it anymore. So, clearly,&nbsp;&nbsp;

00:12:39.040 --> 00:12:46.160
to ensure maximum chaos, the only solution is to&nbsp;
kill any and all programs that get in the way.

00:12:46.160 --> 00:12:50.640
This is actually not that hard to do – you can&nbsp;
quite often trivially get the IDs of programs&nbsp;&nbsp;

00:12:50.640 --> 00:12:55.040
holding a given file handle, and issue&nbsp;
a signal that forces them to shut down.

00:12:55.600 --> 00:13:00.080
Now, before we get to the juicy gameplay,&nbsp;
I want to take a step back and appreciate&nbsp;&nbsp;

00:13:00.080 --> 00:13:05.040
how this project came to be. The idea of&nbsp;
mapping Minecraft blocks to files is not&nbsp;&nbsp;

00:13:05.040 --> 00:13:09.040
that extraordinary. I’m sure plenty of&nbsp;
you have had similar ideas in the past,&nbsp;&nbsp;

00:13:09.040 --> 00:13:12.560
but the true value is in&nbsp;
making that idea come to life.

00:13:12.560 --> 00:13:17.520
And that is a skill you can learn with&nbsp;
the sponsor of this video, Coddy.Tech.

00:13:17.520 --> 00:13:22.480
Coddy offers interactive lessons on many of the&nbsp;
relevant programming languages of today. But,&nbsp;&nbsp;

00:13:22.480 --> 00:13:27.280
since my project is written in JavaScript, let&nbsp;
me show you what it would be like to learn that.

00:13:27.280 --> 00:13:31.600
If you’re a total beginner, you can start at&nbsp;
the very top and learn the very basics of your&nbsp;&nbsp;

00:13:31.600 --> 00:13:35.680
first programming language. Each lesson&nbsp;
explains exactly what you’re learning,&nbsp;&nbsp;

00:13:35.680 --> 00:13:39.200
tells you exactly what you’re supposed&nbsp;
to do, and gives you the opportunity to&nbsp;&nbsp;

00:13:39.200 --> 00:13:43.760
learn by doing while you write actual&nbsp;
code. If you don’t feel like reading,&nbsp;&nbsp;

00:13:43.760 --> 00:13:48.800
no problem – lessons have a “TL;DR” button that&nbsp;
leaves you with just the most crucial bits.

00:13:48.800 --> 00:13:51.920
And here’s the thing – if you’re not a&nbsp;
beginner, or if you feel like things are&nbsp;&nbsp;

00:13:51.920 --> 00:13:56.800
going too slow, Coddy lets you jump ahead&nbsp;
to whichever task best matches your pace.

00:13:56.800 --> 00:13:59.520
To keep you motivated,&nbsp;
they’ve got a streak system,&nbsp;&nbsp;

00:13:59.520 --> 00:14:04.000
daily personalized challenges tailored&nbsp;
to your experience, a weekly leaderboard,&nbsp;&nbsp;

00:14:04.000 --> 00:14:08.720
achievements, and a bunch more tools to keep&nbsp;
you focused on becoming a better programmer.

00:14:08.720 --> 00:14:13.520
If Coddy sounds right for you, sign up&nbsp;
today by using the link in the description.

00:14:13.520 --> 00:14:18.480
Finally, the time has come to try this out&nbsp;
in a real survival mode game. I started this&nbsp;&nbsp;

00:14:18.480 --> 00:14:22.640
up in a virtual machine running Debian with&nbsp;
some basic tools and utilities. From there,&nbsp;&nbsp;

00:14:22.640 --> 00:14:26.400
I spent some time mining, exploring&nbsp;
different islands, fighting mobs,&nbsp;&nbsp;

00:14:26.400 --> 00:14:30.240
all while periodically checking whether&nbsp;
I had broken anything important.

00:14:30.240 --> 00:14:33.760
After half an hour had passed with&nbsp;
no noticeable damage to the system,&nbsp;&nbsp;

00:14:33.760 --> 00:14:39.440
I decided to speed things up a bit. But even with&nbsp;
the ability to summon vast destructive power,&nbsp;&nbsp;

00:14:39.440 --> 00:14:45.440
there were still way too many islands to take&nbsp;
care of by myself. So, I went and got some help.

00:14:45.440 --> 00:14:50.720
I went live on Twitch, got 8 VIP members together&nbsp;
in one world, and pretty much just let them&nbsp;&nbsp;

00:14:50.720 --> 00:14:55.440
go wild. I had a terminal window on-screen&nbsp;
showing them which files are being deleted,&nbsp;&nbsp;

00:14:55.440 --> 00:14:59.440
along with the coordinates of the associated&nbsp;
blocks. Don’t mind the red error messages,&nbsp;&nbsp;

00:14:59.440 --> 00:15:03.200
by the way – this is just a visual bug,&nbsp;
the files are actually being deleted.

00:15:03.200 --> 00:15:07.200
After about an hour into the stream, we&nbsp;
had not only deleted some basic command&nbsp;&nbsp;

00:15:07.200 --> 00:15:11.360
line tools, but also the default&nbsp;
package manager for Debian. And,&nbsp;&nbsp;

00:15:11.360 --> 00:15:16.480
10 minutes after that, Firefox was gone.&nbsp;
So was LibreOffice, and the file manager,&nbsp;&nbsp;

00:15:16.480 --> 00:15:21.600
and many other tools. But, since the&nbsp;
server was still alive, we kept going.

00:15:21.600 --> 00:15:25.840
Since we were practically in the endgame now,&nbsp;
where everything could fall apart at any moment,&nbsp;&nbsp;

00:15:25.840 --> 00:15:30.240
I decided to give everyone on the&nbsp;
server two stacks of TNT. And,&nbsp;&nbsp;

00:15:30.240 --> 00:15:33.920
mere minutes after that, the run was over.

00:15:33.920 --> 00:15:38.720
A critical library had been struck, which was&nbsp;
required for the operation of not just my program,&nbsp;&nbsp;

00:15:38.720 --> 00:15:42.960
but for pretty much every meaningful part&nbsp;
of the system. Minecraft was still running,&nbsp;&nbsp;

00:15:42.960 --> 00:15:47.920
but no other programs could be launched.&nbsp;
Even the restart button didn’t do anything,&nbsp;&nbsp;

00:15:47.920 --> 00:15:52.240
and neither did the “reboot” command.&nbsp;
I forcefully shut down and restarted&nbsp;&nbsp;

00:15:52.240 --> 00:15:57.360
the virtual machine, which, of&nbsp;
course, didn’t get very far.

00:15:57.360 --> 00:16:00.160
"Yeah, that is not booting."

00:16:00.160 --> 00:16:03.200
"We got GRUB!"

00:16:03.200 --> 00:16:06.880
"Heyy, we got a... we got a GRUB recovery shell!"

00:16:06.880 --> 00:16:12.560
I did also do a second round on a fresh VM, this&nbsp;
time with creative mode. The problem now was that&nbsp;&nbsp;

00:16:12.560 --> 00:16:18.080
my program couldn’t keep up with the sheer volume&nbsp;
of blocks being evaporated by the hordes of Ender&nbsp;&nbsp;

00:16:18.080 --> 00:16:23.280
Dragons, Withers, Ghasts, and artificially&nbsp;
juiced-up Creepers. So while literally all&nbsp;&nbsp;

00:16:23.280 --> 00:16:28.640
of the land was gone within 15 minutes, the&nbsp;
system still remained functional for a while.

00:16:28.640 --> 00:16:33.200
I did end up fixing this slowdown by processing&nbsp;
all of the blocks within a chunk asynchronously.&nbsp;&nbsp;

00:16:33.200 --> 00:16:36.800
This made things a lot laggier for&nbsp;
my underpowered virtual machine,&nbsp;&nbsp;

00:16:36.800 --> 00:16:39.520
but the good news is that on their third round,&nbsp;&nbsp;

00:16:39.520 --> 00:16:45.200
my viewers needed only 20 minutes in&nbsp;
survival to break the system beyond repair.

00:16:45.200 --> 00:16:50.640
Now, that’s all for the Linux side of things,&nbsp;
but what about Windows? Testing this was a bit&nbsp;&nbsp;

00:16:50.640 --> 00:16:54.480
more annoying, since I couldn’t actually run&nbsp;
Minecraft in the virtual machine. Instead,&nbsp;&nbsp;

00:16:54.480 --> 00:16:58.480
I had to set up a dedicated server that&nbsp;
I could connect to from the outside.

00:16:58.480 --> 00:17:02.160
I started out by just gathering basic&nbsp;
resources and exploring different parts&nbsp;&nbsp;

00:17:02.160 --> 00:17:06.480
of the islands. Eventually, I stumbled upon&nbsp;
a coal vein that happened to be linked to&nbsp;&nbsp;

00:17:06.480 --> 00:17:12.000
some files in System32. Naturally, this&nbsp;
island became my primary mining point.

00:17:12.000 --> 00:17:16.800
But after cleaning up a good chunk of both&nbsp;
the depths and surface of this region,&nbsp;&nbsp;

00:17:16.800 --> 00:17:20.640
I still couldn’t notice a single&nbsp;
change in the VM. I mean, I saw&nbsp;&nbsp;

00:17:20.640 --> 00:17:25.520
some important-sounding DLLs being deleted,&nbsp;
but everything seemed to work just fine.

00:17:25.520 --> 00:17:31.040
After about an hour of this, I decided to pivot&nbsp;
to digging up my home directory instead. If&nbsp;&nbsp;

00:17:31.040 --> 00:17:35.440
I couldn’t brick the whole system, I&nbsp;
wanted to at least crash the server.

00:17:35.440 --> 00:17:40.560
I eventually managed to hit a crucial stash of&nbsp;
links, which broke the task bar icon for Edge.&nbsp;&nbsp;

00:17:40.560 --> 00:17:45.360
But I couldn’t for the life of me find the&nbsp;
Java binary I was using to run the server.&nbsp;&nbsp;

00:17:45.360 --> 00:17:50.720
I had hit many adjacent Java executables, but was&nbsp;
practically dancing around the one that actually&nbsp;&nbsp;

00:17:50.720 --> 00:17:55.840
mattered. Even though I knew where to look, it&nbsp;
was like searching for a needle in a haystack.

00:17:55.840 --> 00:17:59.760
You know, it might’ve already been obvious&nbsp;
to some, but there aren’t actually that many&nbsp;&nbsp;

00:17:59.760 --> 00:18:03.920
mission-critical files in your system,&nbsp;
at least not compared to the total file&nbsp;&nbsp;

00:18:03.920 --> 00:18:08.400
count. In this regard, I think Linux was&nbsp;
easier to break because it’s simply less&nbsp;&nbsp;

00:18:08.400 --> 00:18:13.280
bloated. And even then half of the files we&nbsp;
were hitting were LibreOffice help documents.

00:18:13.280 --> 00:18:17.200
Anyway, after a very unfortunate&nbsp;
encounter with a Creeper,&nbsp;&nbsp;

00:18:17.200 --> 00:18:21.280
I decided to call it a day and do&nbsp;
a final check-in on the damage.

00:18:21.280 --> 00:18:26.160
The portable PrismLauncher installation&nbsp;
was missing a few DLLs, so I guess I did&nbsp;&nbsp;

00:18:26.160 --> 00:18:29.840
break at least one program. But&nbsp;
everything else seemed intact,&nbsp;&nbsp;

00:18:29.840 --> 00:18:33.200
even Edge still worked as long as&nbsp;
you launched it from the start menu.

00:18:33.200 --> 00:18:37.600
That said, I knew there was one thing&nbsp;
I could do that would definitely kill&nbsp;&nbsp;

00:18:37.600 --> 00:18:42.560
this machine – rebooting. I had not only&nbsp;
dug up a generous portion of System32,&nbsp;&nbsp;

00:18:43.200 --> 00:18:46.240
but I had also remember striking some&nbsp;
files that seemed to be related to&nbsp;&nbsp;

00:18:46.240 --> 00:18:50.320
system boot-up. There was just no&nbsp;
way this thing was coming back up.

00:18:50.320 --> 00:18:56.880
… until it did. And I don’t know how. This&nbsp;
genuinely baffles me, and on top of that,&nbsp;&nbsp;

00:18:56.880 --> 00:19:01.920
the amount of space that this whole process&nbsp;
cleaned up was only like 300 megabytes.

00:19:01.920 --> 00:19:05.840
I don’t know what the correct takeaway is&nbsp;
from all this, but to me, it just seems&nbsp;&nbsp;

00:19:05.840 --> 00:19:11.360
like Windows is way too bloated for its own&nbsp;
good. A freshly installed system should not&nbsp;&nbsp;

00:19:11.360 --> 00:19:17.280
be standing after being gutted for 90 minutes&nbsp;
straight. I dunno, maybe I just got very lucky.

00:19:17.280 --> 00:19:19.200
If you want to check out&nbsp;
this project for yourself,&nbsp;&nbsp;

00:19:19.200 --> 00:19:22.160
I’ll leave a link to the GitHub&nbsp;
repository in the description.

00:19:22.160 --> 00:19:26.960
By default, this program does not delete your&nbsp;
files. The dangerous stuff has to be enabled&nbsp;&nbsp;

00:19:26.960 --> 00:19:31.760
explicitly. Otherwise, it just acts like&nbsp;
a quirky filesystem visualizer. Even so,&nbsp;&nbsp;

00:19:31.760 --> 00:19:36.640
I wouldn’t recommend using this if you don’t&nbsp;
know what you’re doing. Read the instructions,&nbsp;&nbsp;

00:19:36.640 --> 00:19:43.440
watch out for warnings, and use a virtual machine&nbsp;
if at all possible. Better safe than sorry.

