A quick little WebGL minecraft(-esque?) 3D voxel land generation demo I made. All JavaScript. Something I hope to bring open source some day. Possibly a fun WebGL Minecraft client.

YouTube Preview Image

There seems to be nowhere on the internet that has code for a random number generator for JavaScript that does normal (Gaussian) distribution of values. You may remember this distribution as the ‘bell curve’ from school. This is really cool for picking random numbers that don’t distribute linearly. Using the Box-Muller transform seems to be the best way to do this in the real world, so I wrote a little function that will do it for you in JavaScript ;) Enjoy!

Math.nrand = function() {
	var x1, x2, rad;
 
	do {
		x1 = 2 * this.random() - 1;
		x2 = 2 * this.random() - 1;
		rad = x1 * x1 + x2 * x2;
	} while(rad >= 1 || rad == 0);
 
	var c = this.sqrt(-2 * Math.log(rad) / rad);
 
	return x1 * c;
};

Wowee…. it has really been a long time since I’ve had the time to post on here. For the last year I have been on my search for the perfect design and architecture for the perfect distributed social MMO game server to host our amazing work at Toy Studio. This chase has led me to many exciting no technologies, especially all the NoSQL options and document -based data stores. One of the coolest is CouchDB. I’ve had my ups and downs with this software, but I’ve also seen it mature very well and start showing the signs of a truly remarkable DB, especially with the CouchBase merger that has just happened.

One of the best parts about CouchDB in a distributed environment is it’s replication. Holy crap. I’ve never seen such an effective replication system ever! This mechanic allows offline, bullet proof replication. Whether you’re replicating shards in a tightly packed cluster, replicating master/master to a hot spare, or replicating across continents, this is is! The holy grail.

While lots of time was spent making CouchDB a bulletproof data center, it still needs careful design to give you the speed/transactionality you need. But given this option and a thorough understanding of what you are trying to achieve with your application, the options seem endless! Even if you find CouchDB doesn’t give you what you need, it gives you the constructs to expand on it. Whether it be through caching layers with pub/sub, or new indexers, it can do it with careful planning. Generally much easier than you think.

CouchDB