CubeMining A 3D Voxel Template

I love this :heart: Seams like you put a lot of work into it.

4 Likes

Yes. Looks good now.

2 Likes

i moved my mesh generation from lua to a c++ extension.

in the screenshot you can see it from the text in the bottom right. the top image is before and the bottom one is after.

when updating the mesh it used to take around 120 ms on web and about 20 ms on the linux. this caused noticeable stutter.

after moving the mesh generation to c++ it now takes about 0.5 ms on the linux build. the improvement is pretty huge.

i still cannot run the c++ extension on the web build yet but i will figure that out. CubeMining by cenullum

i didnt implemented dmthreads properly so this error is not problem for now but if you know why you can tell

if the performance difference stays this big i will probably move the physics part to c++ too.

4 Likes

For threaded web builds, you need to support CORS from your server.
See e.g. defold/scripts/simple-cors-http-server.py at dev · defold/defold

2 Likes

I moved mesh generation, physics, npcs,ligthing to c++

also moved vertex buffer lighting to light texture

red box is collision shape of player

sneaking is fixed

and I still didnt fixed web version because of my laziness :disguised_face:

you can see walking/sneaking state on blue text at top right corner

10 Likes

Incredible pace, great to see the progress! :heart_eyes:

1 Like

particle in c++ point collision with terrain
footstep sfx

12 Likes

water

10 Likes

very cooooool !

3 Likes

first version of chunk system which is very unoptimized

you can see frustum culling at end of the video

frustum culling does not work without AABB in buffer and how to add to buffer is not in docs

this code is part of my terrain mesh generation. After creating mesh you also need to update AABB.
for runtime AABB update in cpp . g_grid_size is 16 in my game .

      // Add AABB metadata for frustum culling
      float aabb[6] = {-0.5f,
                       -0.5f,
                       -0.5f,
                       (float)g_grid_size - 0.5f,
                       (float)g_grid_size - 0.5f,
                       (float)g_grid_size - 0.5f};
      dmBuffer::SetMetaData(opaque_buffer, dmHashString64("AABB"), aabb, 6,
                            dmBuffer::VALUE_TYPE_FLOAT32);

water

11 Likes

You probably already know this, but a new constant type, CONSTANT_TYPE_TIME, has been added for shaders in 1.12.3 beta. I guess it might help with the water shader timing.

6 Likes

An example utilising this new time constant is also live: Texture scrolling

3 Likes