Download here, if you want to play around with it. However, I can’t guarantee it will work with your machine cause the only ones I’ve tested it on is my desktop and my laptop. And both are pretty beefy machines. So, good luck.
I had to demo my progress to my professor this week so I worked on it a lot. Some changes I made are:
“Infinite” terrain. The world is now made of chunks of voxels. I add and remove chunks from a chunk buffer so that only chunks around the player are actually loaded and drawn. The generating is done asynchronously so it doesn’t kill the framerate.
Caves, overhangs, and tunnels. I took some pointers from notch’s post about terrain generation and so now terrain is now generated through a density map. I fill the 3D density map by sampling 3d Perlin noise, augmented by turbulence, at specific intervals. Then I just use trilinear interpolation to fill in the missing details. The resulting density map is then cut to form tunnels using another rigid multi fractal noise generator.
Basic materials (grass, dirt, sand, stone, water). These are determined using the density map described above and depth information. Densities less than 0 are air blocks. Other types of blocks are determined by a combination of depth and density. I’m still not happy with this because, as you can see from the video, areas under certain overhangs leave a silhouette of stone.
Much better performance (200 fps vs 19 fps). This is mainly thanks to face culling and only drawing faces that are touching air blocks. Right now I’m using display lists. I tried using VBOs but I’m still kind of confused on how to actually use it correctly. There is a bunch of conflicting information about deprecated functions and stuff. But I’m pretty happy with display lists so far.
For the future: textures, better and less weird terrain, skybox, better lighting, trees?, and flowing water?
So I just started working on this procedurally generated voxel/boxel terrain thing for my computer graphics final project. The above screen shot is what it looks like after a couple hours of work. That’s a 200×200 grid. And yes, sadly, that is 19 frames per second.
Right now, I’m just generating the terrain using 2D Perlin noise stored in a heightmap. Using a heightmap isn’t really ideal since I can’t really use it to store caves or overhangs. Eventually I’m going to update that to an octtree and use some combination of 3D Perlin noise stuff for generating the map.
For drawing, I just draw every single block which pretty much explains the 19 FPS. I have some ideas for optimizing it, such as only drawing blocks that are inside the view frustum and only drawing faces that are touching empty blocks, but I haven’t gotten around to doing that. My OpenGL skills aren’t there yet.
Here is an unfinished mockup of a game I started making. The concept was pretty much tetris but you don’t control the tetrominoes directly. You control a little construction robot worker that can catch, carry, and throw them. There would be a evil dude in the crane that would be dropping pieces to mess you up.
I started working on the game a few week ago. Currently, the player can run around, jump, pick up pieces, and throw pieces. It’s not really in a playable state and I don’t think I’m going to continue working on it. After implementing those basic player mechanics, I realized it wasn’t that much fun. So I’m scraping it.
For me, the actual purpose of the project was to learn how to implement and use a entity-component system. It’s a system where game entities are made up of different components (health, position, spatial) rather than being subclasses of a parent entity. I got that part of the game working so I guess it was worth working on.
Maybe I’ll pick this up again at a later time. Probably not.
So I had an interview for an job yesterday. In fact, it was my first job interview. It went okay.
One of the technical questions the interviewer asked was to create a data structure that would insert in O(log n) and return an iterator that would iterate the data back in sorted order in O(n) time. I knew it was a binary tree and the iterator would use an inorder traversal of the tree so I started typing it out.
But when I got to the iterator part, I just couldn’t figure it out. I knew for sure it was an inorder traversal but I couldn’t figure out how to turn the recursive algorithm that I knew into an iterative one. So I sat there and drew some trees to try and visualize the algorithm for it. I thought using a stack for the traversal would also probably work but I couldn’t figure that out either. And then time was up.
So we continued the interview. I asked some questions about the position. Then the interview ended.
I hung around for a little bit with a friend that worked there and referred me for the job then we biked back to our dorms. As soon as I got back I opened up Visual Studio and worked on the problem again because I knew that if I didn’t I’d probably end up staying up all night thinking about it.