Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Devblog #40: Geometry grass, Random island placement

Devblog #40: Geometry grass, Random island placement

Ph4nt0m
Ph4nt0m
Floatlands devblog · · 3 min read
3,060 0
featured_grass_lowpoly_floatlands-1024x5
Geometry grass solution

DOMEN KONESKI

A couple of weeks ago I showed some early samples of rendering grass on the GPU by using geometry shaders. Fresh in-house grass solution allows us faster performance and fuller environment. This video shows you what can be done with the new grass system. It aligns to the terrain, grass color is the same as the vertex color beneath it. It also has full forward shadows and global wind support.


Random island placement
VILI VOLČINI

This past week I was working on random Island placement and many other things. I found a need for Gradient Descent style optimization, to place Islands around each other, with special constraints. First I made a penality function or error function. This function is scalar field, since it returns a real number based on position in the world (and islandRadius you are willing to place).

float PenalityFuncIsland(Vector3 point, float islandRadius) {
 
   float error = 0;
 
   // island-wall-distance
   float wd = ClosestDistToWalls(point, islandRadius);
 
   error += Mathf.Max(wd - minimumDistanceBetweenWallAndIsland, 0);
 
   // closest island-island-distance
   float d = ClosestDistToAnyIsland(point, islandRadius);
 
   error += Mathf.Max(minimumDistanceBetweenIslands - d, 0f);
   error += Mathf.Max(d - maximumDistanceBetweenIslands, 0f);
 
   // difference between 2 closest-island-island distances
   float c2 = ClosestDistMaxDist2Islands(point, islandRadius);
 
   error += Mathf.Max(c2, 0f);
 
   return error;
}

In order to minimize the error, I needed to do a gradient of the same function. This is 2D version, since we are placing regular Islands (not Floating Lands). Because it’s 2D gradient, I just needed to calculate 2 derivatives.

Vector3 PenalityFuncIslandGradient(Vector3 point, float radius) {
 
   float dx = PenalityFuncIsland(point + Vector3.right,   radius) - PenalityFuncIsland(point - Vector3.right  , radius);
   float dy = PenalityFuncIsland(point + Vector3.forward, radius) - PenalityFuncIsland(point - Vector3.forward, radius);
 
   return new Vector3(dx, 0f, dy);
}

Then I picked random iterPoint in space (initial guess), and then I just walk over world like that, minimizing error (walking down the hill).

while(..) {
    ..
    iterPoint = iterPoint - coefficient * PenalityFuncGradient(iterPoint, radius);
    ..
}

Obviously this is not the whole story, since I also needed some termination code (knowing when to stop & knowing when a point is good enough or should be discarded). I have drawn the trail of walking through our space, and this is the end result:

gradient_descent_lowpoly_floatlands.png?

Armadillo
ANDREJ KREBS

I have modeled and prepared some more skins for the crystal armour, which the players will be able to collect and use. This week’s newly additions are two more modeled and animated critters for the game, an armadillo and a spider-like robot with a drill.

Armadillo_render_lowpoly_floatlands.png?
Armadillo critter

Painting more icons for the UI
MITO HORVAT

I continue to paint icons for the UI. Slowly finishing with armor sets and moving towards the trash icons. You can see some of the new trash icons in the picture below. Trash items are mostly damaged objects you’ll be able to find in the floatlands universe. From mechanical parts to wooden junk that will lay around on the ground.

UI_icons_lowpoly_floatlands.png?fit=728,
Additional UI icons - armor sets and damaged objects

Creating templates for Floatlands Wiki
BLAŽ DROBNIČ, TADEJ VRANEŠIČ

Perhaps you noticed the Gamepedia link on our blog. Well, Gamepedia is hosting Floatlands official Wiki. Since our game is still a work in progress, game changes also have to reflect in the Wiki.

So lately we’ve been updating the main page – correcting the layout, background and logos (featured images are a little outdated and will be replaced soon). We’re also preparing various templates, which will help us add elements to Wiki a lot easier. Tadej and I first put together a template for adding Weapons. The example on the right shows Close Encounter Shotgun and all of its characteristics in the game.

An example of weapon item template on Wiki
An example of weapon item template on Wiki


Floatlands music: Earth
CHRIS PLEXIDAS

Earth is a darker track, soothing and mysterious that will play during nighttime and dawn time when exploring your unknown surroundings.


More about Floatlands:

Recommended resources

Game Engines

See full guide
Unreal Engine 5 Best Practices cover
Editor pick

Unreal Engine 5 Best Practices

Amazon · Book

Written by multi-award-winning Unreal generalist Tyson J. Butler-Boschma, Founder and Creative Director of Toybox Games Studios, this book addresses common challenges you face when advancing your expertise in lighting, environment design, and cinematic storytelling.

GameDev.net may earn a commission if you purchase through these links. This helps fund the site at no extra cost to you.

GameDev.net may earn a commission if you purchase through these links. This helps fund the site at no extra cost to you.

Discussion

Loading comments...