A while ago, I came across this https://www.youtube.com/watch?v=KR3TbL3Tl6M on YouTube showing 8 hours of defragmenting a hard drive.
For some reason, it inspired me to create this small game.
In the NT 4 era I had a defrag take almost 18 hours. I started it before leaving for the day and came in the next morning to find it an unknown percentage done. I didn’t trust it would be okay to restart the machine so I had to leave it.
That was a problem because we were running version control on this box. But by then everyone was bought in so we got a dedicated machine out of the ordeal, but that was super annoying.
We even called Microsoft and got through, but it turns out on NT defragment happened in real mode so there isn’t a lot of memory to buffer copied blocks. So it spends a lot of time seeking on the hard drive. So stupid.
Fun. Feedback: the only thing I found confusing is that it's not clear that the first block that is blinking is a data block. Maybe if it started with no block selected, and the user has to press Enter/Space to begin the game at which point the first data block starts blinking. That would make it clearer.
"lowest score" would be self explanatory. "Best score" still made me think I was doing better with a higher score
on the other hand, it might be better to change the scoring system. Calculate the worst score using the current system. Then reverse so the score goes up as in displayScore = worstScore - oldWayOfCalculatingScore
On iPhone drag-n-drop doesn't work. Long tap basically selects part of the gaming field and this selection is not draggable. Once tap is released it shows the Copy/... menu.
The black boxes are data; they are automatically picked up. You're swiping to move the cursor that places the data. The "write file" button writes the data.
It sort of works for me, but it feels far from pleasant/responsive. Feels like it only ever goes in one direction at a time. Dragging diagonally has your file stuck.
It’s because the game ergonomics are questionable. You can only slide files sideways, not past other files. Your phone isn’t broken, not is the game engine. The game rules are.
I got other things I’m supposed to be doing right now so I’m gonna go do those.
It's a fun game, my only complaint is a UX / expectation issue: when I've placed a block, my natural reaction is to press space again to "enable" the next block for moving but, as it's enable by default, it locks it. I've had to restart a lot because of that.
Funny game but that's not how defragmentation works. I was troubled to understand how can I choose the file by it contents or even why can't I write to a place where there is a block below it...
I used to love watching the defragger back in the Windows 95 days, and later I bought copies of PerfectDisk for both home & work. Unfortunately Raxco closed up shop earlier this year, and their license server is offline[0]. So I can't run it other than in trial mode. And that's a shame, as it was the only product that could fix the fragmentation problem we had with over fifty thousand files in a directory tree[1].
I don't know if NTFS has a version ID or if PerfectDisk will respect an ID higher than it was written for, but I'm nervous that the now-unsupported defragger might trash the internals of my filesystem. :(
[0] 1990's style software licensing - super annoying.
[1] Startup. No time to rearchitect it correctly. Usual story.
If you know the right identifiers, you should be able to use WebUSB to access a flash drive/external hard drive. Combined with C-to-WASM compilers and Linux driver code, I'm sure you can defragment from the browser alone.
Or you can hook this mechanism into one of the WASM x64 emulators and attach the drive directly to a copy of MS-DOS or Windows 98 running in the browser.
Why do APIs like this even exist? There's no legitimate reason for an HTML webpage to need this, it's just creating more attack surface for bad actors.
The File System API is a JavaScript API, not an HTML one, so it helps to think about it from that light (programs, not documents). The API allows tools such as photo editors, file converters, code editors, and the like to be given access to a set of files they can work on directly rather than needing to import and export from the browser on every change. If the attack surface is too much for a use case it can be globally denied by default in every major browser so you won't even get prompted.
The page needs permission. That permission step is similar to the act of downloading a native app. Except for the fact that the broswer gives even less access to your system
than a native app so it's safer than a native app. (at least on desktop) That file system API is super useful for cloud based IDEs as just one example
I wonder what the optimal strategy is, optimize for speed with more fragmentation and fewer operations or for less fragmentation but more operations and time. For 1kb, optimizing for no fragmentation I can't seem to get below ~80.
I played this way too long. It did take me a a game or two to figure out how the UI worked on desktop and what the point was, but after that, it's a fun little puzzle game.
That was a bit intentional. I personally enjoy exploring games and figuring out how they work before developing strategies. It makes the game more fun for me. However, I do understand the feedback that if someone still doesn't get the game after one or two rounds, something might be off.
At the very least, it's great to hear that I've won one fan! I'm really grateful for the time you invested in something I created. Thank you!
This is not like defragmenting a disk at all. There are no sectors or clusters, I can and have to move entire files at once. I have to move them in some fixed order and I can only move each once. Files can bump into each other?!? This is extremely confusing if you think the game is about what the names says.
I think what happened here is that author didn't include instructions, the UX was not clear, and the author said if you are old enough to remember defrag you'll just know what to do. But on the Internet everyone's a pedant and many of us remember DOS/ windows defrag in more detail than the OP seems to, so there's confusion/complaining. All that is par for the course though and hopefully you will still make and share awesome games!
It was inspiration, not a simulation nor it claimed to be realistic. This is the type of artistic license that game designers have always had at their disposal.
I am not complaining about how the game works, I am just saying that there are no instructions, so the only thing I have to work with is the name and the inspiration. And if you know how defragmentation works, this all just makes no sense, why does it automatically select blocks, why can I not move them repeatedly and to any free space? Sure, most people do not know what defragmentation is and how it works, even in developer circles I would not expect people to know if they are not old enough to have worked with computers in the 90s, they might hear about this in one computer science lecture and never think about it again.
I'm pretty sure that there have been disk formats that only write files to consecutive sectors just like memory allocators that only return contiguous blocks of memory.
Then you need frequent compaction of the space because it ends up full of small unallocated blocks.
The puzzle stops after you solved the first line. You won't become stuck after this. Would be nice if it had reproducable levels because I feel like this is a product of the level generation. It's not providing enough problems IMO.
Haha, I never played in "hard" mode because it was too challenging for me. That's probably why I didn't optimize the performance as much in that mode.
Thanks for the feedback!
It is.
To be hones I played it now in "hard" and the peformance was absolutley fine.
I know that some browsers has still issues when it comes to pure CSS animations as they are running on the GPU and when the Hardware acceleration is disabled the CPU goes sometimes crazy.
I had the same on an animation GitHub a while ago used on their landing page.
When I was younger, we used to joke about doing the opposite, deliberately fragmenting every file on the drive to put them as far as possible from each other so that your magnetic drive would just THRASH.
I like to make sure the actuator arm gets a good workout to feel the burn.
slightly unrealistic but fun idea.. makes me wonder if there are any benefit in AI powered caching algorithm or maybe that's what all the cloud providers are reaping benefits from...
The idea behind defragmentation is to make the files themselves consecutive, which is not done in any way in this game, which makes it somehow confusing. The fact that DOS/Windows defrag also moves the used space to the beginning of the block device is mostly an implementation detail (and the experience with unix filesystems seems to indicate that it is actually better strategy to intentionally fragment the files by allocating the space almost randomly as long as the fragments are "large").
> We "old folks" know exactly what to do when it comes to defragging a drive.
Has nothing to do with age. Clearly the game has a host of limitations which has nothing to do with actual disk defragging. (Can only process the blocks one at a time in a specified but unknown to the user order. Blocks move one cell at a time and can't jump over other blocks.) And doesn't have others which are core to disk defragmentation. (Sectors, and files for example.)
As an old folk who watched a lot of DOS and win 3.1 defrag I could not figure out how to play. This game has many confusing differences from actual defragging: blocks can't seem to move over each other for example. And I think each block can move only once? It's a neat concept for a game but don't blame our confusion with the UX on lack of familiarity with the real defrag process.
I remember defragmentation from ca. Windows 95 times, and it was totally different from this game. None of the files shown here is actually fragmented, only the used space is, and for some reason you can't place a two-block file across a "line break".
edit: I realized that the "lines" might be meant to represent disk cylinders in the pre-LBA era, but even then, a line should "wrap around" to itself instead of the next line.
for the next level each file could have a different color. then multiple blocks of the same color would be one fragmented file. in easy mode the order of the blocks would not matter as long as all of one color follow each other, in hard mode the blocks would have to be in a specific order.
i would also allow blocks be moved freely with the goal to move as little data as possible.
Ok, but I had no idea I was already choosing a position to write the first file. I was pulling to refresh constantly on Firefox mobile until I finally figured it out. Which is a big difference to all the other moves - choosing a file to move first, before choosing a position to write it to.
Nifty game, but I almost gave up on it when I couldn't figure out what the hell I was supposed to do as the first move.
If I was you I wouldn't bother. The cool thing is not the game itself, it's the fact that we "old folks" just know what to do right away :) If you need to read instructions, probably you'll find the game dull anyway.
Counterpoint, I'd love to have this info. I grew up long enough ago to know (and do) disk defrags and the game is very similar to tetris in how it is fun and relatively easy. But iirc defrags made multiple passes, and it is not very clear whether the blocks in game correspond to pieces of the same file (where line 1 & 2 should be together) or of different files (where it does not matter). It's a nice game nonetheless!
@user_7832 Thank you so much for your feedback!
I made this just for fun in my spare time, and feedback like yours is incredibly valuable and, more importantly, motivating.
It shows that there are people who take the time to provide thoughtful feedback in return for my invested time, which goes beyond simple comments like "this is stupid because I don't understand it."
note gaps between the first block and first file are counted, and gaps longer than 4 blocks are treated as 4-block gaps, but only for the fragmentation display rather than actual scoring.
In the NT 4 era I had a defrag take almost 18 hours. I started it before leaving for the day and came in the next morning to find it an unknown percentage done. I didn’t trust it would be okay to restart the machine so I had to leave it.
That was a problem because we were running version control on this box. But by then everyone was bought in so we got a dedicated machine out of the ordeal, but that was super annoying.
We even called Microsoft and got through, but it turns out on NT defragment happened in real mode so there isn’t a lot of memory to buffer copied blocks. So it spends a lot of time seeking on the hard drive. So stupid.