foxostro / GutsyStorm

Game with voxel graphics similar to Minecraft. (Restart GutsyStorm with Objective-C/Cocoa)
Other
12 stars 4 forks source link

Smooth terrain #77

Closed foxostro closed 11 years ago

foxostro commented 11 years ago

Instead of making a game engine with terrain that looks like Minecraft, the terrain generator should add ramps to natural to make smooth terrain. That is, generate an array of Boolean values for solid/empty as usual, and then make a pass across this array to add ramps to empty blocks that sit on top of solid blocks. The choice of ramp is made by examining the neighboring blocks in the cardinal directions north, south, east, west. Another pass may be made to smooth out the underside of overhangs.

The process of adding ramps only occurs during the generation of natural, I modified terrain. When the user edits terrain, ramps are not added or updated.

Light propagation across ramp blocks will require some careful thought. A good first pass is to treat all ramp blocks as being transparent to light.

The mesh generation algorithm will need modifications to deal with ramp blocks too.

foxostro commented 11 years ago

I pushed my work-in-progress ramp code to a new branch "ramps." This includes some screen shots.

Major bugs include a) ramps are not lit correctly, b) ramps look weird without inside and outside corner pieces, c) grass-dirt transition textures are weird. So, I honestly might abandon ramps and work on other pieces of the game such as trees and grass.

foxostro commented 11 years ago

Ramps are now properly lit as of d2cc188f88e5c01880a7e08d9f0233637429fca1. The changes made to the lighting engine for this also simplify it quite a bit.

Next: inside and outside corner pieces, inverted ramps/corners, and culling hidden faces during geometry generation.

foxostro commented 11 years ago

Ramps are basically done as of 03ee28e03da437808239622e5f65b3335a6ec775. There are a few couple of glitches which can be fixed later:

  1. Post processing doesn't quite work correctly at chunk edges.
  2. Sometimes a cube gets a SIDE texture when it really shouldn't. Fixing this would probably require taking the orientation of adjacent cubes into account. So, I'm okay with just not fixing it.