Apr
14
2013

Heightmap Chunk

heighmap_chunks_minecraft_style_unity3d

Saw this in the forums (simpleminecraft), sounds interesting!. Havent looked at their sources yet, but made own test version first..

Current version:
– Single chunk..
– Chunk creator (random or perlin)
– 2D array for grid heights
– 3D array for grid cell types
– Using texture atlas (current texture is from some minecraft texture pack..)
– Using grid movement from unifywiki: player can move around, if target pos it not too high (modified the script so that it moves first up or down, if need to)
– Basic camera switch
– Basic Vertex color lightness calculation (if neighbours are higher, make this block darker..)
– Added better controls (w = move forwards, a/d = move sideways, q/e = rotate)
– Added basic laser effect for “cutting” a block in front
– Added basic terrain editing (press space to eat block in front of you, blocks above it will go down instantly..)
– GridMove was too sensitive, modified:

// before
input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
// after
input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

– Added version 3.0 webplayer
– Added health guitexture (hearts, you can see it decrease when player digs ground..just for testing)
– Added some metal textures to player (low res substances from here)
– Added firepower guitexture (mousescroll to adjust it)
– Added basic cannon (rotates slowly towards mouse, taken from deflector proto test)
– Added basic shooting (rigidbody sphere) & missile collision checker
– Adjusted fog color

TODO:
– Better world generation (+biomes..)
– Fix rounding errors.. using Vector3()..values start to get away from exact 0.5 steps.. maybe this: Rounding values to 0.5
– Collisions?
– Animate falling blocks?
– Multiple chunks
– Physics? (no need caves, so if you remove a block, other blocks from top of it should fall down)
– 2D version? (then could use the watersim fluids for it)
– Fake shadows, ao..etc (since we are in fixed grid..could be easier) *Some tools here: VertexAo
– Use 3D A* pathfinder!? (mouseclick target, then player moves there? or for enemies..)
– Add something to collect..coins..
– FPS view? Camera follow?
– 1 chunk is 1 room? (add teleport as a goal >>> moves to next level after tasks are done?)
– Terrain mesh normals, tangents (tangentsSolver)
– Water block?
– Cap grid borders
– Grid visibility ?
– Health (lose health if fall from high)
– Better camera (dont go inside blocks)
– Enemies?
– Building something?
– Toolbar / inventory

Webplayer:
http://unitycoder.com/upload/demos/HeightMapChunkCraft1/ (v3.0 updated: 19.4.2013 )

Download sources:
https://github.com/unitycoder/PlanecraftMeshTerrain

Image#2: Randomized terrain

heighmap_chunks_minecraft_style_unity3d_2(click to view)

Image#3: Vertex colors for darkening.. (using vertex color shader from here)

heighmap_chunks_minecraft_style_vertexcolor_light_unity3d(click to view)

Image#4: Version 3.0

heighmap_chunks_tank_proto_unity3d(click to view)


1 Comment + Add Comment

Leave a comment

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.