Castle Story Rippoff - Inprogress

Also, I just re-looked at the original game pictures and the guy uses a kinda voxels engine, but the terrain is not built of voxel boxes, but it’s built of a kinda tri-mesh object. For the sky the guy used a kinda gradient background color with dynamic clouds. And the builds are made of voxel boxes. The guy used water processor and bloom processor as well. Also, it look the trees are animated, it looks they moves with the air, because they are a little bit inclined. But you don’t need to create a tri-terrain system, you can use the jme terrain system as well, and don’t worry about the tree animations. But the rest is indispensable .



To me, his terrain looks exactly like it would if you smoothed the blocks to their neighbor. I will try something similar in Mythruna at some point.

1 Like

Hmmm yeah. It is a smoothness. It’s like when you use the smoothness in blender :).

1 Like

The main way that voxel terrain is optimal over simple cube terrain is that it uses oct-trees. They’re like quads, but octs. When a number of cubes are adjacent to each other, the system replaces them both with 1 box with the dimensions of both put together and textures them as normen described.

Watch where the vertices are as he adds and removes boxes at the beginning of this vid:

http://youtu.be/7bQXz80gIbU

Okej, now I fixed that problem, so now they all are in correct position.

One problem still remains tho, I get these springs between the faces:

http://i42.tinypic.com/k0zkw.png

Would this be solved if I used the same verts to create neighboring face?

Now I have so that a face has 4 verts. There will always be faces that have verts in the exact same position, but instead of using those I have, I create new ones.

Would this problem be gone if I reused already exsisting verts?



About voxel:

How would the texturing be done?

If I have 4 faces that voxels into one face, then that face needs to have the 4 textures on it still…

Problem here is that the textures are all in one texture called full.png. It contains grass, dirt, and grassdirt :stuck_out_tongue:

Would I have to separate all textures into separate images if I were to go with this solution?

Don’t worry about oct-trees… you can get very far without worrying about that. Besides, the larger cubes have to be split aligned for it to really work so well.



Regarding your texture bleeding, it’s probably because you have the textures setup to repeat in both directions so when the texture coordinate is close to the edge it picks up a little from the bottom of the texture. For my grass block sides, I only repeat horizontally.



…though, are you using a texture atlas? Because I see a little green on the corner of one block.



If you are using a texture atlas then you will need to have gaps between the textures.

1 Like

Yes I used textureatlas, thought it would be best, as when I optimize jme collects all faces with same texture in one mesh, so if I use one texture/atlas then I get one mesh.

But what your saying is that the “bleeding”, as it’s apparently called, is because the texture gets a bit from the image off the edge of the assigned area of the texture?`

Would it be better then to use separate images as textures?

It is easier to use separate textures. Only time will tell if it is “better”. I use separate textures but will offer a texture atlas option at some point.



But when you use a texture atlas you need to leave a buffer space between the images… usually filled with the edge of the texture. Though for repeating textures I think it’s better to fill the buffer area with the repeating edge (ie: a little of the opposite side).



If that sounds complicated… use separate textures for now. Mythruna still uses separate ones.

1 Like

And note… the size of this buffer space will depend on whether you have mipmapping enabled and to what level. If you turn off mipmapping (so that your textures don’t nicely blur farther away) then you can probably get away with one pixel borders (two pixel gaps) between textures.



But I haven’t tried it.

1 Like

Thanks alot! Not using textureatlas completly removes the bleeding problem! :slight_smile:

If I may ask, what method do you use to drawing your cube looking world?

Do you draw a face by creating 4 new vertices for each face or do you combine the connections between them?

4 new vertexes for each face. They generally have their own texture coordinate and normal so they cannot be shared with other faces in the cube or their neighbors.



And I don’t use the batch utilities, as I build up the meshes myself from parts. But it’s essentially doing what the geom bath utility is doing except my parts are more efficient data structures than full up Geometry+Mesh would be.

2 Likes

Hum… Your saying you have models from like blender or maya that have diffrent forms like cubes and cones etc?

Would’nt that need more “fixing” to make the sides that is inside the mesh disappear?

1 Like

No.



I build up my parts as arrays of vertexes and then merge them all together to turn into a batched Mesh.

1 Like

That’s what I was thinking of too.

Instead of doing:

(4 verts for each face) * (6 faces on one alone cube) = 24 verts for one cube

I simply have them all in an array and reuse the verts that already has been made.

So then I only need 8 verts for one cube.

This would be more sufficient and this is how you do it right?

You cannot reuse the vertexes.



To reuse a vertex they must have the same texture coordinate, normal, etc… you can’t reuse them.



What I meant was that I have just an array of 4 verts, 4 texture coordinates, etc. per “shape” and then I merge these all into larger arrays when I create the mesh. That way I avoid creating Geometry and Mesh objects just to throw them away in a batching process. Saves time and memory but the end result is the same.

1 Like

Ahh okaj!

Will probebly optimize like that later :slight_smile:

Thanks for explaining :smiley:

Heres first screenshot of creating terrain using heightmap:

http://i41.tinypic.com/27ywd2.png

For some reason it will loop 15 times extra for each pixels, so I had to go with a very simple heightmap as seen in the bottom right corner.

Let me know what you think :smiley:

1 Like

Cool . And for a large world? What will be the image size? Each block is a pixel?

The heightmaps would represent the highest top of an area. Each heightmap can represent one big island or many small islands.

So if theres 2 big islands appart from eachother then I will use 2 heightmaps to make that happen. Just to avoid having a huge grid with huge not used spaces.

Soon I can show how this heightmap can create an island that looks realistic, just gotta fix the error with unnessecary ekvations and stuff :d

castle story looks awesome… thanks for bringing it to my attention xD :slight_smile:

though i would recomend waiting for the game to come to alpha instead of trying to make it cuz you cant wait for it xD lol… think of it as improving your patience skills :slight_smile:

it’s a good programming exercise though…

(this game takes me to dark, long forgotten, cravings for long hours uppon a screen, playing a game, trying to make the best insert game theme here posible… ah… it sure brings back fond memories… and great music themes xD) (but those days are gone… so nostalgic… this mood swings are killing me xD)