Share your repls and programming experiences

← Back to all posts
SortaCraft! [0.8 Alpha]
tussiez (1533)

This is my take on a Minecraft clone! This game was built with Three.js and JavaScript Modules, Web Workers and Service Workers.

NOTE

This page will not be updated until I release Survival Mode.

Coming Soon: Beta!

How To Play

Click on the crosshair to lock your pointer
W A S D to move around
Scroll to change block
Space to go up
Right click to place, left click to break

UPDATE 12/1-4/2020

Baconman321 has collaborated with me on this project and has cut the loading time of chunks in half! Minor optimizations have also been made.

12/3/2020
I have also reintroduced realistic lighting and optimized shadows to the game, making cave exploration, terrain, and buildings more visually interesting. A better offline cache system and versioning is in the works, along with sprinting (which I may warn you, is quite buggy at the moment). There is also a new menu you can access by pressing `. This menu allows you to change the material type of all chunks, and will greatly improve performance on lower-end devices.

12/4/2020
The game has been optimized further, and the "plastic" look has been removed. Offline support is being worked on.

Q and A

  • The game is REALLY slow. Can you make it faster? Press ` (backtick) to change the graphics setting.
  • How do I change block? Scroll up and down.
  • It's so hard to look around. A: Make sure your pointer is locked(click)
  • It's so hard to place/break. A: It is a bit difficult to break/place on a touchpad. Try a mouse.
  • Why is it taking so long to place/break blocks? A: Please use a different computer.
  • Why can you jump so high? A: I'm lazy
  • Why is the sand biome all slabs? A: I need to fully implement half blocks

Image Gallery

Comments
hotnewtop
Surfit (13)

May I take the time to applaud at his wonderful coding skills. Give this guy a few more years and Mojang will hire him.

TravisRaney (11)

@tussiez come to my happy birthday coder100 replit

shubhampaudel87 (1)

you might be taken to mojang no you will be taken to mojang don't forget us @tussiez

KobeFF (1261)

lagggggggggggggggggggggggy but very very nice

KobeFF (1261)

@tussiez I can't wait to see the finished outcome!!! It must've taken forever, with all those files.

KobeFF (1261)

BTW, your js skills ate MIND-BLOWING!!! I can hardly create a clicker game lol 😂

HEMLANU (181)

but its name is sortacraft

HEMLANU (181)

I felt like I am really plying Minecraft

tussiez (1533)

@HEMLANU Glad you're enjoying it!

angrydoge (465)

This has been on trending for 29 days bro. keep this up and youll have a streak

tussiez (1533)

@dabombdgdzjr Wow! I'm on the list of top Repls

[deleted]

@tussiez yo can I’m make my own Minecraft game. I want fork urs and add some more stuff to it . U don’t mind right? I’m not gonna share it ok.

[deleted]

@tussiez u really did spend a lot of time on this (I'm checking the code)

[deleted]

btw how do u build or place a block?

[deleted]

thanks for some reason it wasn't [email protected]

[deleted]

oof u gave me a billion notifactions [email protected]

[deleted]

u wanna work on movie [email protected]

[deleted]

This game is AWSOME! Now here are some tips: 1.U should add animals
2. If only this could be multiplayer 3. Music 4. Mobs and bosses 5. crafting table 6. more items that could be made or example pickaxe axe shovel etc. 7. Get a job at mojang

tussiez (1533)

@ilovebeef 1.Couldn't figure out UV wraps, those will come later
2. Basic multiplayer on homepage (worse than singleplayer though)
3.Adding really soon!
4.Same as #1
5.added,doesn't work
6.check the items folder in the Repl,they're going to be added with crafting and inv finish
7.wish i could

[deleted]

how do u make a crating table?

tussiez (1533)

@ilovebeef For now, you can scroll through the blocks, but you will be able to craft in the future

[deleted]

the water doesn't flow?? also where's all the lava hiding underground?

Leroy01010 (413)

RIVER water doesn't flow in minecraft @merrybot

Superblammao (7)

@merrybot i dont think he has lava blocks yet, but i relly would like to see them in the game :)

Jeydin21 (104)

Wait so, this wasn't coded on repl.it, so does this post count? Technically, your post is just a website with a link to your GitHub project.

RayhanADev (1968)

@Jeydin21 Hmm, does this count? This does bring a good question. You can’t even play it in Repl, so is this even viable?

tussiez (1533)

@RayhanADev I was having trouble with Repl early on because Repl.it kept crashing on me, so I moved it to GitHub. I will make the necessary fixes to get it working again.
I made most of the game on Repl.it though, so I thought it counts.

