Creating a grid mesh programmatically in Unity 3D

Standard

Accessing strings in c++ from c#

Standard

Scenario; You may have some c++ code you wish to output string data to be used in a c# application.

SQL to JSON with C#

Standard

This seems to work quite well. If there is a more efficient way please let me know.

php mysql database connection

Standard

Connecting to mysql via php.

this is nice to keep in a separate file (inc/conn.php) which can be included into other pages via;

upload via FTP with c#

Standard

Quick and easy way to get files uploaded with c#;

Some old voxel lighting code

Standard

If you look at some of the previous posts you will see this code or a variant of it in use. It may be useful to some. It is very much a hack and i hope to revisit it perhaps in c++ or java.

LWJGL OpenGL VBO Issue on Linux

Standard

I struggled for a while with some code that generates 2 triangles using indices with more modern OpenGL methods. It worked fine when run on my windows boxes but not on my 2011 MBP running linux. There were no errors or anything i could see (i may not have configured the error checking correctly)

The issue was resolved by replacing the video driver. The xorg driver while it did support some OpenGL functions, did not apparently allow VBO. So if you notice issue with VBO/VBA code on linux where it runs fine on windows, try swapping out your graphics card drivers.

Below is the code used for the loader class thanks to ThinMatrix @ youtube who has some excellent tutorials for lwjgl.

Compressing Voxel Data

Standard

My first attempt at saving and loading voxel data seems to work reasonably well. It manages to save approx 4 million voxel points in about 64kb which seems reasonable. The compression ratio would decrease as the usefulness of RLE (Run Length Encoding) wanes due to excessive fragmentation. What remains to be done is to only save those blocks that have changed along with the seed. I’m not building never ending minecraft type worlds so i’m dealing with known quantities here. Currently it just savesĀ and loads everything, surprising quickly.

Lighting Test

Standard

Rewrote ambient occlusion and built a light spreading system.
This is a long way from NVIDIA’s new global illumination/maxwell ‘voxel’ based lighting i read about recently but I’m gradually improving the light system for this unity engine.

I still need to build a more efficient way to update chunks that have had light changed due to light spreading from another chunk.

I use a system of stacks (all chunks on vertical axis) and chunks. When a block is placed or removed the stack should have light recalculated and mesh rebuilt. If light values change in chunks not within this stack, then those chunks should be rebuilt. I’m probably still missing a few things but I’ll keep working on it.

Unity 5 Voxel Engine Update – Photon Multiplayer

Standard

more stuff here. more stuff to do. stuff..n stuff..

1. Implemented multiplayer chat with Photon from exit games. I’m not looking to implement full multiplayer yet but perhaps a town or village where people can meet in between battles. It will be easier to learn Photon this way and also give me a chance to clean up the code a bit.

2. Added a Shakespearean random name generator.

3. Rewrote mesh distortion, vastly simplified version. Still needs some adjustment.

TODO: debug everything, re-write lighting code, add new mobs, npcs