SortaCraft! [0.8 Alpha]
It's been almost one year since SortaCraft was released.
Hang in there, SortaCraft 2 is still coming!
Preview - https://sortacraft2.sortagames.repl.co/
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
Baconman321 has collaborated with me on this project and has cut the loading time of chunks in half! Minor optimizations have also been made.
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.
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
@tussiez When I get the chance, I’m going to try and improve world generation. I have an idea on how we could fix chunks breaking at higher coordinates, and I’ll try to make the chunks a lot taller so we can have bigger caves and more interesting terrain, e.g mountains and valleys
I’ll also attempt water
@tussiez I was going to optimize the Perlin Noise and chunk generation, but I need to know one thing: do you have seeds yet, or are you planning on implementing them?
If you are going use seeding, then what I do won't work here, as it'll generate completely random worlds that cannot be reproduced via sharing a seed.
@tussiez So umm... the seed exists, but...
Math.random() doesn't particularly care what the seed is :/
There's no hashing / randomization that actually uses the seed.
Perlin is minified, and re-uses
t a lot, so I can't tell if the seed passed in is even used, but if it is, then it's really ineffective, since it uses
@tussiez Stacking doesn't work well. Should we collab now?
BTW, CLIp is literally done, I'm just adding a few more functions. I can give you the early version since I don't think we'll need all of the features I'm adding in. The tutorial is going to be hard though, I might want to wait until that is finished (easier to learn).
@tussiez Want to collab on the jam for a chance of a $250 gift card? If so we will each receive $125 if we win first place!
If you agree I'll invite you to a repl where we can work together. Important though, we need to find a way to work together before the end of the week (March 19). So, it would be a good idea to start today!
@tussiez So... um. Are you going to collaborate with me? If not I'm not going to enter the contest (too much to do).
Btw the prize will be split 50-50 (if we win). No exceptions... unless you wanna donate to charity (I'm thinking cancer research if we are going to donate to charity).
If we aren't going to collab then do you want to work with me on sortacraft?
@tussiez So, I realize that because of our time differences (and school) that we probably aren't going to meet the deadline. However, if you read the annotations I put down... I think we could make a more in-depth game (we will put aside sortacraft for a tiny bit). Maybe not that in-depth but enough that it would attract attention for sponsors. We could have people sponsor us. I have a good idea in which they give a dollar for every upvote we get on the game. All of the money would go to cancer research. The only problem is how do we collect the money? I think we could encourage people to donate the money to the nearest cancer-research donation center themself instead of giving it to us (plus it probably makes them feel more confident versus giving it to two people online they don't even know). Do you agree with this plan?
@Baconman321 , is it possible to transfer a Uint8Array to a Web Worker? As you may know, the state of all voxels are stored in a big array. Since I haven't been able to pass the VoxelWorld object before, I've had to
postMessage every time we set a voxel, and every time we do this, we have to post this update to both geometry data workers. If we could simply pass the whole array of voxels at once, this could improve performance by a lot.
@tussiez How do you think we're going to do this?
I think we should make the actual game loading a function (with parameters like seed and such) and call it right away (we can focus on game options later). That way when we make game options we can simply call the function with the parameters the person passed in.
Remember, we got to make the code easily modifiable in the future!
@Baconman321 I keep finding more hidden code in SortaCraft..
I finally realized that the reason why I have two geometry data workers is to cull faces on one.
For some reason, I didn't fully implement this..
This second worker was supposed to be called regularly to remove all the extra faces in adjacent chunks (massive performance issue), as since it was separate from the main one for updating blocks/loading chunks, it wouldn't affect the game.
@tussiez I just got banned from Phantom Forces (my fav game on roblox) because of "exploiting". I'm innocent so I appealed.
It's probably just lag triggering an anti-hack script.
I hope I just get unbanned :(
Oh and also, did finding that information out (about sortacraft) help you make it load faster?
@tussiez I found out that using document fragments when loading high amounts of contents into the div actually improves performance because document fragments are lighter than appending to the DOM itself. Once you are done with adding things to the fragment you append the fragment to the DOM.
I did this with stargaze when adding stars and the loading was so much smoother. It froze a bit at the end, but otherwise it was really smooth.
If you are adding a lot of things to the DOM I recommend using document fragments.
@tussiez What website is that?
No I'm determined to find your face >:D (jk).
All I would have to do tho is find a yearbook in your school and look through the pictures, it's that simple (someone could do the same with me too).
Uhm, I saw a few people on ur school's homepage that looked like they were more in high school, is your school for 9-12th grade too?
Oof it wont let me in bc im not a dev, and ive been trying so hard to get the secret thing by hovering my mouse over every inch of the page, looking at viewsource, script files, etc, etc.
Y u do dis to me ;-;
If I could I would inspect but I cant oof
@AnthonyMouse Most likely villages might come with superflat (at least, I think that's a good idea). Villages might be generated with seed, which will definately be at least somewhat of a challenge. I think that will most likely come after survival, although I think it should come before since in survival villages can be crucial for living.
@Baconman321 Yeah. What we could do is make a mini version of SortaCraft that we can use as a sort of a "tool" for this kind of work. This app would simply allow us to build models (e.g villages) that could be saved as voxel data and used later in the game.
The challenge here to add villages and other naturally generated structures is "laying" the model flat onto the terrain. This would require sampling the terrain heightmap and setting the corresponding blocks in the model to that Y position.
@tussiez Coderx tried to change the leaf textures, but for some reason the texture he uploaded is off so it loads things a bit wanky (grass has a bit of stone, stone has a bit of grass). However he claims it is 16px by 16px like urs. When I compare the two his is a bit more blurry. Could that be the problem?
I needed to add block support for the inventory, but all the textures were all in one image so I needed to split them, so I wrote a web worker/module that generates a texture atlas by generating separate images using
I realized that you can use starting X and Y position to "cut out" parts of the image in drawImage, but we might need to use this atlas elsewhere (e.g generating 3D block images/Idk)
Dunno where you ping you on this..
While you were away, I was able to create events on the SortaCanvas library, add object picking (tells if you are clicking an object), and also the Tween.js animation, if you missed it. I wrote a little demo that lets you drag and drop the shapes on the mainpage.
TL;DR: Frustum culling needs work.
It's somewhat difficult to see this in the screenshot below, but this chunk has hundreds of useless triangles that could be removed, since they're touching A. another chunk and B. they would be invisible to the player in game. This problem is easily fixable, as all I need to do is to regenerate the geometry of the chunk. Exactly when to call this is the problem.. it's very hard to tell if it needs to be updated or not. I already have a basic system for this set up, and it works (most) of the time. The image below shows that it could be improved.