RayhanADev (1968)

@tussiez yeah it’s cool. I was just wondering if it was a thing that people actually allowed.

tussiez (1533)

@Jeydin21 Fixed the bug, it works now

TANMAYBAGADIA (48)

cool
i would like to give suggestion that gives specific properties to tools like in official minecraft pickaxe can break cobblestone easier than any other tool

tussiez (1533)

@TANMAYBAGADIA Sure! I've already gotten a ton of items drawn out (haven't added though - need inventory)

TANMAYBAGADIA (48)

@tussiez good , keen to see the new changes

Plorzon (6)

Wow amazing! I have a dumb question tho, how do you go down?

tussiez (1533)

@Plorzon It's still a bit broken at the moment :)

Plorzon (6)

@tussiez
Oh, ok :)
I can't wait to see what it looks like! This must have taken ages lol.

[deleted]

whenever i try to jump it just makes me float at the same elevation

angrydoge (465)

Wait what I can download this

tussiez (1533)

@dabombdgdzjr Yup! In Chrome, go to the search bar at the top (near where your tabs are), and press the + button!

tussiez (1533)

@RileyMears Oh my! Are there any errors in the console? I can help

RileyMears (8)

@tussiez there are no errors? how long does it usually take? i might just be too impatient for it to load but the loading bar doesn't move

tussiez (1533)

@RileyMears Hmm. It has been working for me.. try again today.

Baconman321 (1061)

@RileyMears We are often working on the game, so you may have been on at a time where we were changing code (often resulting in a syntax error or something of the sort).

tussiez (1533)

@Baconman321 That's often the case :)
Try again later, most game-breaking bugs are fixed pretty quickly

Baconman321 (1061)

