10 ms·
Show HN: Defrag the Game
Hi,
A while ago, I came across this https://www.youtube.com/watch?v=KR3TbL3Tl6M 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.
Have fun :)
- weaksauce 2y agonot to be confused with the original defrag game mode https://en.wikipedia.org/wiki/DeFRaG https://en.wikipedia.org/wiki/DeFRaG
- pkstn 2y agoWhat should i do here?
- v_b 2y agoThe goal is to have as less gaps between the blocks as possible. The High score is calculated with the following formula: (elapsed seconds / 4) + operations + fragmentation operation: each movement = 1 fragmentation: each gap between two elements = 1 inverted score system (less is better)
- pkstn 2y agowould be maybe good idea to add instructions :D
- v_b 2y agoMay I ask how old you are? Probably not from the Windows XP era, huh? We "old folks" know exactly what to do when it comes to defragging a drive. Seriously though, thanks for the suggestion! I'll definitely add a small link with game rules to help everyone out.
- iamtedd 2y agoOk, 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.
- rbonvall 2y agoIf 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.
- v_b 2y agoExactly this was my intetion :) Thank you
- user_7832 2y agoCounterpoint, 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!
- v_b 2y ago@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." Thank you!
- deleted 2y ago
- RA2lover 2y agonote 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.
- v_b 2y agoI didn't mention that above, but you are correct. Kudos to your reverse engineering skills!
- joseferben 2y agofun little game, very intuitive!
- devit 2y agoI wonder what's the complexity class of the problem of deciding if it is solvable in a given number of moves?
- weego 2y agoIt'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.
- apopapo 2y agoI get terrible performance in "hard" mode (seems to be due to animations?) Nice educational game!
- v_b 2y agoHaha, 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!
- eknkc 2y agoIs this completely in React? Just curious as this should be pretty easy to render.
- v_b 2y agoIt 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.
- withinboredom 2y agoIssues seem to be random, it is like the board shifts back and forth to the right/left until it settles, causing performance to tank until it settles.
- ALittleLight 2y agoPerformance seems to get worse about midway through. I assumed it was an intentional difficulty increase though.
- hellohello2 2y agoLags for me as well on a recent Macbook pro. (Nice game though)
- r1chardnl 2y agoJust a matter of time before Chrome pushes another JS API like File System API and you can actually defrag your drive from the browser.
- v_b 2y agoShould already work today with your cloud storage I think
- ossobuco 2y agoIt's already there: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system https://developer.mozilla.org/en-US/docs/Web/API/File_System...
- HeatrayEnjoyer 2y agoWhy 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.
- zamadatix 2y agoThe 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.
- HeatrayEnjoyer 2y agoJavaScript is just a feature accessory for HTML. There's no meaningful difference.
- 2y ago
- marvinborner 2y agoI 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.
- v_b 2y agoThat's the formular I am using to calculate the score: (elapsed seconds / 4) + operations + fragmentation
- r1chardnl 2y agoFrom the title at first I thought this was a Quake browser port [0] [0] https://en.wikipedia.org/wiki/DeFRaG https://en.wikipedia.org/wiki/DeFRaG
- sixonesixo 2y agothat would be amazing
- pureheartlover 2y agoI love watching defrag vids on youtube. There's still a strong but small community pumping out world records. A classic from about a decade ago: https://www.youtube.com/watch?v=RUCtMIjL-Z4 https://www.youtube.com/watch?v=RUCtMIjL-Z4
- ponytech 2y agoI thought the same :)
- deleted 2y ago[deleted]
- holistio 2y agoFun game, but scoring seems to be a bit off. If I just smash space I get a score higher than when I actually solve the puzzle.
- mapimopi 2y agoYour goal is to score lower
- holistio 2y agoThat makes total sense. I guess "best score" would be a better wording in that case.
- v_b 2y agoThanks, I have adjusted it to: Best Score: XXX (Aim for a lower score) Just refresh the page
- nox101 2y ago"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
- deleted 2y ago[deleted]
- PROMISE_237 2y ago[dead]
- shawabawa3 2y agoif i just smash space i get a lower score than when i try playing edit: managed to get a score of 131 for getting to 0 fragmentation in 30 seconds, i had 139 from just spamming space
- Sarkie 2y agoHit the spacebar = 155 points. Solve the game = 111 points. Fun idea but not great point strategy. Thanks
- v_b 2y agoIt has an inverted score system, which means less is better :-)
- dncornholio 2y agoThe 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.
- liamwire 2y agoBeautiful game that’s very quick to pick up, well done.
- v_b 2y agoThat's exactly what a software developer hopes for: users enjoying their software. Thank you ! :)
- abcd_f 2y agoOn 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.
- mastermedo 2y agoYou need to swipe. Works on iphone 13 + chrome.
- hinkley 2y agoI tried swiping, got nothing. I’m not sure what else someone would interpret as drag and drop on a touch screen. That’s gonna be swiping.
- deleted 2y ago[deleted]
- hinkley 2y agoIt’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.
- insane_dreamer 2y agoit's more just dragging than drag-and-drop; slide finger to move the blinking in one direction; no tapping works for me with iPhone13 + Safari
- Aeolun 2y agoIt 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.
- KTibow 2y agoFor other mobile users: 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.
- HipstaJules 2y agoIt's fun! Thanks for sharing
- chiph 2y agoLooks like the video is no longer available. 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.
- v_b 2y agoI fixed the link in the post, there was a M missing at the end, here the correct: https://www.youtube.com/watch?v=KR3TbL3Tl6M https://www.youtube.com/watch?v=KR3TbL3Tl6M
- sarcan 2y agoreally funny, I also think scoring should be inverted and should be more clear
- danbruc 2y agoThis 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.
- stavros 2y agoYeah, this needs an explanation, I went into it thinking it was like defragging and it took me a while to figure out how to play. Fun game, though.
- pmelendez 2y agoQuoting OP's: |> it inspired me to create this small game. 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.
- btbuildem 2y ago[flagged]
- danbruc 2y agoI 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.
- kwhitefoot 2y agoI'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. See https://www.geeksforgeeks.org/file-allocation-methods/ https://www.geeksforgeeks.org/file-allocation-methods/
- p0w3n3d 2y agoFunny 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...
- alliao 2y agoslightly 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...
- boo-ga-ga 2y agoLovely game, great animations, everything feels smooth.
- a1o 2y agoI actually had played a different game before here https://losttraindude.itch.io/zfrag https://losttraindude.itch.io/zfrag
- memming 2y agoThe domain appears to be flagged as "gambling" under Cisco Umbrella service. (Yes, I clicked on the link at work.)
- kwhitefoot 2y agoSurely it should have a leader board?
- PROMISE_237 2y ago[dead]
- vunderba 2y agoThe subtle blue color theme is great! 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.
- hinkley 2y ago> 8 hour defrag 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.
- samstave 2y ago5200 RPM HDD? likely contributed to time seeking?
- hinkley 2y agoI don’t recall but that sounds plausible.
- AshamedCaptain 2y ago> out on NT defragment happened in real mode so there isn’t a lot of memory to buffer copied blocks NT cannot run anything in real mode after ntldr. (And even boot time defragmenters run way after ntldr).
- hinkley 2y agoYeah the entire defrag process happens in a blue screen during the boot process. There was a cheap defrag you could do while NT was running but it can’t move any system files, so after a few system updates you needed a full defrag.
- hobs 2y agoTook me a second to get the rules, but a fun little unblocking game, good work!
- mgaunard 2y agoI have no idea what the rules are, doesn't look like disk fragmentation at all.
- khadadalek 2y agoI 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. I like!
- v_b 2y agoThat 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!
- insane_dreamer 2y agoFun. 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. Reminds me of Sokoban.
- NelsonMinar 2y agoThere's a fun simulator of Windows defrag with sounds here: https://defrag98.com/ https://defrag98.com/
- ALittleLight 2y agoI love it. I think it needs an undo button. It sucks being most of the way through the hard level when you accidentally double tap space and ruin your game. I also want to see score as a percentile of everyone who did it or as being X out of possible Y.
- keyle 2y agoWonderful job, next, 3D version!
- geuis 2y agoSome instructions would be helpful
- LittleOtter 2y agoI love this cute game.And,I think it would be better to have the HDD Sound like the video you post. :)