Recently I began to optimize voxeling’s usage of WebGL buffers. The goal was to get rid of render performance bottlenecks so I could further increase the draw distance. In real life humans can see about 2+ miles away before the curvature of the earth drops things out of view. The game engine was previously only able to draw out to roughly 700 feet before stuttering, but the latest code can draw to about 1500 feet.
Wanted to show off the BDcraft textures I’ve been using.
Jump in and build something! Demo world is here
Cutouts are a way to render objects that are fully transparent in spots, without actually doing alpha-blending or pre-multiplied alpha stuffs. More on those can be found in this article: GPUs prefer premultiplication.
Here’s a great example of cutouts in Minecraft. Notice that the tree is made up of cubes which have a leaf texture applied to them. The texture is transparent within the space surrounding each leaf. No blending occurs; you can simply see through the transparent bits:
When I started working on this project nearly a year ago, the frame rate rarely stayed consistent as the player moved around the world. The engine was simply allocating and discarding too much memory, resulting in frequent pauses in gameplay as the interpreter ran garbage collection. As I re-wrote more and more of the game engine, I came to understand exactly which types of objects and arrays I needed to allocate, where I could cut down on allocations, and where I might use an “object pool” to stash allocated objects for re-use.
I’ve finally rounded out some more features that I felt were necessary for a somewhat-compelling demo.
Open Google Chrome then click here to explore and build: http://voxeling.greaterscope.com
Recent updates include:
Updated character model to more closely match the one from voxel-engine Added skins from voxel-engine and other projects Refactorings and optimizations Simple water animation (of sorts) Made jumping less jarring (implemented the Skyrim float) Pause physics until user clicks the world for the first time.
The voxeling engine now supports textures with transparent cutouts. Thus, leaves!
Will write about what I’ve learned along the way later. Check the voxeling project on github to see what it took, or to play around with it on your own.
Five months ago I started messing around with voxel-engine and it has thoroughly re-kindled my love for measuring and optimizing code. You can see a demo of my project in my previous video post. However, I’ve taken the three.js-based engine as far as it can go. I want to increase the draw distance, want world chunks to load and draw faster, to make changes to the physics engine and reign-in the garbage collection pauses (caused by excessive memory allocation).
Wanted to show some of the new features I’ve added to the voxel game: maps and streamlined mouse/keyboard input handling!
The revamped input handling also includes support for game controllers, but it’s not complete yet, so don’t tell anyone.
The following screenshot shows a lava flow created in-game using lava and obsidian textures. Credit for the textures and lava flow goes to phionabrie.
I finally got voxeling to work from my linode server! And just in time for Tuesday night’s Meetup.
The night summed up in a phrase: “Thanks for digging!”
At one point we had four players simultaneously walking around, creating blocks, digging holes under each other. There remains a glitch where some players were invisible to the others, but other than that, things went quite well. Player position updates and world changes were relayed over the internet without any serious issues … until the node.