Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
235

Minecraft in JavaScript

repl-account
repl-account

Minecraft in JavaScript

Update: Removed faulty game loop library, sped up game by 1000%

Controls:

Up - Space
Down - Left or Right Shift
Horizontal Movement - wasd
Camera Movement - Mouse
Switch Blocks - Number Keys
Place Block - Right Click
Destroy Block - Left Click

If the repl won't load use this URL instead: https://minecraft.repl-account.repl.co/

2 years ago
You are viewing a single comment. View All
6
Baconman321
Baconman321

LOL looks like we got competition. In our (Ok, tussiez mostly made it, I just helped him make it work offline and such) minecraft (sortacraft), we are making gravitational pull (with terminal velocity), as well as light blocks. We are planning to add other cool stuff too!

Ok

@tussiez
come check out our competition!

Btw, nice! My school blocks anything with minecraft in the url (not this post tho...), but from what I have seen in the pics gives the impression hard work.
Keep it up!

2 years ago
2
repl-account
repl-account

@Baconman321
Thanks! May I have a link to your Minecraft?

2 years ago
5
Baconman321
Baconman321

@lilpeen
not mine (although tussiez credits me a whole lot thanks tussiez :D), but yeh. It's really buggy right now, can't move (jumping has caused you to glitch up in the air and stay there), but come back later (tussiez and I are working on getting jumping done) and it might just work. Also, we might just use WASM to speed up the game. We also use web workers to make the game run faster (although it's still slow cuz it loads chunks), because web workers allow you to use multithreadedness. Overall, it's really laggy and buggy, but that's because of all the features we are putting in. Oh, it's also a PWA and works offline.

Link: https://sortacraft-1.tussiez.repl.co

(DISCLAIMER: NOT WORKING WELL YET).

2 years ago
2
repl-account
repl-account

@Baconman321
World generation is great! Just need to fix the fact that you can walk through half slabs. Also, it may be a good idea to draw text to the canvas instead of in HTML elements because it's faster. Or at least disable highlighting for a better user experience. Just add another canvas right on top of the other one. All of the DOM events will go right through to the lower canvas. And what 3D rendering library are you using? I am using ThreeJS.

2 years ago
2
Baconman321
Baconman321

@lilpeen
He (tussiez) is using threejs. What text? It goes to another file for the new world generation. The only text I know of is the version display, which shouldn't take up as much power. Actually, putting it in canvas may be worse, since canvas is the element that gets constantly updated. As for the user select, I don't think that would be a good idea to turn it off, in case they want to copy/paste version, but yeah it might be a good idea. As for half slabs, he's working on that. Combining two slabs makes water (for a test he was doing).

2 years ago
1
repl-account
repl-account

@Baconman321
The comments section chat isn't really time-efficient. If I shared the Minecraft repl with you, you wouldn't sabotage it right?

2 years ago
1
Baconman321
Baconman321

@lilpeen
XD no (I don't do that, besides u can revert changes if someone did happen to sabotage it). I can't really chat rn, but if u want help I can make it work offline by using recycled code from our service worker on our game.

2 years ago
1
repl-account
repl-account

@Baconman321
I have shared it with you. There is a file in the root directory called chat.txt. If you or me have any questions we can leave them there.

2 years ago
1
2
Baconman321
Baconman321

@tussiez
He thought I was the owner XD. I had to give u credit where he thought I made the game. As I stated, I'm the math man, and the guy who helps with physics and performance, nothing more, nothing less :D. It has still been an honor (not saying I'm quitting, saying it has been an honor) to work with u on this :D

2 years ago
2
repl-account
repl-account

@tussiez
I can share it with you too if you want to check out the code.

2 years ago
1
tussiez
tussiez

@tussiez
On your thoughts about the GUI, the inventory is dependent on HTML elements since I'm too lazy to write down positions (e.g 254,542), however that's a good idea anyway. I am using CSS to animate the tools though, and that's why I'm using elements. Half slabs were actually a test, and it works :) The collisions don't check for slabs, however I could simply do ".5" instead of "1". Disabling highlighting isn't too hard..