You should use a service worker so this works entirely offline. Also, you can make it a PWA. It's not that hard, maybe takes like 15-20 minutes to set up if you do it correctly. I can help you if you don't want to do it yourself. Also, I really need to congratulate you on this. First of all, I suck as a web designer, and a game designer is no different for me. Also, the use of implementing a chunk loading system like the actual minecraft system is genius! I am also ecstatic that you used the advantage of web workers (since they offer another interpretation thread, meaning you can do complex calculations in them without affecting the main page performance). I would love it if you could make the chunks a bit more large, but let's be honest. JavaScript is slow, and the language they use for the actual minecraft (Java) is most likely faster (since it's strongly typed). If you could do that without affecting my performance... I don't know what I would do this is so great anyways, I sit back and play it and I notice all the complex features added to this. Also, one of your javascript files is like 2k lines of code, so that must have been a lot of work. I made a program with 2k lines of code, but it was more consisting of redundancy. This is great man!
Also I recommend adding shadows (as it's kinda hard to see things without them), torches, bigger biome sizes, less cave systems/bigger systems but less appearing, and music. Personally, I think the music would be really hard to obtain, since the minecraft music is copyrighted, and it wouldn't be minecraft without it (I know it's a minecraft spin-off, but still). However, if you have gone this far with this awesome work of art, you can almost certainly go farther. I believe in you!

tussiez (1533)

@Baconman321 Thank you so much!
I’ve seen a JavaScript Minecraft clone by Khan Academy, and it runs blazingly fast. This is most likely because almost all of the game code is GLSL. I think the Three.js library is slowing it down. Maybe in the future, I could skip the library and port most of the code including the big parts such as the terrain generator and voxel engine, as the engine generates the geometry data itself, and Three.js inserts it into the geometry. I’ll look into PWA and the service workers soon. The comment on chunk size - I’ve used 16 by 16, or maybe 64 by 64. I believe 64, I need to check. My target platform was the school Chromebooks, and they were already struggling with the game. My original goal was cubic chunks, this works half the time as I need to brush up on my math. The Bedrock edition of Minecraft runs much faster than the Java version, since a massive amount of the code that used to run on the CPU is now on the GPU, which is why crazy render distances are possible.

Baconman321 (1061)

@tussiez Yeah, you seem to know much more game design than me (cry, even though I don't care for game design...yet). Honestly, PWA is something I just made, so I don't think it would be too hard. I could help you with the service worker part too if you need some help. I like how you implemented the chunk worker. But, how does it generate half a tree, then when you generate it again it generates the other half? Do you store the data about half of something being generated? Or... I don't know I'm lost. There's so many things I want to know about this since it's sooooo cool about how chunk loading works. Also, try working on despawning certain chunks but store them so they appear later. And I'm on a chromebook too so off. Yeah, as long as it doesn't load a chunk, the framerate is at about 60.

tussiez (1533)

@tussiez I think creating a new version without Three.js and just WebGL would be a fun project.
I’ve gone through multiple revisions of this game, some starting all the way since last year. I’ve learned a lot about JavaScript during this project, and because of this the code has gotten a bit inconsistent. This could be fixed in a rewrite.

The first revision of this game didn’t have Web Workers, and was freezing up when I loaded in chunks. After adding a Web Worker, I realized that the data load from the worker itself was also causing the game to hang. Because of this, I created a clever cache system that lazy loads the lazy loaded chunks, to prevent lag. In a future revision, I could add an option that can customize the loading speed (The Web Worker generates the chunk blazingly fast, however the processing of the output does take some time) so you could get a faster load if you have a powerful computer. An automatic version of this could be done too.

Baconman321 (1061)

@tussiez What do you mean by lazy loading? Like load the whole game but only show parts of it (or at least load major parts)? Also, the game doesn't load unless you have a certain flag enabled in chrome://flags (for my chromebook at least; you should mention that on the mainpage).

tussiez (1533)

@Baconman321 Yeah... oof
Yeah, I would like to learn some more about PWA, so I will gladly accept your help. Oh, partial trees was a very interesting problem to solve. I used to allow trees inside the chunk, so they don’t generate half trees however it made tree clusters impossible. If you look in the code, there is an additional worker called geometrydataworker. This worker handles the geometry data generation, reducing the lag on the main thread. When chunk data is processed, the voxels are set in a global multi-chunk VoxelWorld, and this is where the geometry data is generated. This means every once in a while, half trees are generated (one chunk overrides the other) and sometimes they don’t happen and tree clusters work perfectly.
Yeah, I tuned the loader for the Acer R11 Chromebook. Around 50-60 FPS.

To put it simply, the chunk data is global, not relative.

Baconman321 (1061)

@tussiez So essentially it stores information about the trees, then when it generates the other chunk it loads the full tree? (Remember I am totally new to this, but I squeal with delight at this genius idea of chunk loading).

tussiez (1533)

@Baconman321 Huh.. chrome:// flags is blocked on my Chromebook and I don’t have issues. Are you talking about hardware acceleration?
As in lazy loading
The web workers generate the terrain pretty fast, the problem is they load so fast that the main thread can’t catch up. To fix this, the data is stored for later instead of processed immediately.

Baconman321 (1061)

@tussiez Ah. Yeah, for me you have to enable experimental javascript. I wonder if it's enforced by your network admin, so maybe that's why. Yeah, the whole chunk thing is complex but amazing. I don't know why more games don't use it!

Baconman321 (1061)

@tussiez Oh, and also add running! And doors... and glass.

Baconman321 (1061)

@tussiez Invite me to your project so I can help you with offline capabilities and PWA please. I would love to collaborate with you and show you all about service workers (all that I know)! I'm available from 11-12 and 2-3 CST (central daylight time). If that doesn't work, I can just make you a service worker and put comments in describing how everything works. It would be an honor to help you out with this genius project! :>

tussiez (1533)

@Baconman321 Missed the shadows part of the comment :)

I’ve tried cascading shadow maps before on the game, and they do work (and really well). I don’t know if the implementation is still in the code (just commented out) or not, the problem I was having with the shadow map was that lighting wasn’t updating with shadows (lights wouldn’t work). And yes, I should be able to fine tune cave systems as it’s an easy task. Thank you for the feedback!

tussiez (1533)

@Baconman321 Sure! I can add doors (as you can see, I was messing with voxels and sand is now a slab) however glass has been an interesting problem. This has always been an issue with voxel games, as it requires a custom z-index and more computational power. I could probably do this in WebGL in a future version though

tussiez (1533)

@Baconman321 Sorry about late reply, I’ve been busy recently
And yes, I’ll try to invite you soon! I’ll let you know if I’m available tomorrow (most likely yes)
Thank you once again for your help!

Baconman321 (1061)

@tussiez No problem. Remember, I'm available 12-1 and 2-3 Central Standard Time. Again, if we can't work it out, I can always add comments to the program to show how it works!

tussiez (1533)

@Baconman321 Got it! I will also be available! We can start with a forked Repl (so in case we mess anything up really badly, it's easier to reset). I think we can skip offline for now, as I'm thinking about writing a new version of this game (once again) that may have some new optimizations. You can still tell me how to do it though :)

Baconman321 (1061)

@tussiez Ok. I have to do some stuff (school). I'll be available in about an hour and 15 minutes (sorry). Also, if you know about repl history, it's really easy to use in case you mess up. Either way, ok.

tussiez (1533)

@Baconman321 1 - same!
2 - sure! It's shared

Baconman321 (1061)

@tussiez I'll let you know when I'm ready. Also, service workers don't mess with the main stuff. If anything happens, you can just clear your cache. Service workers work on a seperate thread and all, I'll tell you more when I'm ready.

Baconman321 (1061)

@tussiez I can work now. I'm joining your main game. Just let me know when you are there and ready.

Baconman321 (1061)

@tussiez I am ready when you are (meet me in ur repl). until 3 P.M CST at least.

Baconman321 (1061)

@tussiez I'm in your repl if you want to come. I gotta test and fix some things that I found aren't working.

tussiez (1533)

@Baconman321 Got it!
I'm in class at the moment.

Baconman321 (1061)

@tussiez Oh, ok. Let me know when you don't have class.

Baconman321 (1061)

@tussiez Can we do this at 1.PM CST? I'm kinda busy (school). I'm available 1-2 PM CST (not 2-3 today), or at least, I believe I am.

Baconman321 (1061)

@tussiez Ok I can do it now. I'll meet you there.

tussiez (1533)

@Baconman321 Sorry about the late reply, I've been really busy recently. I'm available anytime today (hybrid)

Baconman321 (1061)

@tussiez I'm available right now. I'll meet you in your repl.

tussiez (1533)

@Baconman321 Sorry for the late reply, I'll be there in a minute. Helping my friend with a clicking game

Baconman321 (1061)

@tussiez Ok, I'm available now if you want. The world is super dark so you may want to fix that.

tussiez (1533)

@Baconman321 Sorry, was catching up on homework again... I was working on adding shadows back and also sprinting is broken for some reason

Baconman321 (1061)

@tussiez Ok. I will go in and fix the caching issues (cuz it doesn't work offline now that you added threejs to the project, I'll fix that).

Baconman321 (1061)

@tussiez I believe I am available until 3PM CST. If you want, I can help (I think I found out the problem to a thing or two).

tussiez (1533)

@Baconman321 Got it! I've seen that SortaCraft works on HTTP only
I'm in a Zoom meeting at the moment, but I'll join soon

tussiez (1533)

@Baconman321 May not be available today at a scheduled time as I have a lot of schoolwork :)

tussiez (1533)

@Baconman321 When the cache updates, you'll see that the day/night cycle may have been fixed

I disabled the shader's lights
(The day/night script has brightness already programmed, so it should work now)

Baconman321 (1061)

@tussiez Ok. As always I am available 11-12 and 2-3 CST. I found out you can put stuff on the GPU, so maybe we can do that (more on that later when we can meet).

tussiez (1533)

@Baconman321 We might be able to get sundials to work..
(light direction)

Baconman321 (1061)

@tussiez Ok. I'm on now. Also, I have no idea what that is XD (remember I don't do game design).

