After 8 months of extensive study of the Java programming language, today I started making a 3D application. So far, things are actually going better than expected, and since I'm an egocentric person, I'd like to show you guys how far I got. Because a screenshot says more than a thousand words, here it is:
Yeah, it probably doesn't look like much, but there already are a couple of features I can brag about
The first-person camera is working perfectly, and the application currently shows a chunk (aka 3-dimensional array of block IDs). The only IDs currently in use are 0 and 1, 0 being air, and 1 being a grey block.
Also, block faces not exposed to air are not rendered at all, which makes the program run very smoothly (relatively speaking, of course).
The 'Swiss cheese holes' are randomly left out blocks, a placeholder for actual randomly generated terrain.
Also, the blocks have a VERY primitive lighting engine, in the way that the top face is the brightest, the bottom face the darkest, and the rest somewhere in between.
Terms and agreements:
If you download the game, you agree to...
- not cheaply copy this and call it your work.
- report any bugs you find.
Download & instructions
The game can be downloaded Link Removed. This link will always redirect to the latest version. To run the game, extract the .rar anywhere and start RUN.bat. Sometimes it's possible to run it just by doubleclicking the .jar file.
If you're a Mac/Linux user, run it from the terminal. First navigate to the right directory using the cd command. Then enter the following command: java -jar swiss_cheese.jar
Some Windows computers may return an error when trying to run RUN.bat. If this is the case, it is likely that you have not set up the Java PATH variable. To set it up, follow these instructions:
-Select Computer from the Start menu
-Choose System Properties from the context menu
-Click Advanced system settings > Advanced tab
-Click on Environment Variables, under System Variables, find PATH, and double click on it. If it doesn't exist, create it
-Now add the following location: C:\Program Files\Java\jre6\bin
-If another location has been added as well, separate them using a semicolon.
Move with W, A, S, and D. Ascend with C, descend with Z. Press F for fullscreen.
Known bugs:
The following bugs and issues are known and will be fixed at some time.
Grass texture maps into the wrong direction at one side of all blocks.
Continue reading this topic to see how I'm slowly making progress with the application.
My next steps will be adding multiple chunks, loading/saving chunks, and eventually (and hopefully) some sort of terrain generator based on Perlin noise.
Very cool! I was thinking about starting a project similar to this but i was still learning most of the basic code. Just wondering, how long did it take you to make this?
Very cool! I was thinking about starting a project similar to this but i was still learning most of the basic code. Just wondering, how long did it take you to make this?
Making this took me around 6-7 hours, but it really depends on how much experience you have. I basically had to start from scratch and work my way up from there. However, my basic knowledge of Java is pretty solid, if I may say so.
Making this took me around 6-7 hours, but it really depends on how much experience you have. I basically had to start from scratch and work my way up from there. However, my basic knowledge of Java is pretty solid, if I may say so.
Oh well i guess i am going to ahve to start expanding my knowledge haha. So why don't you make a "mock" minecraft. Maybe not so intricate at first but start with different colored blocks, maybe a better shader, and maybe add a new block and then expand from there. I think it would be a pretty cool open source project.
Oh well i guess i am going to ahve to start expanding my knowledge haha. So why don't you make a "mock" minecraft. Maybe not so intricate at first but start with different colored blocks, maybe a better shader, and maybe add a new block and then expand from there. I think it would be a pretty cool open source project.
Sounds like a nice idea, I'll continue working on it and see where it goes :smile.gif:
That is awesome! It looks like it is well on it's way. Keep the updates coming
Alright :smile.gif:
Currently I am enhancing the block rendering algorithm so that the block faces on the sides of chunks are only rendered when required. This is because only 16 Minecraft-sized chunks (16x16x128) make the FPS drop to around 5. Already, most of this works, but I am still encountering a few glitches that I'll have to fix first. As soon as I made a reasonable amount of progress again, I'll post a new update.
In my experience, it is fastest just to let the GPU do the backface culling.
My guess is that you're drawing the cubes in immediate mode (glBegin, vertex vertex vertex, glEnd). Try using VBOs instead, you'll see a massive increase in performance.
The algorithm I am writing isn't a backface culling algorithm. It's a bit similar, but real backface culling would also not draw faces that are exposed to air, but not visible.
To give you an idea of what I'm programming, I'll show you the code:
Note that the worldData array contains information about block IDs. And yes, I know this is very primitive. But I'd rather find these things out on my own instead of copying a piece of code from somewhere on the internet.
if (i != 15) {
if (worldData[g][h][i + 1][j][k] != 0) {
right = false;
}
}
if (i != 0) {
if (worldData[g][h][i - 1][j][k] != 0) {
left = false;
}
}
if (j != hMax - 1) {
if (worldData[g][h][i][j + 1][k] != 0) {
top = false;
}
}
if (j != 0) {
if (worldData[g][h][i][j - 1][k] != 0) {
bottom = false;
}
}
if (k != 15) {
if (worldData[g][h][i][j][k + 1] != 0) {
front = false;
}
}
if (k != 0) {
if (worldData[g][h][i][j][k - 1] != 0) {
back = false;
}
}
@Radioaktiivinen: The code up here determines wich block faces should be drawn. However, this only works inside a single chunk, so the sides of the chunk are still drawn.
Also, this was incredibly quick, but suddenly there's randomness involved again.
Next step: creating an algorithm that smooths this terrain for a bit, but keeps the randomness.
how much tnt did that take to make :tongue.gif: yeah once you get smoothing down it should look good, maybe make a terrain generator mod for minecraft using it?
how much tnt did that take to make :tongue.gif: yeah once you get smoothing down it should look good, maybe make a terrain generator mod for minecraft using it?
Smoothing is quite easy. it's basically this:
If x or more faces are exposed to air, remove the block.
if y or less faces of an air block are exposed to solid block, turn the air block into a solid block.
Smoothing is quite easy. it's basically this:
If x or more faces are exposed to air, remove the block.
if y or less faces of an air block are exposed to solid block, turn air into a solid block.
sounds interesting :tongue.gif: i wouldn't have the patience to do something remotely close to this :tongue.gif:
Man it takes a lot of render passes to actually smooth the terrain for a bit. After checking 50 times whether a block should be eroded or not, I got this:
This is actually starting to look like real terrain :cool.gif:
Looking much better than swiss cheese already. I think it's pretty neat you have a terrain generator that is not based on Perlin/Simplex/Diamondsquare for a change. :smile.gif:
Agreed. It would be kinda cool if you released the code you've made and it became as popular as these.
Latest released verison:
pre_0.7.3
Latest update:
After 8 months of extensive study of the Java programming language, today I started making a 3D application. So far, things are actually going better than expected, and since I'm an egocentric person, I'd like to show you guys how far I got. Because a screenshot says more than a thousand words, here it is:
Yeah, it probably doesn't look like much, but there already are a couple of features I can brag about
The first-person camera is working perfectly, and the application currently shows a chunk (aka 3-dimensional array of block IDs). The only IDs currently in use are 0 and 1, 0 being air, and 1 being a grey block.
Also, block faces not exposed to air are not rendered at all, which makes the program run very smoothly (relatively speaking, of course).
The 'Swiss cheese holes' are randomly left out blocks, a placeholder for actual randomly generated terrain.
Also, the blocks have a VERY primitive lighting engine, in the way that the top face is the brightest, the bottom face the darkest, and the rest somewhere in between.
Terms and agreements:
If you download the game, you agree to...
- not cheaply copy this and call it your work.
- report any bugs you find.
Download & instructions
The game can be downloaded Link Removed. This link will always redirect to the latest version. To run the game, extract the .rar anywhere and start RUN.bat. Sometimes it's possible to run it just by doubleclicking the .jar file.
If you're a Mac/Linux user, run it from the terminal. First navigate to the right directory using the cd command. Then enter the following command: java -jar swiss_cheese.jar
Some Windows computers may return an error when trying to run RUN.bat. If this is the case, it is likely that you have not set up the Java PATH variable. To set it up, follow these instructions:
-Select Computer from the Start menu
-Choose System Properties from the context menu
-Click Advanced system settings > Advanced tab
-Click on Environment Variables, under System Variables, find PATH, and double click on it. If it doesn't exist, create it
-Now add the following location: C:\Program Files\Java\jre6\bin
-If another location has been added as well, separate them using a semicolon.
Move with W, A, S, and D. Ascend with C, descend with Z. Press F for fullscreen.
Known bugs:
The following bugs and issues are known and will be fixed at some time.
My next steps will be adding multiple chunks, loading/saving chunks, and eventually (and hopefully) some sort of terrain generator based on Perlin noise.
Making this took me around 6-7 hours, but it really depends on how much experience you have. I basically had to start from scratch and work my way up from there. However, my basic knowledge of Java is pretty solid, if I may say so.
Oh well i guess i am going to ahve to start expanding my knowledge haha. So why don't you make a "mock" minecraft. Maybe not so intricate at first but start with different colored blocks, maybe a better shader, and maybe add a new block and then expand from there. I think it would be a pretty cool open source project.
Sounds like a nice idea, I'll continue working on it and see where it goes :smile.gif:
The open places between the chunks are only there to make it easier for me to identify the chunks. They will be removed later.
That is awesome! It looks like it is well on it's way. Keep the updates coming
Alright :smile.gif:
Currently I am enhancing the block rendering algorithm so that the block faces on the sides of chunks are only rendered when required. This is because only 16 Minecraft-sized chunks (16x16x128) make the FPS drop to around 5. Already, most of this works, but I am still encountering a few glitches that I'll have to fix first. As soon as I made a reasonable amount of progress again, I'll post a new update.
The algorithm I am writing isn't a backface culling algorithm. It's a bit similar, but real backface culling would also not draw faces that are exposed to air, but not visible.
To give you an idea of what I'm programming, I'll show you the code:
Note that the worldData array contains information about block IDs. And yes, I know this is very primitive. But I'd rather find these things out on my own instead of copying a piece of code from somewhere on the internet.
@Radioaktiivinen: The code up here determines wich block faces should be drawn. However, this only works inside a single chunk, so the sides of the chunk are still drawn.
Long live sine-based world generation!
that would work for mountains quite well, i'm impressed! keep up the good work :tongue.gif:
i5-4690K @4.6GHz ~ ASRock Z97X Fatal1ty Killer ~ EKWB Supremacy MX ~ Watercooled SLI STRIX 970s
Project RedShift
Thanks :smile.gif:
Also, this was incredibly quick, but suddenly there's randomness involved again.
Next step: creating an algorithm that smooths this terrain for a bit, but keeps the randomness.
Oh and also, increase the render distance somehow.
how much tnt did that take to make :tongue.gif: yeah once you get smoothing down it should look good, maybe make a terrain generator mod for minecraft using it?
i5-4690K @4.6GHz ~ ASRock Z97X Fatal1ty Killer ~ EKWB Supremacy MX ~ Watercooled SLI STRIX 970s
Project RedShift
Smoothing is quite easy. it's basically this:
If x or more faces are exposed to air, remove the block.
if y or less faces of an air block are exposed to solid block, turn the air block into a solid block.
sounds interesting :tongue.gif: i wouldn't have the patience to do something remotely close to this :tongue.gif:
i5-4690K @4.6GHz ~ ASRock Z97X Fatal1ty Killer ~ EKWB Supremacy MX ~ Watercooled SLI STRIX 970s
Project RedShift
This is actually starting to look like real terrain :cool.gif:
Agreed. It would be kinda cool if you released the code you've made and it became as popular as these.
The major problem with my code is that it lacks variation at the moment. All you see is slightly randomized hills which repeat over and over.
Now that I am typing this, I suddenly realize that it is incredibly easy to slightly randomize the hill height. I'll just... be right back!