Brick grids and simplex noise - Minecraft-style voxels

I made a plugin that adds a component type that is rendered as a grid of bricks. It isn’t shippable, but I think it’s a good example of extending the rendering engine in a plugin.

Screenshot.jpg

The BrickGridComponent doesn’t do much on its own, so I included the BrickGame Blueprint I use to generate a procedural terrain. You’d probably want to use C++ for a real game, but I wanted to make sure everything was all accessible to Blueprint.

The Blueprint uses a simplex noise function implemented in a C++ plugin. The simplex noise functions should be accessible from C++ code as well as BluePrint, though I’ve only tested BluePrint. 1D, 2D, and 3D noise is supported, although the terrain generation only uses 2D and 3D.

I ran into problems with the runaway loop detector killing my terrain generation blueprint, so I added another plugin that lets you reset the runaway loop counter from Blueprint. Resetting the counter makes your Blueprint vulnerable to infinite loops that will freeze the editor, so make sure your Blueprint will terminate before using it.

The bricks aren’t interactive yet; the BrickGridComponent recreates its entire collision/rendering state if only a single brick changes, which is pretty slow. If I have time, I’ll make it do incremental updates.

I’m making the source code for the plugins and “game” available on GitHub under a BSD license. Enjoy!

I’ve made a lot of progress on this since my first post, so I’ve released a build to the GitHub repo: Release v0.5 · AndrewScheidecker/BrickGame · GitHub

It will now dynamically generate new terrain as you run around, you can place and remove bricks of various materials.

I’m working on improving the terrain generation now (making it generate grassy areas, non-mountainous areas, better caves, etc). I’m also hoping to add a CPU-side ambient occlusion system similar to the Minecraft lighting system so that the caves won’t receive ambient lighting.

F6/F7 will save/load the world, and it will load the saved world automatically when you run the game.

Just based on your description/screenshots: this looks awesome. I’ve been struggling to figure out how to get the Unreal Engine to work with highly dynamic environments, and this is the best example I’ve seen thus far. I’ll need to find time to experiment with this (maybe tonight or tomorrow), but thank you very much for showing it can be done/sharing your work. I’ll share my thoughts after I’ve had a chance to examine it in depth.

This is crazy awesome, Andrew. :slight_smile: Just … YES.

That looks really cool. Keep up the good work;)

I posted a v0.6 build: Release v0.6 · AndrewScheidecker/BrickGame · GitHub

I also spent way too much time building stuff, and made a video: BrickGame v0.6 - YouTube

Whoa! I rate your project Badassitude!! I’d like to build my own block Building game, but I am only level designer, not a Programmer. So I don’t know how to even begin to make something this awesome.

Newbie FYI: I’m not sure how you’re “supposed” to do this, but if you’re like me and trying to play around with this project and are getting a bunch of errors, here’s what you do. This works for me with UE4.1 and BrickGame Release-0.8.
1.) Right click on “BrickGame.uproject” and select “Generate Visual Studio Files”.
2.) Open up “BrickGame.sln” and compile the solution (press f7).
3.) You should now be able to just open BrickGame.uproject directly.

I’m sure this is pretty obvious if you know what you’re doing, but the errors Unreal Editor throws are a little vague. It tells you “The game module ‘BrickGame’ could not be found. Please ensure that this module exists and that it is compiled.” It’d be nice if it could detect and tell you that you don’t have a solution file and/or haven’t build your solution, and give a little direction on how to fix that. I’m not sure this was possible to do with out building UE4 from source before, but the 4.1 update seems to have added those right-click menu options to the prebuilt.