WIP: Week 2 -- Meshing, Shapes, and Worlds!

Published December 27, 2014
Advertisement
This past week has been quite productive for the engine! I updated my RenderingEngine to support rendering buckets, which is basically a set of efficient priority queues to sort meshes every frame. I also started working on frustum culling, to help cull meshes using their bounds from going through the rendering pipeline. Currently the supported bounds are AABBs and spheres, but I hope to also add OBBs as a "originally" supported bounds. Anything else shouldn't apply to a basic voxel engine yet, anyways!

I then started working on meshing chunks for the engine. Though I've done this already on my Java version of the game, I needed to change some things in order to *mesh* well with my engine (pardon the pun). With that in mind, I rewrote my greedy mesher to be not only modular, but more efficient and data-driven. It seamlessly molded into the voxel corner of the engine, and I now can mesh chunks efficiently, with AO, as can be seen here:
Screen Shot 2014-12-27 at 12.10.56 PM.pngScreen Shot 2014-12-27 at 12.11.36 PM.png
Not only that, but I began creating methods that create circles, spheres, boxes, and other simple shapes in order to make modeling easier. Yay!

Next I wanted to tackle what puts me off these types of projects all the time: world management. For some reason, I can logically break apart that topic into a large group of manageable tasks, but I've never managed to do more than meshing management. Now that I have an engine structure I'm happy with and I've got a momentum carrying me along, I hope I can accomplish just that!

I haven't done much yet, so there's nothing to show, but the general layout of a world's "tick" looks a little like this:

[code=:0]//...In VoxelWorld.cppvoid tick(float dt) { // Update Chunk Management Logic // --> Chunks can move between different states: // a. Loading (Fire event with chunk pointer, // wait until loaded ) // b. Setup (generate, decorate, mesh, etc) // c. Physics/Water/Player/LOD/etc updates // d. Unloading (Fire event with chunk pointer, // wait until unloaded ) _chunkStateManager.updateChunkStates(dt, this); // Update visibility // --> Read front to back for solid rendering, // read back to front for transparent rendering :) // _chunkSorter is a modified std::priority_queue // (underlying vector for iterating ease). _chunkSorter.update(_camera.getPosition()); // Update player inputs and movement. _player.update(dt);}//...
Whoo!! The nice thing about this is all cross-thread communication is done through the EventManager, and each event is fired asynchronously, making everything easy on the developer. Having [font='courier new']_chunkStateManager[/font] be an object has allowed me to try different options for state management, like dumb systems that are step-based (run 'x' amount of chunk updates per frame), as well as smart systems that are AI based (extend chunk updates in a smart fashion that allows for more realistic results that should take into account how it's taxing the computer). All of this together creates a flexible system that I can use with ease.

This next week, I'll be continuing with the World Management in the game, and will focus on possibly scripting events following that. I also want to start thinking about

vegetation

decorations and weather effects, in order to bring the world alive.



Until Next Time,


ST

2 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement