Voxel Craft

Community Forums/Showcase/Voxel Craft

grindalf(Posted 2015) [#1]
No Im not actually going to call it that :P


just the one screenshot at the moment due to the fact that everything looks the same anyway lol.



All the textures are procedurally generated as is the terrain. I want all characters and enemies to be procedurally generated as well
World size at the moment is 50x50 chunks. Each chunk is 32x64x32(the world is not as deep as minecraft)


I actually want the game to play more like cubeworld than minecraft when finished but at the moment its more like the creative mode of minecraft(except empty and devoid of everything). At the moment you can place brick blocks and delete any blocks.


This is actually a reboot of my old project The Grimoire of worlds.
All code for that was lost when I was moving to Scotland and I had a little accident and lost my laptop and external drive all in the same day.

I always felt voxels would make the game better but could never get them working.


AdamStrange(Posted 2015) [#2]
so, are you using a voxel system, or one based on models?

Where in Scotland did you move to?


grindalf(Posted 2015) [#3]
To be honest I'm not sure if it's voxels or not. Everyone seems to argue over what voxels are. If they use polygons or not.
The only real description I can find of them is the way data is stored and as far as I can tell I am using voxels. But it is a 3D model with polygons. I read my level data and build the chunk according to the data if I delete or place a block I change that voxels data in the array and delete the chunk then rebuild it with the new data.

I moved to Dumfries it's been nice here so far but I'm struggling looking for work.


JBR(Posted 2015) [#4]
Adam, you from Scotland too? I live in Troon, Stevie G is in Glasgow.


AdamStrange(Posted 2015) [#5]
i'm Edinburgh

@Grindalf
So the shadows are cast or just based on the models around them?


grindalf(Posted 2015) [#6]
yes shadows are based on the information of the grid around them.


AdamStrange(Posted 2015) [#7]
last question ;) is this max or b3d?


grindalf(Posted 2015) [#8]
It's b3d. I was thinking of changing to max but we shall see.
I'm not sure if max will give me any advantages over b3d. At the moment my main concern is reducing the pause when a chunk loads


col(Posted 2015) [#9]

I'm not sure if max will give me any advantages over b3d. At the moment my main concern is reducing the pause when a chunk loads



'Max gives you threads to eliminate the pause :-)


grindalf(Posted 2015) [#10]
Well that's some awesome news :D
will it be easy to convert my code across to max?
I heard max doesn't have type lists but Im not using them is there anything else I need to be wary of(I can afford it yet as Im jobless so I will have to wait and carry on as I am for now)


angros47(Posted 2015) [#11]
If you'll use max with OpenB3D, you will have both octrees (to manage the scene) and CSG (to build a mesh by adding/removing cubes); maybe it will make your task easier.


AdamStrange(Posted 2015) [#12]
what is CSG?


feeble1(Posted 2015) [#13]
Constructive Solid Geometry, its like sticking a bunch of boxes together to make a pile of boxes!


col(Posted 2015) [#14]

will it be easy to convert my code across to max?


Thats a relative question depending on your programming experience and your code, but off the cuff I'd say as 'Max is capable of doing more than B3D, then yes.


I heard max doesn't have type lists


In Max theres nothing stopping you create you own, or you can use casting with the default lists.


AdamStrange(Posted 2015) [#15]
Are there and CSG tutorials or help files in Max? (The help isn't very helpful if you don't know about stuff). I've been with Max for 2-3 years and have no knowledge of maps or banks or lists - I just created my own ;/

So does Max also have oct-trees built in? Again help, tutorial demo?


Brucey(Posted 2015) [#16]
BlitzMax doesn't have very much built in. It's just a programming language with a couple of graphics drawing helper modules.


grindalf(Posted 2015) [#17]
Well once I find some work I will get max for sure. Ive been considering it for some time but threads are a big incentive.

I now have trees and grass working



grindalf(Posted 2015) [#18]
Ive changed to a flat shaded look as it means Im using vertex colors instead of textures so it cuts my surfaces down from to 1 lol



I think it looks a little confusing as a screen shot but it looks ok while playing it


AdamStrange(Posted 2015) [#19]
mmm, love the flat shaded look, but i think i'm a little biased there - lol

ok, here's a suggestion/thought. Your shadows are very hard (as seen under the trees) - do a sort of fade? so the shadows get progressively darker.

I suppose in practice it would be something like:
- each voxel has a shadow number of 1
- for each voxels check 1 height above and around (check 8 voxels).
- - if a voxel is present add the checked shadow number to the current voxel shadow number
- - if a voxel is 1 (no shadow added)
- each voxel should now have a shadow value starting from 1 = no shadow and going up (darker)

or something along those lines :)

But it looks great :)


markcw(Posted 2015) [#20]
Are there and CSG tutorials or help files in Max? (The help isn't very helpful if you don't know about stuff). I've been with Max for 2-3 years and have no knowledge of maps or banks or lists - I just created my own ;/

I think Openb3d is the only bmax engine to actually implement CSG. There are a few examples/help on this in the forums for b3d and bmax. I have just added an example to my wrapper here and a line in the docs. I will try to get an octree example next.

If you browse the online manual 2d category here you will see I have added full code/comments for banks, lists and maps.


grindalf(Posted 2015) [#21]
@AdamStrange

Yeah Im doing something a little like that but only directly up and only for 7 voxels of distance.
I will do a bit more work on that at some point or other and try and make it a bit softer. Thanks for the feedback.

I have ramps back in at the moment(only 45 degree angles) I will be adding ramps on the underside as well soon(hopefully today) Hopefully that will make the trees look a little more rounded and the terrain a little more natural


Naughty Alien(Posted 2015) [#22]
@munch
Very nice...what are the OpenB3d features? Vfx, shadows, etc??


angros47(Posted 2015) [#23]
OpenB3D includes all default MiniB3D features, plus:

- quaternion-based rotations like in oiginal Blitz3D (no more gimbal lock)
- lod terrains (even spherical terrains, a.k.a. geospheres, are possible)
- shadow system
- octrees
- GLSL shaders support
-Constructive Solid Geometric
- Metaballs and isosurfaces

and more. Also, it's written in C++ (it was originally a port of iMiniB3D, a version of MiniB3D for iphone), so it can be used in any programming language that can link to external libraries, not just BlitzMax.


Naughty Alien(Posted 2015) [#24]
..interesting..havent seen this yet..web site link?


angros47(Posted 2015) [#25]
Official site is:

http://sourceforge.net/projects/minib3d/

http://sourceforge.net/projects/minib3d/files/


Have a look at these threads, too:

http://www.blitzbasic.com/Community/posts.php?topic=102556

http://www.blitzbasic.com/Community/posts.php?topic=103682


markcw(Posted 2015) [#26]
Well, thanks to Angelo's great work Openb3d is now a full-featured version of Minib3d but it still has some things missing; physics and many shader effects.

I am working on a new version of the wrapper which gets the pointers to the c++ data members and wraps all functions in methods so the syntax will be identical to minib3d. Then things like the newton physics code could be included easily. I am also hoping to adding more shaders.

Blabz has a great version Minib3dplus, which has a lot of the things Openb3d lacks. Particles, shaders, etc but no examples to get you started. It extends minib3d so it could be combined with Warner's modified minib3d (which adds quaternions and terrains see here, note this is not Warner engine) to get almost everything.

The newton physics wrapper can also be plugged in easily. There are a few versions around, one is from minib3dext (I can't find a download) and there's a version from Itmbin here.


angros47(Posted 2015) [#27]
Warner's version of MiniB3D is outdated; anyway, I used it as a base to modify iMiniB3D into OpenB3D, so all its features (3ds loader, terrains, and quaternions) are included in OpenB3D, too.

Since there are many physics engine (ODE, Newton...) I think that they should be linked in the wrapper, not in OpenB3D itself (otherwise we would have an unnecessary dependence).

About other features... they could make a nice addition to OpenB3D (Bloom, HDR...)


markcw(Posted 2015) [#28]
@grindalf: Sorry to derail your thread btw. I like the scene much better with textures and would prefer a smaller voxel size, they look too blocky.

@Angelo: Not sure what you mean by "outdated" is it slow? Or do you mean it lacks new features?

I agree to keep the physics engine as a separate module/library is best since many people won't want this.

Re: shaders, I'm not sure how you should manage that. Maybe a separate download of examples (and especially shaders) for Freebasic, then other languages just have to translate that?


angros47(Posted 2015) [#29]
Warner version has not been updated in the last 6 years: terrains LOD had no support for triangles in view, and created a lot of problem with collision management. Quaternions, too, have some bugs (I know because I had to fix them).

Warner never fixed that issues, because he started working on a new engine (warner engine) which was intended to replace minib3d (so he had no need to continue developing his version of minib3d).

About shaders: at the moment you can load an external file, or you can embed the shader in your code in a string.


markcw(Posted 2015) [#30]
Angros, what about Warner engine? It seems Warner rewrote terrains, maybe he fixed the quaternion bugs too, did you look at those? If so it would be simple to "update" Warner's modified minib3d.


angros47(Posted 2015) [#31]
Last update of the Warner Engine is of 2011, as far as I know. It still uses glBegin....glEnd in terrains, and the algorithm used has the same problem of the MiniB3D version: no check of the viewport, and collisions that depends on camera position.


grindalf(Posted 2015) [#32]
@Munch no problem its all relevant information ;)
I cant really change the voxel size as that would make loading times even worse.
As for textures vs flat shaded I think I agree but the flat shaded does have its charm and it allows me to have a near infinite amount of blocks as I don't have to have a different surface for each texture. I just color the vertices instead.





Ive been working on the shadows a bit more and now they are working better(they still look a little dark at the moment)
Ive got all my slopes back in(I had to remove them while changing to flatshaded)and Ive got other biomes working(no blend between them yet. just a straight flat line :P )


OldNESJunkie(Posted 2015) [#33]
This reminds me of both Minecraft and Cube World. Looks good.


markcw(Posted 2015) [#34]
I agree, flat-shaded looks okay and saves loads of memory. Maybe the trunks should have a little texture. Are you sure you can't scale the voxels half that size? Btw, I'm not a Minecraft fan. :)


grindalf(Posted 2015) [#35]
I could scale them half the size but the program would be to slow for my laptop(my laptop is a bit crap)


markcw(Posted 2015) [#36]
I have a crap laptop too! :)

Your last scene pic gave me an idea. It might be good to load objects 'on the fly' and unload them when they are past a bit of distance. So you would see far objects disappear a lot but I think that would be a nice feature be more original?

Hmm, but maybe not...


grindalf(Posted 2015) [#37]
That's what I do with chunks.
All blocks are part of the same chunk model(32x64x32 voxels). when I delete or add a voxel it deletes the entire chunk and then rebuilds it with the new information. I actually only build the faces of the cube that are needed. for every voxel I read the voxels on either side and then only build a face if there is no voxel. All faces are part of the same surface and mesh.
All the trees and leaf cubes are the same. They are the same model as the ground beneath them and I delete the whole chunk when it goes out of range.
I have the draw distance as a variable so it can be changed depending on how powerful your computer is. I have it set to 3 normally which gives me a distance of 96 voxels(more or less) the max I can set it to is 6(192 voxels) after that it doesn't always load on my computer.


Flanker512(Posted 2015) [#38]
I tried terrain generation using 3D noise with Blitz3D, building only necessary triangles and sometimes, 32*32*32 voxels chunk surface could have more vertices than the Blitz3D limit (30000 safe according to the forum). But you use some kind of marching cube so you probably have less triangles. Two screenies :






RemiD(Posted 2015) [#39]
@Flanker512>>To be safe, you want to use less than 32000 (less than 32768-?) vertices or triangles per surface because if you decide to use more it can cause a MAV at renderworld with some graphics cards...


Flanker512(Posted 2015) [#40]
@RemiD in some posts, thrusted guys recommand 30000 to be safe. it's probably linked with 32768 but it seems quite random... also you say it's related to graphics card ? mine is an HD 7950, quite a good one, I don't think it would be overhelmed by 32768 vertices on the same surface. it might be a Blitz3D or DirectX7.1 limit.

Anyway grindalf seems to have a robust engine. the lighting on the trees in the last screen is very nice.


RemiD(Posted 2015) [#41]

it might be a Blitz3D or DirectX7.1 limit.


From what i remember (i have done some tests in the pasts on several computers), no, because on some computers you can go up to around 65000 (less than 65536) and on some computers you can go up to around 32000 (less than 32768).
See : http://www.blitzbasic.com/Community/posts.php?topic=101823

Maybe the around 32000 vertices/triangles per surface is only on some too old or too low end computers, i am not sure, so you may want to not consider this and go up to 65000 vertices/triangles per surface... The best way to know is to test on several target computers...


RemiD(Posted 2015) [#42]
Simple code to test the limit of vertices / triangles per surface on your computer :


You want to see something weird :

This makes no sense :P (unless there is an error in my code ?)


RemiD(Posted 2015) [#43]
mav on 2 others computers with the exact same number of vertices and triangles in the surface...

@grindalf>>sorry for the hijack, but you may be interested in this too...


angros47(Posted 2015) [#44]
But you use some kind of marching cube so you probably have less triangles.


Marching cubes are used to produce smooth surfaces from voxel data, not cubic-like environments.


Flanker512(Posted 2015) [#45]
@angros47 grindalf uses "some kind" of marching cube as he isn't using only cubes, basically it's the same idea.

@RemiD same result here but it's linked to the surface construction. test this and you'll get a different count :




markcw(Posted 2015) [#46]
@RemiD in some posts, thrusted guys recommand 30000 to be safe. it's probably linked with 32768 but it seems quite random

32768 is the maximum value a 16-bit signed integer can have.

Very impressive terrain generation btw!


RemiD(Posted 2015) [#47]
@Flanker512>>Ok so it seems that there can be up to around 65000 vertices or triangles per surface (less than 65536-?), but what is weird is why there is a mav before there are around 65000 vertices in the surface (in my code example)...
I don't understand the logic behind this...


grindalf(Posted 2015) [#48]
@Flanker512 those terrains are beautiful. And I wouldnt call it marching cubes but it does help to make it feel less like minecraft. I only have 45 degree slopes and the needed corners. I want to apply them to the trees as well so they look a little more rounded.
@RemiD no problems on the Hijack. its all relevant.

I can't test out either of your code as Im at the library(I have no internet at home at the moment)