Adding Infinite World Generation To My Minecraft Clone
Вставка
- Опубліковано 5 жов 2024
- In this devlog of remaking minecraft in java, I add infinite world generation, improve on the water graphics, and I also explain multithreading.
Music used:
Radiant Historia - Perfect Chronology
Super Mario 64 Music - File Select
Route 216 Midday) Pokémon Diamond & Pearl
Pokemon Black & White - Undella Town (Winter)
Useful resources:
LibGDX: libgdx.com/
Java's ExecutorService: www.baeldung.c...
On your first video I didn't comment on the Java thing because I assumed you knew that it was slow and just preferred Java, but I need to address that it is in fact not true what you said regarding Java.
"Java used to be slow 20 years ago, but that's no longer the case"
This isn't even close to true. As CPUs get more advanced, not everything changes equally. Multi-threading has advanced much more than increased clock speeds, and lagging behind even those things (since it's not so marketable) is cache sizes. Java's horrendous memory model constantly thrashes the cache forcing the CPU to make fetches to system RAM all the time. You'll find that upgrading to a CPU like the 5800X3D with it's 3D vcache disproportionately improves the perf of Java applications, since the starved cache can now sometimes get hits.
Note that I didn't say Java was as fast as C++ or Rust. I'm well aware of Java's performance issues regarding cache and indirection, and many optimizations in this series will be addressing the memory model, such as using object pooling. On a side note, what do you think of Project Valhalla?
@@finalforeach I know as much about project valhalla as what I just read when looking it up, and it seems like a valiant effort and if Java were my choice language I'd probably be excited about it
@@GabeRundlett Indeed. Of course for this series it's a moot point since it's not part of the current releases, but I am quite excited for it.
Literally Minecraft Bedrock edition lol
Although you already mentioned that in the video
@@finalforeach Rust is maybe faster, but its compiler takes years to compile (as a Gentoo user it is a problem for me), and leaves 40 gb (!) of compiled sources. Not to mention its absolutely retarded syntax... Java live forever!
Yes please add LOD. You'll never look at a minecraft world the same after playing with Distant Horizons
yep, the game actually FEELS like open world when you are able to see more than 300 blocks away.
This needs more likes
1 pixel textures let's gooo
Distant horizons is a terrible mod. Once you start playing with it, you can never stop.
so at a distance, you could use a simpler mesh and baked down texture, with a normal map to calculate lighting from. could also split it into two layers, the main smooth section and a smaller number of blocks, for something the player built, or blocks that would have a visible silhouette, and could even have that merged between several chunks. and if there’s both distance fog and distance blur (render everything past some distance to a buffer, separable blur it, render next set inwards over top, repeat), the far chunks could be really low detail but still look fine. could even have a simpler way to calculate how a given biome with large scale features looks, like a forest could just render a blobby looking leaves texture
Listening to things being explained over the Mario 64 file select theme just feels right.
Also, as for the realistic water physics someone suggested: That feels like a pipe dream to even approximate for a project aiming for high performance optimization. Terraria is 2D, and despite making making some sacrifices to realism in exchange for looking and running better, fluid movement is still far from smooth at times.
Something similar to Terraria's water mechanics could be a decent way to approximate it in a voxel game, but it would have an even larger impact on performance than it already does in Terraria.
A lot of people don't realize that fluid physics lags Terraria servers. Very fast, in fact. No computer ever will be able to stand an entire underground water blob being bombed for a hellevator. The water will just float in the air until it's updated and it finally lands. Sometimes other parts of the game will be lagged too.
@@HappyGick Oh wow. I don't really play multiplayer that much, so I didn't know it got **that bad**, but it makes sense. If something impacts the framerate in a single player setting, the impact could be significantly, or even exponentially, higher in a multiplayer one.
What about minecraft water physics but modified to have flowing source blocks.
There is am mod for 1.12 called streams wich implements something like similar
other engines and some MC mods have done this sort of thing already. its very doable. not to mention potential hardware acceleration gains by using compute shaders for simulation.
the reference to the infamous M64 Parallel Universes video got a subscription from me lol.
The sudden Mario 64 select file theme made me smile. The best theme to explain all the parallel things
Its a play on a thing pannenkoek (sm64 tas youtuber) says so its also funny ua-cam.com/video/3FiP7i48rN4/v-deo.html
loving the series so far! I'm learning a ton :D
woah dint expect you to be here!
Oh, that's a surprise, but a welcome one
Omg hi silly cat !!
mewo
???? I watch your videos!!!! (I'm subscribed)
I'm interested to see where you go when you start deviating from minecraft, like what kind of game genres and atmosphere you might explore.
I like how minetest went the terraria way after some years
I began to prefer minetest over minecraft, specially online
If he wants to make textures, he should do 32 pixels instead of the Minecraft 16 pixels across
@@truthhunterhawk3932 might be interesting.
Uncanny valley
Sigh, don’t u get the goal here is to make mc multithread 🙄
i think LOD is def good for a voxel game, since most things are basically just pixel mush once you get far enough away, itd be hardly noticible if done right
This is so cool :)
Seed moment
SEED!
Who tf are you?
I think changing the grass block to be a full grass block would be much better, because at a distance the mountain just looks like a bunch of dirt with small amounts of grass. Love your videos btw
Nah, he just needs mipmaps
i think he should lower the grass, but not fill it completely, because if he filled it out completely there would be no transition between grass and dirt
@@TheNormemegianyeah and later he could look at implementating connected textures like CTM and Continuity does. Obviously something not immediately important at this stage in the project.
@@TheNormemegian Yeah, that's what I don't like with the optimization mods that have this feature. While all of the exposed sides of the grass block to have the same texture will look nice, It falls apart when the adjacent blocks are dirt blocks. You'll have that ugly blocky grass that completely throws off the ambience of the environment. That's why I always turn that off.
Counter argument: do what Vanilla Tweaks does and just have lower side faces on the grass
Fantastic video, I love projects like these! Your music choice is great too.
I don't want to pile on suggestions, but one of Minecraft's missed opportunites is how the landscape is so uniform, with very little in the way of cliffs or plateus. Before you develop the terrain generation further, I wanted to throw out the idea of seperating large chunks of land and then shifting their height some distance away from sea level. These regions can be used to create valleys, oceanic plateaus, natural forming cliffs and waterfalls, and could be used to group biomes together.
I'm excited to see where this project goes!
The reason I love programming is because most games are made to be optimised for most players, whereas if you make your own stuff you can make as many crazy terrain and features as you want, as long as it runs on your pc
Please do this! I love landforms!
I would like it to be affiliated with "Better than Adventure" bringing back the classic minecraft vibes but making it feel innovative.
1:50 I really recieved the "we need to talk about parallel universes" vibe from SM64 here
Yeah I was about to have some Pannenkoek flashbacks
Anyone else getting major Minecraft Alpha vibes! Loving it. Bring back that nostalgia.
i cracked up at the parallel universe joke you used to explain the parallel threads, amazing video
I tried my hand at making a Minecraft clone a long time ago, It was for the similar reason of wanting to prove that colored lighting was possible with the current version of the OpenGL that was being used.
I had success making decently performant colored lighting back in 2014-ish. I'd love to watch you go through that process as well. It's surprisingly not too complicated! But I'm sure there is tons of opportunity to increase performance
Minecraft already had colored lighting in 2014
@@gyroninjamoddersurely not
@anon1963 It was added in beta 1.8 which is from 2011. The change made torches give a warm color and moonlight give a cool color compared to normal sunlight.
@@gyroninjamodder I think they mean proper colored lighting
@@gyroninjamodder three lighting colours isn't quite the same as multicoloured lighting (e.g a green torch when behind green glass)
unfortunately coloured lighting gets expensive fast, especially when interacting with lighting of a different colour
Very excited to see where this goes, i personally have never found interest in the more in-depth process of coding, but it appears you've changed my mind
This is highly encouraging me to give this project another go. Tried it before but the multithreading was the most confusing part.
It would be fascinating if you could work out a way to 'multi-thread' your project by giving tasks to your viewers :) So, for example, perhaps you want to maintain control of the main thread (pun intended) of the project, that's cool, but in the mean time you could put a hook/interface in front of tree generation, for example, and others could come up with a way to create beautiful forests. As people come up with cool ideas, that becomes the source for yet another devlog. In so doing, one has perhaps discovered infinite [UA-cam] content generation, hehe. Just a thought :)
I'm not a Java guy (prefer Typescript) but I'm finding your commentary interesting. Thanks for sharing.
Wonderful series so far. Also, good pannenkoek gag
Pls don’t stop this till it gets as good as normal Minecraft, this is what Minecraft needs
2nd devlog and it already seems to be coming together, i love the transparency of this guy, no shouting, no bloat, just the content of the video! im glad that you are growing!
also, i think that you should add more complex trees, although this may kinda remove the minecraft feeling.
This guy is amazing.
I wonder how far he is going to take this clone
only 2 videos created and im already hooked and subscribed, very excited to see the result of this project
why is bros voice so majestic, i just wanna see some one make minecraft but now i get the plus of being soothed while doing so
Love the little nod to pannenkoek with the "let's talk about parallel threading"
Damn nice to see part 2 already, keep of the good work!
The same music in the background of this video and the video explaining parallel universes in SM64 was perfect. Made me chuckle
Mojang, start taking notes!
They do far beyond this lol
(randomly dies without reason be like)
@@wahex I just use sodium or optifine.
"But first, we need to talk about Parallel Threads" *Mario 64 music starts.*
Absolute whiplash. Fantastic.
when the mario music kicked in and i heard the word parallel i got sent to another universe
love ur videos dude ❤
My jaw dropped when the mario 64 music came in for the parallel threads explanation-
Amazing reference there!!
Love the pannenkoek reference haha
I'm really glad that youtube started showing me channels like yours. Definietly gonna keep watching yours.
1:45 I love the pannenkoek2012 refrence.
Its funny because back in Minecraft 1.12 players discovered that you can actually initiate a race condition through game mechanics and use it to tear blockstates to obtain illegal items. Thus demonstrating how dangerous it can be to have multi threading in a sandbox game.
Im excited to see where this goes. In my head I always thought about making a minecraft from the ground up but with my own twist, so these videos are interesting to see.
I absolutelly adored that reference to the M64 TAS Speedrun explantion by Bismuth on the parallel threads bit.
i love being able to follow tis journey, it feels so nice when youre watching a youtuber without many subscribers!
Can't wait for the next videos, your explanations are so calm and yet understandable, it's really nice to listen to them
I didn't realise this was a series, glad I got recommended the second devlog!
I loved the Parallel Universes reference. Nice!
Just watched the last vid coincidentally,can’t wait to see this one
Oh I absolutely lost it when you added the Super Mario 64 - File Select. Truly a Parallel Universes moment.
I am super interested to see where this project goes and can see this channel getting a lot more traction in the near future. Look forward to your next upload!
i think making water slightly darker the deeper it is would look good
I don’t often click the like button for videos, but so far i have liked every one of your minecraft clone videos. I’ve been pretty passionate about minecraft’s bad optimization and I love that you’re taking it on by yourself!
Never heard of the term "Tech Debt" but I will definitely be using it when explaining game development to people.
You drawing the comparison between this and Aseprite in terms of how it should be open source really struck a cord with me, I really hope this project goes places, its been lovely for the two videos! Great work
"But before we talk about world generation we have to talk about parallel threads"
Cue Mario 64 soundtrack
"But first-" with that specific soundtrack got me having flashbacks to the scuttlebug lol
Man I'm glad I found this. Looking forward to getting through the series.
This series is really nice, good pace, good and easy explanation and easy to learn! Keep going! ❤
Why not use a render thread that only deals with the GL operations, it is very crucial in my opinion
The main thread is the render thread, there's no dedicated update loop because there's nothing to update right now other than basic camera controls, but it would be separated in the future.
@@finalforeach I have 4 questions: 1: Will you go 16x (pls say yes), 2: will there be a discord, 3: are you hiring devs, and 4: will there be modding support?
I would absolutely love to see you turn this into a full, commercial, highly optimized take on the minecraft formula. Its clear that your vision of the game is something that would make an incredible game. Good luck, and never give up. I know that a majority of old minecraft fans would love to see this become a reality!
The parallel threads joke was amazing.
My idea for the inventory problem would be to make different but similar items stack together, perhaps as broad as "stone block" for different stone types and automatically separating when over the stack limit. If following Minecraft's control scheme you would right click to separate.
I really hope you keep up with the project! I see a lot of projects like this that get left alone for a long time randomly and it’s really demotivating to see.
I'm really excited to see where this series goes
My favorite programming project yet was making a Minecraft clone in Windows Forms (a pretty outdated Microsoft library that's meant for making basic 2D applications). It was a blast to figure out the 3D (even though I never quite got it working 100% right). So much fun to do and I recommend everybody here to try to make a Minecraft clone
It was only 2nd video on your channel but it's already one of my favorite series on youtube
Maybe not water physics, but rivers that actually have a stream and movement would be really cool.
that pannenkoek2012 reference had me rolling. Great job
I'm excited to see more of this!
bro starting out the video with RH:PC music just injected nostalgia right into my veins, with that said nice music taste and you have a very intuitive topic explanation method
This is awesome! I can't wait to see what comes out of this project, genuinely
1:49 , I'm not sure if it is but it does look like a reference to Bismuth's habit of playing Mario's file select theme to explain complicated topics such as parallel universes
"[Super Mario 64 music] But before we talk about world generation, we need to talk about parallel threads"
Hahahaha that really got me, good job.
this is very awesome! good luck on your minecraft clone
now watching most of the video, you should make the trees look less awkward on the side of mountains and try adding more flat terrain. (the flat terrain is perfect for trees, like the plains in minecraft)
I love the parallel universe reference and parallel threading with the Mario music lmaooo
yoo hes back, very excited for what the future of this project is going to be
This reminds me of the 12 year old clone of minecraft called Survivalcraft, Kaalus the (dev of Survivalcraft),
He changed his game which only had crafting and 4 animals and only 10 blocks in the whole game, after a week he added stairs, slabs, torches, trees, better terrain, in-game settings, world gen options and alot more
Seems like you're also a great dev like that! You changed your game so much in a week, I mean this does feel like a lot to me
This is the earliest I've ever been for a video and I can say that as someone who learns programming (Java also), this was worth every second.
"But before we talk about world generation, we need to talk about parallel threads..."
*SM64 music intensifies*
LMFAO THAT WAS A GOOD ONE
Damn this series is taking off. Good luck!
luckily the mojang finally started to do something with optimization, they decided to fix the lighting engine, or rewrite it, there is still a lot to the final result, but this means that in a couple of years we will no longer have to look for the next builds like ultra boost fps sodium lithium etc.
Excited to see what you do with this project. How far are you thinking of straying away from minecraft? And what are your plans for gameplay?
I am loving it so far, you have a very calm tone and a very good pace when speaking, which in this platform is always a breath of fresh air. I am not a programmer so I can't comment on anything about the optimization, but I want to make my own sugestion about world generation and it's something minecraft took a while to add and to actually work out, and that is world height distribuition:
Minecraft took until the caves and cliffs update to make this aspect of the game more fleshed out, and it still has many oddities when it comes to oceans. in the real world you have mountains and usually past the mountains there's plateaus that sit at a higher elevation on one side of the mountain. World generation where you had a difference between let's say 5 main altitudes for example (and I will ignore caves for now since your project is still quite early), first the depths of the oceans and ocean shores being 2 different levels, in the real world we have the continental shelf in shallow oceans and then in open ocean there's a significant drop downwards, rarely right off the coast, then having a lowland height for flatter terrain that's not too elevated, then a foothills/plateau level that would correspond to the areas where the lowlands meet the mountains or the areas in between mountains, finally the mountains themselves.
I don't know how much of a toll it could be in development complexity, I imagine it would be related to adjusting the 3D noise you used here to have mountains and lakes, giving i more varation of how much noise there is in each height I guess? Part of me expects to show up in the next video like one of the sugestions that's too out there, another hopes I at least understand enough to have said something that makes sense for a programmer.
Came for the clone, stayed for the pannenkoek reference xD I love it
Very cool, learning a lot + I love java so happy to see someone doing a project in Java for once
THE PANNENKOEK REFERENCE HAHAHA
I love this, it's amazing!
I’m excited for this project, and I’m looking forward to every devlog/ video! I love Minecraft and have played since late 2011, but I’m curious to see where this goes since you seem to love Beta Minecraft more.
love this! Also kinda crazy to see how far Java can go
Amazing video! Can't wait to see how the game evolves further, and I'm really impatient for the next video of the series. Keep it up!
Watching this give me the feels of the documentary on the formation of earth 😮
the half a button press joke was great
This is getting interesting as i am a student in programming, and i am learning new things.
This project is very interesting to see, so far, and I find that your way of describing it is very efficient (you explain the "why" of each decision very well without getting mired in the "how"). I do hope that you eventually release the source since I have sometimes wondered about building something similar and would be interested in seeing how you approached much of the graphics setup and mesh baking.
I have had the performance argument many times and it is too tedious to bother with but you are very correct: Java performance will be plenty fine. In fact, the design of the system is the most interesting part of overall performance and scalability so the argument is almost just a foray into triviality. That said, here are some points related to Java performance which most people who aren't VM designers don't usually realize:
-JIT is obviously a huge win (often able to generate better code than a static compiler)
-compressed references are a huge win in small heaps on modern ABIs
-the GC can do dynamic object movement, which native systems cannot do, which allows dynamic locality optimization (especially important when you look at things like NUMA)
-multi-threading primitives and utilities in Java are very good and are defined in robust ways (although architecture dependent native stuff can sometimes benefit from LL-SC in their design - not portable, though)
-usually people think of "new" in Java like a "new" in C++, although they have nothing at all in common (Java allocation path trivial and fast whereas the native one is far more complicated and slower)
-inline arrays of structs are a big win for native systems which is an area where Java would have a disadvantage
-a good native developer can control allocation and locality in a way which JIT escape analysis and GC reference traversal can only approach but many native development philosophies mean that Java will still come out on top (this is the "allocate on heap and wrap in scoped pointer" idiom)
-GC cost can be an issue for real-time systems, even though it allows for massive throughput
Getting back to the more interesting parts of this project, I am interested in where things will go once you get into the actual block update game logic. This appears to be where Minecraft's current limitation lies. Something I have wondered about is how difficult it would be to build this as a parallel algorithm (as opposed to a concurrent algorithm, like your mention of chunk generation): Schedule updates per-chunk (which might cause redundancy), execute them across a large collection of threads within the game tick, and force updates which follow from those to be scheduled into the following tick. This may impose some bizarre restrictions on how transitive operations can progress but would allow the core game logic to scale up dramatically.
Oh, and another idea I had wondered about, which you might have some ideas around: If you need to deal with large arrays of primitive data for meshes and textures, is there a win to putting those off-heap in a direct allocated byte buffer? At this point, it might just increase levels of indirection but I have wondered if this would reduce heap pressure as systems like this become larger.
Either way, I am very interested in watching this project progress and I am fascinated by what you have done, so far.
Fascinating comments regarding the JVM. As far as the update logic goes, I guess we'll cross that bridge when we come to it, but I think there's a lot of design decisions that can be made so that it doesn't become a huge bottleneck.
For the meshes, I use the LibGDX library, which stores vertices and indices in java's NIO buffers with native on-heap memory. Because I'm not continously thrashing the GC with allocations (as minecraft does), I don't think there's too much benefit to storing it off heap; but the concept is relatively new to me, so correct me if I'm wrong.
@@finalforeach Thanks for the reply.
I honestly don't why Minecraft spends so much time in the tick processing logic. I am interested in seeing where you go with it since it seems like a single-threaded loop should be sufficient. I more just wanted to mention the parallel approach just to make sure it was on your radar.
I wouldn't worry about the off-heap buffers for meshes or textures at this time. If LibGDX does something reasonable (I had wondered what you were using, so that answers that), then just go with it. The off-heap concerns constitute micro-optimizations so they shouldn't be a distract to you at this time. On your current trajectory, you have more important concerns and I am sure we are all interested in seeing where you go with them.
In terms of overall GC behaviour, I wouldn't worry about it, right now. Back when I was doing a lot of work in GC (~12 years ago), we were telling people that they wanted the GC to run frequently (since it can improve locality and cache efficiency) and quickly (so, don't keep lots of things in your life-set - GC cost is proportional to the number of live objects, not heap size or even occupied memory space). The short answer we would give people is just to do what you wanted to do, directly, and try not to outsmart the GC or avoid it.
The other thing to remember (although you probably already know) is that many people will suggest ideas or agonize about micro-optimizations but those concerns don't matter. YOU are the one building this, YOU have demonstrated progress, YOU know what you are doing and where you are taking this.
Please... continue.
so far i’m loving where things are going, keep up the amazing work!
I loved the way you respond the comments, your voice is just too relaxing 😌
Fantastic video. I am glad you were recommended to me those fateful 8 days ago, and it is nice to hear that you are learning C++ as well. Great narration voice by the way.
I actually recently started C++ as a programming language. Most recent project was maze generation with 2 dimensional arrays. This gives me a lot of motivation on expanding on what I can learn from this. Keep up the great work! I think the next step for your project would go well with biome generation. Just different colored grass for snow, and large ocean expansions.
love the SM64 parralel universe reference in the video
Im not a game developer or programmer, but ive played minecraft since 2012, and i find these videos fascinating, even though i dont understand everything. Subscribed, I'm eager to see where this goes!
The thing I always wanted from Minecraft was the ability to make cities that actually work. Kinda like Terraria but with more normal citizens that don’t need to be venders.
And the way that Minecraft has wave defense, I always wanted some sort of villager soldier or turret integration. Like it would require a lot of AI work, but being able to design your own walls that archers would climb and shoot from would be so cool
my vision is huge biome diversity with a focus on exploration. get good music for it at some point. Can't wait to see where you take this.
I enjoy the reference to pannenkoek (intentional or not) by using Mario 64 music while explaining parallel... threads
If you can and will release this for some price I will literally buy it
It is amazing how you think and how you make it insanely optimised!
Keep up the good work :D
Me too
This is starting to remind me of the coding adventures series by Sebastian Lague and I'm all here for it
I did not expect a pannenkoek reference in a Minecraft clone coding video
it really turned into a meme, ffs and it always get a smile out of me.
I miss his mario 64 vids :(
You know he’s back right?
"we will watch your carreer with great interest" perfectly describes how i feel about your project, cant wait for the next devlog
also, i know this is your second video but i still feel like i need to say this to every developer i follow, make sure to not overwork yourself, take breaks and maybe youll even get some cool ideas