Baconman321 (1061)

@tussiez Ok I fixed a few minor things in the service worker. Also, you might be happy to hear that I added a little version display at the bottom left of the screen in newgame.html.

tussiez (1533)

@Baconman321 Oof.. you'll know eventually

tussiez (1533)

@tussiez Thanks for the version display! It'll be helpful

tussiez (1533)

@Baconman321 Got it. On every other day I'm in class from 5 to 1 CST

Baconman321 (1061)

@tussiez Ok, so you're on now? I'm available 2-3 CST then. (And 11-12 CST when you can do that).

tussiez (1533)

@tussiez Class ends ~2 pm for me

tussiez (1533)

@Baconman321 Sorry I wasn't available yesterday, however I am available at 11-12 CST

tussiez (1533)

@tussiez I'll be polishing up lights (light direction, fixing light blocks)

Baconman321 (1061)

@tussiez K. Not 2-3 CST? (I have some other things to fix on your game too; when we meet I have an idea so that I can keep up with what your making).

Baconman321 (1061)

@tussiez I'm available when you are.

Baconman321 (1061)

@tussiez I'm available right now if you need me!

tussiez (1533)

@Baconman321 Got it! I'm in class until 2 CST

tussiez (1533)

@Baconman321 Me too
Finishing up a repl I did in half an hour
https://linedraw.tussiez.repl.co/

Baconman321 (1061)

@tussiez If you're available, I think I know the problem to the gravity thing :D

tussiez (1533)

@Baconman321 Sure! Working on adding colors to LineDraw

Baconman321 (1061)

@tussiez I don't think I'll be able to help at 2-3 CST. I am really tired today, so if I have time after I attempt to rest, I'll let you know. Otherwise, see you on monday!

tussiez (1533)

