Skip to content

Event-driven C# generic core for 1st/3rd person Unity games built on Swordfish library with homebrew proc-gen terrain system

Notifications You must be signed in to change notification settings

ChaseHuegel/ugame-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wayward-core

Event-driven C# generic core for 1st/3rd person Unity games built on my Swordfish library

Much of this uses Unity specific functions but is built to be as independent as possible so that the core functionality be shifted to other engines/uses with minimal refactoring. Its a work in progress and terrain is the current focus.

The terrain uses the C# implementation of the FastNoise library. Some minor refactoring can switch over to any noise source. Excuse the messy prototype for the terrain. The proof of concept is functioning as intended, rewriting a proper implementation with more extensibility and configuration.

The terrain was originally built to read images to map height, colors, tile types (textures), and object placement (trees). It was expanded to make use of noise for all aspects to create procedural terrain. The final implementation will allow the option between both and will include a proper tile based mapping (i.e. voxel terrain or 2D tileset based games) since the current "tile map" is hacky using hard-coded integer IDs. This allows for a dynamic open world with materials and behaviors attached to individual tiles that scales performantly at any world size.

The first prototype using height and color maps to build terrain. Height changes are steps and ramps. I didn't like the look so moved to smooth terrain right away. fa0475db431320ba5595a5118367cad6

The 2nd prototype with noise-based generation. I restructured the mesh to look smoother, added textured tiles, added object placement. fafb5e5afac287f9a82fea0b298fc9fc

Then I started baking shading to mimic shadows and ambient occlusion. This took some theory crafting, I couldn't just calculate angles to get steepness or determine crevices- that would be far too slow and to keep things scalable I can only use information on a tile-by-tile basis, no sampling neighbors.

I realized I can approximate the steepness/angle with some very basic math that runs fast. I average the height of all 4 points that make up a tile then use the difference between that average and the exact height at each point. This gives me a rough shading. Higher difference = steeper angle = darker vertex. Then I use point's position relative to the sun's direction to determine how much to lighten the shading in order to fake shadows on distant terrain. 24b4cddcce146ec7ae04dbb10c547445

The implementation isn't accurate to real life, but it doesn't need to be for distant terrain where I can't get realtime shadows. unknown

About

Event-driven C# generic core for 1st/3rd person Unity games built on Swordfish library with homebrew proc-gen terrain system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages