Smooth Terrain Testing

Smooth Terrain Testing

Hello folks!

Talking to a player of the game, he gave me the feedback that he didn’t quite enjoy the landscaping because the current terrain system looked a bit too unrealistic. Plus the looks of it looked a bit odd depending on the lighting conditions: the light would reflect too strong in certain areas, not strong enough in others.

So I went ahead an prototyped a simple replacement for it. Basically, I added a Terrain object to the game, and am using the existing systems for processing the information, while setting the height of the terrain based on it.

The results are here:


I quite appreciate the smoothness of this terrain. With the proper texturing, it could look pretty sweet and clean. I’m studying how to apply the terrain textures to it (grass, gree, fairway etc), but since this has a decent support for normal maps too, it could add some much welcome depth to the terrain features.

It is, however, a trick. The mesh is still pretty much the same as it was before (at least at this stage), and you can see the difference when I turn on the wireframe mapping and some zones:


But the smooth shadow makes it look a lot nicer. Playing around with some height limitations, I could make the height tools affect nearby vertices as well, to give a smoother climb. There’s no performance loss either at this stage, which is great.

I’m gonna prototype how to apply the terrain textures to it, but I have a hunch it would allow me to more easily use higher-res tiles. And for the zones, I can just keep the current system as they work decently enough as an overlay.

Considering some changes to the planning aspect of it too, but that’s for later!

That’s all for this microupdate!


Terrain Demo available!

Terrain Demo available!

Hello folks!

I’ve packaged the current version of the game into a nice terrain demo. It allows you to place tees and corresponding holes, change the tiles in the landscape, as well as edit the height of the terrain.


-Mouse click does most things, mouse right click cancels actions and returns menu
-WASD and arrow keys pan the camera
-Mouse wheel and Q E zoom in and zoom out
-Holding mouse wheel and moving the mouse will rotate the camera

So you can download it here!

Give it a try, and comment anything you found interesting/annoying/awesome!

(Also, take screenshots!)


Quickie: Going Chunky

Quickie: Going Chunky

Hey folks,

Today’s update will be a quick one, as the task is still underway.

I decided to do some test to check the performance of the current system if we use larger terrain chunks. So far, all testing had been done on a 16×16 grid, and performance was fine.

So I decided to up the ante to 32 x 32, and the performance was bad…


There was a very notable dip below 60fps, and that’s not good. Not to mention this was just a barren terrain, and that is bad. I’m sure there could be some optimization done, but it still isn’t good enough.

So I decided to redo the tile system again (third time is the charm!), this way separating the terrain into chunks of 16×16 tiles, all contained inside a single mesh. (Chunks can be made up to near 64×64, due to Unity limitations regarding vertices in a mesh). As a test, I spawned 3 chunks of 32×64, and placed it all on the scene. This is roughly 6000 tiles on display, spread across 3 large meshes.

This is the result:


As you can see, the performance stayed at 70fps range, render thread was cut by 75%, cpu remained 4ms faster, much smaller number of shadow casters, batches, and a vastly greater number of verts and tris.

So I’ll need some time to adjusting the current system to match this. The generation itself is working fine, as is the UV mapping. But I’ll need to rework the shot system since it’s all under one big mesh collider. Some things will be vastly simplified, though. And the game will run better for it!

Stay tuned for more!

Dev Update #8: Terrain Controls are In!

Dev Update #8: Terrain Controls are In!

Woo! Great progress this weekend.

Finished with the basic implementation of the terrain raising/lowering controllers.

You can now edit the level at the vertex and the tile level. (which raises all surrounding vertices). Simply select the desired tool (per vertex/per tile), click and drag the desired tile; up increases height, down decreases height. Simple as can be:


Though that’s less a valid course as it is a trip through hell.

Now I gotta work on the stepping levels so that the course building is less insane. Though you’ll still be able to reach insane levels if you so desire. I also want to implement a controller for edges, and one for raising up the selected tile only, similar to what you can find in the Rollercoaster Tycoon of yore.

Next perhaps a flattening tool, and even the possibility of affecting multiple vertices/tiles at once. All should be straightforward to implement with the current system. But will be in the wishlist for now.

Til next time!

Dev Update #5: Implemented the new Terrain

Dev Update #5: Implemented the new Terrain


After wrestling with it, was able to replace the current tile system with the height-enabled terrain system. I still need to do some adjustments so that trees and other objects are also automatically placed, but I’m glad to get the thing working as it is:


You can see from the wireframe map that the shared vertices are also taken note of and raised together to avoid some bad geometry. Working on improving adding controls for manipulating the height of the map too!

However, one issued appeared:

Every square is it’s own separate mesh. Did it that way to have easier control/prototyping of the UV maps since each quad has it’s own easily accessible UV array. (If they were in a single mesh, it would be trickier to handle them, but not impossible).

So for some reason, there is a seam in between the each mesh, as you can see circled in red:


The cause of this is, I’m guessing, some imprecision regarding placement of the vertices and the processing of the graphics going bad at some point. Tomorrow I’ll experiment with using a single mesh and keeping track of UVs with structs or something, and see if this issue goes away.

Dev Update #4: Reaching Higher Grounds

Dev Update #4: Reaching Higher Grounds


On the suggestion of a friend, I decided to take the time to experiment with procedurally generating terrain so that height can be added and give you more diversity on the golf course.

As such, I created a simple TerrainMesh class that generates a single polygon, and maps its UV coordinate according to the type of tile I want. Also implemented methods to allow me to change the Y component of the vertices, so that we can add height. So we can go from this:


To this:


Textures are now 16px*16px inside a larger 512px texture. Can easily increase the size to make it better looking if I so desire, and the system will adjust easily.

Next I’ll implement vertice control, so that the vertices can be selected and raised, and then replace the current system with this. Will also give me more control over creating other meshes to populate the tiles.

Til next time!