@Baconman321 That's fine - see you on Monday!

Baconman321 (1061)

@tussiez I slept. It's not enough to refresh me long-term, but now is fine. XD just as you read this and respond, I wake up from napping. I am available for about 15 minutes. Other than that, yeah see you tomorrow (I'll help if you're available now).

tussiez (1533)

@Baconman321 Woops! I took a break from the computer but that's good to know!

Baconman321 (1061)

@tussiez Technically I'm available today (unless my dad turns off internet cuz he doesn't know I have it ;) )

Baconman321 (1061)

@tussiez IDK if you're on now, but I'm available rn.

tussiez (1533)

@Baconman321 Home now.
I'm feeling a bit sick, so you're free to work on the game if you'd like, but I'll take today off

Baconman321 (1061)

@tussiez Ok. I need your help with the gravity thing anyways, so I'll wait.

tussiez (1533)

@Baconman321 I should be free 2-3 CST if you want to try getting falling to work. Actually, your part is working great - I just need to fix my code.

Baconman321 (1061)

@tussiez Ok. I think we should make a math webworker too, since that would be the part that takes up quite some computing power.

tussiez (1533)

@Baconman321 Yeah
This might be your answer: geometrydataworker.js
However we might move the math code into the GPU.. I'm not sure

Baconman321 (1061)

@tussiez We should use WASM, since it's a compiled language it will run much faster than Javascript (which is JIT or just in time interpreted).

tussiez (1533)

@Baconman321 I enjoyed my snow day yesterday :> I'm available today at 2-3 CST

Baconman321 (1061)

@tussiez Ok, I recalled a method that is sure to speed up your game if you use a lot of new operators. Garbage collection! More on it later when we talk...

Baconman321 (1061)

@tussiez I'm available now if you want. Let's get that game to work :D

tussiez (1533)

@Baconman321 I have to go now, but I'm available at 2-3 CST

Baconman321 (1061)

@tussiez I'm available now if you want to me to help you get the game working :D

tussiez (1533)

@Baconman321 Sorry I wasn't available, was out

Baconman321 (1061)

@tussiez I'm tired so I'm going to lay down for a little. I'll let u know when I'm available.

tussiez (1533)

@Baconman321 That's okay! I'll be doing HW in the meantime

Baconman321 (1061)

@tussiez I'm not going to today. I think it's just my medication. My mom didn't give it to me for a few days since she had to get a refill, and my body kinda got used to being without it, so when I got it I was really tired (same scenario with last time I was tired last last friday)

Baconman321 (1061)

@tussiez I can help now if u want!
Edit: OK NVM I can help at 1 CST

Baconman321 (1061)

@tussiez Also ur repl AUTH doesn't work... Oh well, Let's do that after we get sortacraft working and all :D

tussiez (1533)

@Baconman321 Yeah, it's having issues however it seems to work on me

Baconman321 (1061)

@tussiez I'm ready if you want to.

Baconman321 (1061)

@tussiez Want to work on sortacraft?

tussiez (1533)

@Baconman321 Missed this comment, woops
I’m free tomorrow

Baconman321 (1061)

@tussiez I'm available if you want to collab now.

tussiez (1533)

@Baconman321 Sure! I'm writing Mastermind

Baconman321 (1061)

@tussiez If you want I'm ready now :D

tussiez (1533)

@Baconman321 Slept in - I'm probably available @ 2-3 CST

tussiez (1533)

@Baconman321 Sorry I have to do something outside

Ra1han (4)

how do i break and obtain things

Ra1han (4)

@tussiez but when i break things i cant use them like they disappear

tussiez (1533)

@Ra1han Unfortunately, that's the case for now. However the system for obtaining items is already set up (See the top left, under the framerate counter). In the black DIV, you can see the item name of what you've just broken.

TroyLilgeberg (9)

if you place 2 sand slabs on top of echother it becomes water

tussiez (1533)

@TroyLilgeberg Yeah it was a slabs test :)

DREWNOLT (27)

Cool. I bet you could get a really good job from mojang. :D I would recommend making the sun square, though

KrazyOrange (27)

The world's not generating.. ☹

DanielRatliff (5)

I'm going to speed run this. I'll post a video later.

DanielRatliff (5)

@tussiez I don't know because you cant post mp4 files on here.

tussiez (1533)

@DanielRatliff You can try putting it in a Repl

DanielRatliff (5)

@tussiez Also, could you give me some sort of goal because mine was to just find diamonds, break them, and then build a nether portal out of obsidian and water.

DanielRatliff (5)

@tussiez How would I put it in a Repl? Not very smart and only know basic python so...