That looks pretty cool! I’m gonna have to take a look at it sometime. If you want to go a step further with voxels, you should check out this post: http://hub.jmonkeyengine.org/groups/free-announcements/forum/topic/voxel-terrain/. That would be cool if you could do that… Just a suggestion There’s a couple of resources there…
that is pretty sweet! it looks like the whole terrain is generated from heightmap data and is 1 solid geometry, does that mean it is not (yet?) possible to add or remove voxels dynamically during runtime? and is there (will there be?) any way to assign seperate textures to each individual face?
yeah it should be easy I did not came so long, I am missing some features in jmonkey which I would like to see added before I invest my self in this with all my heart
Currently there is one big mesh. As you can see I created map and chunk classes, and was thinking about adding a tile class could fit in there. However I didn’t come so far to break up the big object into chunks. If I did you’d probably have 1000 FPS when running.
Having multiple textures shouldn’t be a problem as long as texture atlas is used. There is no support for that in jmonkey but I think you could just hardcode uw map coordinates when creating them to different part of atlas texture so that would probably be dirty and quick solution.
For what I want to do I miss texture projection, automatic world uw mapping. I’d like to take it further but jmonkey is missing some stuff I dont have knowhow to add my self, so I am just releasing this to anyone who wants to learn and understand, it took me around 1.5 month to come this far and I learned alot
if you think it can help sure I love what you did with bloxel but I had to do this my self to learn and also I wanted simpler code, bloxel had lots of stuff in there that looked too complicated for me. Let me know if you learn some new stuff and have time to share, it be great I plan to continue with this, but perhaps I’ll switch to some other engine untill jmonkey gets features I’d like to have, will see about this who knows what happens
Well you could always add the features yourself. (I highly doubt that there are (if at all) much engine that have even half the features of jmonkey, so you would have to switch over to the C++ engines.
EmpirePhoenix said:
Well you could always add the features yourself. (I highly doubt that there are (if at all) much engine that have even half the features of jmonkey, so you would have to switch over to the C++ engines.
I would if I had the know-how and my skills were enough to add those features, but I don't have those skills :)
I actually found one engine that uses phyton or c++, depending on what you like, with features I wanted in monkey. But I still like java and jMonkey, its so good for quick prototyping
And I have a lot more fps than with the actual “batchfactory-based” solution jippi!
I have a idea for different textures/bloxel-types: create a mesh for each different texture (face-based: left, right, top, bottom, front and back) … then the result will be 6 * number of textures (worstcase) meshes. A optimization could be: merge all “same” textures to one (like BatchFactory) …maybe I can use the BatchFactory for the last step …
Amazing, glad to have helped, how much improvment in FPs did you manage to get?
you know you can play with this:
final Vector2f t1 = new Vector2f(0, 0);
final Vector2f t2 = new Vector2f(1.0f, 0);
final Vector2f t3 = new Vector2f(0, 1.0f);
final Vector2f t4 = new Vector2f(1.0f, 1.0f);
to get that specific face that you are about to construct to map to another part of texture. Do a test, create small atlas texture perhaps with 6 textures, then play with those numbers to just get the texture from specific position. I’ve tested it and it works fine. Its not beatiful solution since you’d want to have solution that is more automated, but this will work and it will be much better then what you suggested
Ofc dont froget that now you will need code above for each face of cube, so you’d place it in if case for each face you construct, but with different values or perhaps you put it a function and call it with some parameters :)=
My first hack run really faster (>200fps) … 4 chunks in each direction around the central player position, each chunk have 8 bloxels in each direction from the chunk-center (=16x16x16 bloxels per chunk) so we have a volume around the player with 128x128x128 bloxels. That’s not so much … 256 or more should be possible
Your createWalls() code was very important for me … here I see how to do the http://en.wikipedia.org/wiki/Tessellation to create a mesh from “volume information” … I was too lazy to do this
so my tesselation code with one bigh mesh was more optimized then yours chunk meshes nice, now imagine how much optimizations you get with chunks + create walls
I read about that from a guy who experimented with openGL 4 and phyton, I thought it makes sens, lets do this instead of using cubes, since using cubes you have too many faces there that are never visible…
as you saw in my code 256x256x128 is possible, and you can probably go even higher then that, perhaps 300x300x128. Notice also that memory usage is not that crazy, I get around 500MB, same as minecraft which is not bad, you can go up to 1.2 gb before java crashes, it doesn’t deal so good with higher memory even if you specify in Xmx1024m…
What can also be optmized here is to remove the walls you see when you go outside of the terrain, you can remove 4 walls, since player will never see them, you don’t need them there…
some of you may notice I have function castDownLight(), well as you guest that would have been used to generate minecraft like lightning. Its not finished so that would have been something I would have added. I’m not sure if I’ll continue development of this in java, but since this is nice starter kit and you get to learn much by studing it, its up to you to make any kind of lightning you want!
yes, I removed the texture that I did not have copiright for, you need to find a texture on the net, perferably 32x32 pixels wide, or just create your own then it will work
If you dont understand it, its important to put in on paper and I disected just 1 box on paper and understood how to build it properly my self. When you can build 1 box your self and you understand what you are doing, its easy to scale it up
So just look at those drawings if you get confused, or just draw some your self and take time to understand…
You can optimize this by adding chunks, I mean breaking big mesh you got there into smaller chunks, that would speed it up even more and would allow for bigger terrain then you got now. You’d have to figure that part out your self. Best is to do it first on really really small scale. I like to do things on small scale cos my brain can understand it better, and then its easy to scale up… So you could limit the mesh to be 9x9x9and then work on that scale and create chunks that are just 3x3. its much easier to visualse whats going wrong when something goes wrong
When you get it right on really small scale you can easiliy scale it up to big numbers
You could do physics, but you would need to limit it. If you dont need endless terrain then you dont need chunks, if you have limited area like 100x100x100 you are fine with what I gave you, you can start experimenting with physics and learning that!
yet another mincraft clone You are welcome to put your ideas into our project (also another minecraft clone gg) : http://code.google.com/p/bloxel/. We already have a open-world-infrastructure (actual without hd-persistence, the memory is the limit), heightmap based terrain loader (perlin noise is coming for caves, tunnels etc.), maven based build, simple water simulation …