• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
  • entries
    432
  • comments
    1166
  • views
    759140

Procedural Mountains and Slacking Off

Sign in to follow this  
Followers 0
JTippetts

2904 views

ApochPiQ's Dude, Just Chill Out entry made me feel bad and dirty. I've been neglecting GC lately, and I've been neglecting this blog as well.

Since the last time I updated about GC, I have gotten quite a bit done. However, so much of it has just been bookkeeping, general clean-up, some refactoring, and so forth. I fixed some bugs in the general framework, tidied up some use cases, etc... For now, I haven't done anything further with the YAML-based variant of the framework, and am continuing to work in Lua. I just... I like Lua. It feels right to me, after so many years of working with it. C++ just feels so cold and unyielding, and I don't really like working with it much anymore, except for those times that I have to.

I've got a sort of TODO list of things I want to blog about (it's pretty long), and hopefully I'll get to them in the near future. Time. Man, there just isn't enough of it. With one kid at 10 months and another one on the way, set to arrive in July, plus work and wife and winter, there just isn't any time.

Anyway, in order that this update not be empty and completely useless, I'll just talk about mountains. I've started out writing numerous posts about procedural generation and how it has benefitted me in building GC, but each time the post starts to balloon into this gigantic thing. Procedural generation is awesome, but it's a big topic as well. So I'll just talk about mountains instead.

Cellular noise. I'm sure that almost everyone has heard of it or seen it. It's an old stand-by in the procedural world. In some places, it might be called Worley noise or Voronoi noise. Cellular noise is built by seeding the coordinate space with a scattering of randomized points, then for each location in the space you determine the nearest seed point. Variants of cellular noise might assign a certain value to all points that "belong" to a given seed point, or might calculate the distance to the nearest seed point, or the distance to the nearest N seed points, and use these values in various forms.

Of particular interest to me in mountain-making is the variant of cellular noise that is often labeled as F2-F1. In this case, F1 and F2 are the distances to the nearest and second nearest seed points. By subtracting the first nearest distance from the second nearest distance, you end up with a rather remarkable pattern:

wuze85y.png

Looks like mountains to me. A little too smooth, perhaps, a bit too crystalline, but that is easily remedied with just a little bit of fractal fBm distortion applied in the X and Y axes:

BFk9WAC.png

There we go. However, that is mountains (plural) and I basically want just mountain (singular). Or, at least, I need an isolated chunk of mountain, and not the whole mountain range. So I bring in my old amigo, FuzzyDisk. FuzzyDisk is a cross section of a sphere in which values start at 1 at the center and fade out to 0 at radius. I can bias the output of fuzzy disk a little bit to tighten up the transition, and obtain a mask that looks something like this:

MJdqhh4.png

A simple multiplication operation later, and I have isolated my mountain piece:

eLmmuVg.png

Now the fun begins. I have set up in my project's workspace folder a .blend file for Blender. It includes the standard Goblinson Crusoe light setup, and some tri-planar materials for various rocks, dirts, cliffs, etc... One of these materials looks something like this:

OgGkqWM.png

Looks a little ugly, but essentially what it does is this:

1) Tri-planar map a stone material to the bulk of the mountain.
2) Mix the stone material with a white snow material based on
a) Elevation
b) dot-product of the surface normal with the vertical axis
3) Mix the stone/snow mix with a greenish material at the base of the mountain, again based on a) and b) above
4) Mix between the final color and black based on elevation to "snip" out the lowest portions of the mesh, isolating the mountain pieces
5) Mix between white and black using the same elevation factor as (4), and use the result as the alpha channel.

This material is applied to the mesh, which is constructed by subdividing a plane and applying the mountain heightmap as a displacement modifier, and tweaking the scale of the displacement to suit:

Ts0oJ6a.png

Then, the thing is rendered. The result will be a mountain sprite that can be imported into GC. The sprite is anti-aliased, and smoothly blended at the base to blend well with the ground terrain. Here is a mountain sprite:

O6RK2d4.png

I'll do a bunch of variants, pack them into a material and import them into the game. Here is what they look like in game:

HJdkfLs.jpg

Simple as pie. The process isn't fully automated (I do still have to import the heightmap into Blender and hit render) but it is very fast. I can generate numerous variants by re-seeding the cellular generator, and by tweaking the material and textures I can create variants for different types of mountains. It's quick and easy, and it certainly results in better mountains than I would ever be able (or willing) to create by hand like a real artist would.

There. Now I don't feel bad for having posted another worthless post. This was only partially worthless. Conscience soothed, back to slacking off.

9
Sign in to follow this  
Followers 0


6 Comments


Yes very cool stuff, keep it coming even if it seems easy, may not be for others! :)

1

Share this comment


Link to comment

Nice stuff :D

 

( It's almost enough to make me want to work on my own stuff at the weekends.... almost... *looks at DmC*.. but not quite ;) )

1

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now