I wouldn't say the game is laggy.. it typically runs about 30-40 fps on Chromebooks, but works fine on more powerful devices. Keep in mind Chromebooks can't handle Minecraft very well (They've released Education Edition for the Chromebook, but it's a very "lightweight" version of the game)

Thanks for the feedback!

2 years ago
1
tussiez
tussiez

@Baconman321
Yeah :) I cannot thank you enough for all the help, SortaCraft wouldn't be where it is today if it weren't for you. I think we're almost "done" on physics.

2 years ago
2
repl-account
repl-account

@tussiez
Yes chromebooks are slow. You are definately doing better than me on performance, especially with block destruction.

2 years ago
1
tussiez
tussiez

@tussiez
With your help, SortaCraft is over 2x faster, offline, and we can jump! (However it isn't working right now)

2 years ago
2
Baconman321
Baconman321

@tussiez
There's so much more to do, the performance can still get much faster...

2 years ago
2
Baconman321
Baconman321

@lilpeen
Ez fix. Cache main file that deals with game, that way it is served over internet faster. If course, this only helps on startup time, but can still help improve. The rest, try using web workers because then you have multiple threads doing different things (especially good for math). You can also do WASM which speeds up things faster since its an assembly language, meaning it can run faster than javascript and is also compiled instead of interpreted.

2 years ago
1
tussiez
tussiez

@lilpeen
I can help you with Web Workers - they're a big help
I'm available sometime after 2-3 EST

2 years ago
1
tussiez
tussiez

@Baconman321
Oof yeah
Especially geometry data generation
It's all math and could be done on the GPU

2 years ago
2
Baconman321
Baconman321

@tussiez
When I first read that, I was like "Oh, no are we not gonna work on physics?", then I saw "after 2-3 EST" (XD). Uhm, also I can work 2-3 CST, but did u say u are available 2-3 EST (I forgot if u said we can collab on ur game 2-3 CST or 2-3 EST)?

2 years ago
1
tussiez
tussiez

@Baconman321
If
@lilpeen
wants to, I could write down some quick instructions on how to use Web Workers today, but that's probably it. I still need to fix jumping, so I'm still available at 2-3 CST.
The reason why I put EST is because I don't know what time zone
@lilpeen
is in.. 2 EST = 1 CST
Sorry about all the confusion, I'm in school right now

2 years ago
2
repl-account
repl-account

@tussiez
Same time-zone eastern standard time. I can research webworker myself it's fine but thank you.

2 years ago
2
Baconman321
Baconman321

@tussiez
XD, ok yea see u at 2-3 CST. I should make a tutorial on web workers and such...

2 years ago
2
repl-account
repl-account

@Baconman321
@tussiez
The slownessof this comment section is killing me!! Use the chat file in the repl I shared!!

2 years ago
1
tussiez
tussiez

@Baconman321
That's a great idea!

2 years ago
1
tussiez
tussiez

@lilpeen
Got it! Feel free to ask for help anytime.

2 years ago
2
sojs
sojs

Nice job Baconmans school. My schools proxy and firewall I bypass uber-easily. It is absolute trash. There technique is just blocking certain sites that they choose, doesn't matter the URL. Feel bad for [email protected]

2 years ago
1
sojs
sojs

Wow no offense but that load time is [email protected]

image

Been like that for hours lol (like 2 minutes now)

2 years ago
2
Baconman321
Baconman321

@sojs
It's a game with more features, that's why it's slower. Plus, I have some ideas on how to make it faster.
Wait, this game, or the one tussiez and I made?

2 years ago
2
repl-account
repl-account

@sojs
World gen is amazing though

2 years ago
2
Baconman321
Baconman321

@sojs
XD its on a chromebook, so the extension only blocks "actual" requests (one you type in the address/search bar) and Iframes that need to be blocked. I just fetch the website then put it as a srcdoc attribute XD (ofc I can't load external file resources, but good for reading articles).

2 years ago
2
sojs
sojs

The tussiez and u one. Also I'm on a chromebook so it would be slow with features or not lol.

@Baconman321

2 years ago
2
Baconman321
Baconman321

@sojs
Funny, you, tussiez and I are on chromebooks for school (u on school chromebook?), yet I have not heard of a school except for mine that uses chromebooks (ok I've only been to two schools and the current one has chromebooks but still).

2 years ago
2
sojs
sojs

Nice. I created and a proxy server myself. It would not work in your case though, because in you need to put the url you want to go to in the URL. (such as https://proxy.sojs.repl.co/proxy/https:/slither.io)
You also cant log into stuff with google on it, because google is very particular about what sites you are able to login to it [email protected] Also super glitchy if u r playing multiplayer. Cant guarantee it will work.

2 years ago
2
sojs
sojs

Most schools think use chromebooks now. And yes, I'm on a school [email protected]

2 years ago
2
sojs
sojs

I've made one like that at https://repl.it/@sojs/chromium-browser-1. The problem with chromium unblockers is that if u dont have hacker plan it you cant load to many sites on it otherwise it crashes (repl memory used up)[email protected] And the shift key doesnt work so you have to look up "lowercase to capitol letters to get what you want lol.

2 years ago
2
Baconman321
Baconman321

@sojs
XD school blocks anything with "proxy" in it.

2 years ago
2
sojs
sojs

hehew. ur school is tough. Hold [email protected]

2 years ago
1
Baconman321
Baconman321

@sojs
Don't come to my school if u wanna learn coding. Also, it's for autistic kids so.... (ye Im autistic)

2 years ago
2
BCP
BCP

@Baconman321
I'm on a chromebook and it's a school chromebook the fps isn't that good

2 years ago
2
Baconman321
Baconman321

@BCP
That's the problem we are trying to fix. We want performance to be really good.

2 years ago
1
JRStudios4
JRStudios4

@Baconman321

Well, you got more competition now.

2 years ago
2
repl-account
repl-account

@JRStudios4
I NEED to know how it is that fast. Also, how long did it take and what 3D rendering library are you using?

2 years ago
1
JRStudios4
JRStudios4

@lilpeen
It uses webGl and it took about three years of coding 8 hours a day and debugging. It uses a type of cookie that helps speed up the loading process significantly. The cookie also handles storage, so that I don't have to use PHP or something to do it. PHP pauses to load, so it is a bit slower. Also, the strategy of JS that I used is a certain order that does the slowest thing first, and speeds it up. So with the cookie and the JS that it uses, the loading is shared, and ultimately sped up.

2 years ago
2
repl-account
repl-account

@JRStudios4
I am only on my 4th month, so you just wait!

2 years ago
1
JRStudios4
JRStudios4

@lilpeen
I am updating mine as I am typing this. It will soon have commands and mobs.

2 years ago
1
JRStudios4
JRStudios4

@lilpeen
Updating as i'm typing. It will soon have mobs.

2 years ago
2
repl-account
repl-account

@JRStudios4
Can you maybe send me an MDN article or something on this cookie you speak of?

2 years ago
2
Baconman321
Baconman321

@JRStudios4
It's minekahn but you modified it, didn't you? (It says minekahn at the top)

2 years ago
2
Baconman321
Baconman321

@lilpeen
A cookie is just a way of storing things in the browser on the client side.

2 years ago
2
repl-account
repl-account

@Baconman321
Yea I was wondering what he was talking about when he said cookie.

2 years ago
2
probsYash
probsYash

@JRStudios4
Did you just copy this from Khan Academy or what ._.

2 years ago
5
Willard21
Willard21

@lilpeen
Since it's actually my project, I'll answer your question about how it's so fast.

As JR says, I am indeed using WebGL for it. I store every visible block face in 1 buffer for each chunk. The faces are stored as world coordinates so that I don't need to perform any translations or transformations on them at render time.

Textures are stored in what's called a "texture atlas", which is 1 giant texture with all the other textures arranged in a grid inside it. Then when I'm building my buffers, I pass in the coordinates of the specific block texture I want to render.

At render time, I set uniforms for the camera matrix and player position (for the fog) once at the beginning of the frame. After that, I don't touch uniforms again because they're so slow. WebGL is very interesting in that it can render millions of textured triangles per frame, but it maxes out between 1,000 and 10,000 function calls per frame. So the trick is to render as much as possible in as few draw calls as possible.

2 years ago
2
JRStudios4
JRStudios4

@Lushlesss
In a way. The code is at least 94% different.

2 years ago
2
probsYash
probsYash

@JRStudios4
So, you deleted it for what reason?

2 years ago
1
tussiez
tussiez

@Lushlesss
Hold on guys.
So it's
@Willard21
's project, and not
@JRStudios4
?

2 years ago
1
tussiez
tussiez

@tussiez
@Willard21
, after looking at the Repl, are you the original writer of MineKhan? Amazing job!

2 years ago
1
repl-account
repl-account

@Unzor
Yea exactly stfu that is what a license is for. You do not realize your stupidity your accusations are all based off things that prove that I made it.

2 years ago
1
JRStudios4
JRStudios4

@Lushlesss
It's not mine, my friend gave it to me, and gave me all the credit. My explanatory was just what the code looked like a lot. His name is will, so I supposed that it was a nickname he gave himself. I don't have a khan academy account.

2 years ago
2
jakel181
jakel181

@JRStudios4
I spoke to
@Willard21
, the original creator, he does not know you nor did he give you permission to claim any credit.

2 years ago
1
JRStudios4
JRStudios4

@jakel181
I have already explained this.

2 years ago
1
probsYash
probsYash

@JRStudios4
What kind of friend would just give you thousands of lines of codes and not ask to be given any credit. Way too generous of a friend in my books.

2 years ago
1
Baconman321
Baconman321

@lilpeen
Woah, watch your language please. I know he swore first, but that doesn't give the excuse to swear back. At least, don't use the very vulgar words.

2 years ago
1
JRStudios4
JRStudios4

@Lushlesss
Hey, we've known each other for almost our whole life. When I met him I had LITERALLY just turned two. (plus he's a nice guy)

2 years ago
1
1
Baconman321
Baconman321

@jakel181
Yes. Piracy is punishable, both by repl TOS and by state/country law!
@JRStudios4

2 years ago
1
repl-account
repl-account

@Baconman321
Ok sorry, I'll delete the comments

2 years ago
1
JRStudios4
JRStudios4

@jakel181
Isn't that what I did when I deleted it?

2 years ago
1
Baconman321
Baconman321

@JRStudios4
Claim that the MineKhan game is yours?

2 years ago
1
JRStudios4
JRStudios4

@Baconman321
WHAT DID I SAY? I ALREADY EXPLAINED THIS

2 years ago
2
Baconman321
Baconman321

@JRStudios4
Huh, I didn't see an explanation. I'll look again.

From what I see, you are claiming that he "gave" the entire credit to you for his game, and you made the same game just different code. Can you verify this? Because it seems pretty skeptical right now NGL.

2 years ago
1
probsYash
probsYash

@JRStudios4
Look, dude. You're literally just digging yourself into a deeper hole at this point. You should either admit to copying this or keep trying to pretend to be the innocent user.

2 years ago
1
JRStudios4
JRStudios4

@Lushlesss
I like holes! J EJE JU

2 years ago
1
probsYash
probsYash

@JRStudios4
Take that out of context lmao. But seriously just admit to copying the code, Joseph Romriell. 10/10 name btw

2 years ago
1
JRStudios4
JRStudios4

@Lushlesss
Wait... what... how?

2 years ago
1
probsYash
probsYash

@JRStudios4
lmao magic I'm joking. You should really think twice before putting your full name in your code

2 years ago
1
JRStudios4
JRStudios4

@Lushlesss
My full name? Oh. That was when I was operating publicly, and I got to brag to my buddy that I can code, but then covid hit, so I switched to repl. I did it. That is what I said. Are you not familiar with the ceaser cipher?

2 years ago
1
probsYash
probsYash

@JRStudios4
I'm confused that made no sense to me at all. You were bragging to your friend that you could code and when covid happened you switched to repl and then you said "I did it." Wdym. What did you say. Also, yes, I'm familiar with Ceaser cypher

2 years ago
1
JRStudios4
JRStudios4

@Lushlesss
Im confusing. I know. I did it means "I plagiarized minekhan" and I asked if you know the ceaser cipher because I put it in that comment that you said to delete. The ceaser cipher part of that breaks into "I DID IT".

2 years ago
2
angrydoge
angrydoge

I just looked over this thread,

@Unzor
jeez with the swearing, but then saying "imagine being toxic" and you'd already dropped at least 1 F bomb and a few other curse words.

@JRStudios4
you cant say he plagiarized without any proof -_-

2 years ago
1
tussiez
tussiez

@dabombdgdzjr
@JRStudios4
@Lushless
@jackel181
@lilpeen

Sorry about the ping, but this situation escalated really quickly. Afaik, JRStudios4 plagiarized Willard21's MineKhan?
Plus, why all the swearing? I thought Repl.it was kid-friendly..

@Unzor
"tuss didn't even make it" - no I didn't make
@lilpeen
's game, I wrote https://sortacraft-1.tussiez.repl.co

2 years ago
1
angrydoge
angrydoge

E̴̡̧̢̧̧̞̲͈̮̳̪͇̹͇͎̱͕͙̣̦̲̻̬͎̫͕̟̣̰͙̰̘̟̬̣̻̮̤̮͚͚̪̣̖͖̖͔̰̼̙̯̺̗̒̍̀̑̄̓̈́͂̇̿̾̽̿͑͜͜͜ͅ

@tussiez

2 years ago
1
angrydoge
angrydoge

Ȇ̴̡͈̜͇͚̯̗̣͎͛̊̄̀̇͆̚͝Ė̷̢̈́̑̇̀͆̅̈̋͘͜Ȩ̷̣̫̜̞̰̗͉̭͖͖͑́̓̈͌̅̈̆̿͋̄͜E̵̡͚͉͒͋E̵̞̩͔̝̠̙̫̪͖̹̦̝̠͉̙͋̿̍̃̅̀̐̉͑͘

@tussiez

2 years ago
1
angrydoge
angrydoge

Ȩ̵̧̨̡̨̨̡̨̨̛̥͇͈̜̞̣̥̘͖̗̹̰̜̱̖̪͖̟͖̬̤͙̝̼̠͔̼̖̻̹̘̭̮̤͔͙͍̟̟͍̼͙͙̖͍̳̪͇̦͈͈̙͚̳̹͙̻̟͍̖̹̼̻̱̙̱͔͙͉̤̤̳͉̺͖̻͙͔̹̭̠̥͓̜̣̱̭̫̜̮̻̙͉̻̬͇̫̦͎̖̙̼̫̣̳͍̘̀͛͛́̅́͂̔̀̽̿͊̈́̓͛̎̎̄̏͌͆̏̅̀͗̀͂̚͜͜͝ͅͅͅͅE̸̢̛͚̞͙̙̱̙͓̲̺͎̻̲͎̟͔͇̦̮͉̣̻͇͂͗̔͐̈́̅̍̀͒̀͋̄̉͌̌̅̓̔̉̋̋̏̾̒́̉̎̄̄̕͘͝͠͝ͅẸ̶̢̡̢̧̨̱̙̟̳̝̣̹̣̪̮̣̱̯͙͕̭̼̦̟̝͇̞̮̦͙̻̤̣̻͕̞͉̣̪̪̬͓̠̰̪̪̦̲̲̟̱͉͉̩͓͍͕̲͔̭͚̟̼̙̬̬̳͚̮̭̤͓̟͖̮̗͈͍̜̝̗͎̤͓̱̟̭͖͉͔̩̹͇̪͇̎͆̐̄̄͜ͅͅḜ̵̛̼̤͓͔̙̰̫̩̖̫̗̳̱̩̈́̌̎̓͐̂͐̾̀̔̈͛́̈́̓̃̈́̾̀͑̇̓͌̌̈́̃̈́͊̈́̎͒͂͊̀̿̒̆̉̐̈́̔̕͘̕̚͝͠͝͝Ě̸̡̢̨̛̛̛̜̲̤̟̠̜̻̞̘̲̥̠̞̭̖̬͉͉̻̪̬̞͖͎͈̯̪̝̻̖̙̹̭̰̪̥̣̰̞̪̙̝̦̟̭̲̥͙̤̘̼̺͍͈̲͕͇̗̻͈͖͇͚̀̔̌̔̈́̋̿̃̀̐̆̍͊͐͋̂̓́̃̇͒̿̽̏̾̀͂͛͌̃̀̋͋͗̀̉̊̒͆̀̔̈́̓̊͒̀̄͌̑́͆̓̃̇́̀͊̓͌̂̑̃̏̊̓͛̄̓̓̒̂̄̾̿̀̑͑͛̉͆͛̋̉̍̌̌͗́̀̔͗̓̃̋̏̈́̈̈́͊̈́̿͗̇́͊̂̏̍͋̊̆̈́̀̀̀̈́͆̇͂͐̐̒̒͘̕͘̚͘͘̕̕̕̚͜͝͝͠͠͝͠͝ͅȨ̵̢̢̢̨̛̭̤̟̗̠̣̲̗͎̱̳̯̺̪͈̙͙̝̱̹͈̩̫̲͔̳͎͍̺̭͉̞̫̼͉̙̬̝͉͓̲̲̫͉͈͈͉̠̳̠̩̏̀̃̾̅̀͋̅͆̑̈́̈́̔͗͑̎̈͒̽̆͂̏̅͛̄͐́̈́̅͘͝͠͝͝ͅĘ̶̧̡͕͎̘̪͍̟̯͖̣̘̞̘̪̜̰̬̤̤͎͎͖̫̟̤̪͍̠̖̪̼̲͓͙͇̲̞͇̰̤͙͉͍̱̘̝͍̥̬̹͊̃͜͜͜E̸̡̧̡̨̧̧̧̧̢̧̛̛̛̛̲͍̝̼͔̝͇͕̳̳͉̯͕̙̻̹͓̬͔̫͇̻͈̗̳͔̻͍̩̮̼̯͎̙̯̙͙̝͙̰͇̯̗̺̝̥͈͉̖̖͉͔̞̘̤̱̪̪̝̰̣̯̟̟̝͎͓̝̞̳̱̤̮̲͕̜̰͌͑̏̐̉̑̈́̓̋͑͑̓̇͑̈̋̆͌͌̎̄̈́͗́̋̎̀̋̀͌͂̓͋̀̒̋̑̈́̇̂͗̍̈́̿̾̌̈̓̃̌̊͑͋̊̂̽̃̍̄̌͗̆̓̅́͐͂̃͂͗̐̎̿̄̿̍̽̐̌̅̈́̌̓̒͛̍̆̓̈́̂̓͛̏͗̏́̇̈́͊̊̾̅̓̃̓̒̂͌͆͐͐̌̈̿̅͐̎̏͘̚̕̚͘̕͘̕͘̕͜͝͝͝͠͠͠͠͝͠͠͝͝͠͝͠͝͝ͅͅͅͅĘ̸̡̢̡̨̢̡̡̡̨̢̧̨̺͈̞͈̺͇̹̙̙̗̹̞̺̼̼͕̱̺̹̩͉̩̩̗̞̭̜͔͇̠̫̤̭̻̝͕̳̭̠̹̬̱̝̭̝̭̹̝̗̦̟̭̳͕̤͚̻̮͔̗̜͚̯̼͚̯̪̣̠͓̺͖̻̤͖̣̫̥̗͉͚͍͈̳̯͎̦͚̹͖̰͉̺͕͚͈̬̟͎̪͚͖͍̜͇͖͖͕̼͕̯͙͎̹̈́̈̽̊̏̾̉́́̂̒͒̏̅̽͑̓̔̈̔̉̈͑̂̒̅̕̚̕͘͜͜͜͜ͅͅͅͅͅͅ

@tussiez

2 years ago
1
Baconman321
Baconman321

@tussiez
NO DON'T RESPOND MORE OR HE'LL GO "E" CRAZY

2 years ago
1
ahkid7674
ahkid7674

@sojs
it dosent do that 4 me

2 years ago