Skip to content

Prototype for Paradox-like territory maps in Unity. For educational purposes and meant to be a starting-point for those that want to create their own grand strategy games in Unity and are having difficulties on where to start

License

Notifications You must be signed in to change notification settings

jorlmn/GrandStrategyFactionTerritories-Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grand Strategy Faction Territories - by Jorel

Prototype for Paradox-like territory maps. For educational purposes and meant to be a starting-point for those that want to create their own grand strategy games in Unity and are having difficulties on where to start.

Created following this amazing resource written by a Paradox dev that details how the Gradient borders were done in Imperator Rome: https://www.intel.com/content/dam/develop/external/us/en/documents/optimized-gradient-border-rendering-in-imperator-rome.pdf

image

Features:

  • Faction Map Mode, where the borders are drawn only between factions, and a Province Map Mode, where borders are drawn between all provinces
image

  • Factions - Provinces can have two colors, a border color and a fill color

  • Easily update the colors of factions and borders, so that you can show custom map modes, such as diplomacy (green for allies, red for enemies), income (red for negative, green for positive) and etc

  • Smooth borders

image

  • Customizable properties on the Territory Shader, for border width and alpha, fill width and alpha, etc
image image image image

  • Code for procedurally generating the texture lookup map. Useful for Stellaris-like games where the campaign map is procedurally generated when the campaign starts
image image

Basic Steps:

  • Create a hand-drawn texture lookup map (one color for each province) or procedurally generate it
image

  • Pass the texture lookup map into the border detection seed shader
image

  • Pass the generated seed into the jump-flood algorithm shader

  • Pass the result of the jump-flood algorithm into the distance field generator shader

image

  • Pass the generated distance field texture into the final Territory shader
image

Issues:

  • If using 8192 textures or above, there is a performance spike when refreshing the distance field texture (which as it stands, must be done every time a province changes hands or when the map mode changes from Faction borders to Province borders)
  • If using 4096 textures or below, the generated distance field texture may have some gaps and artifacts in near-straight lines, which in turn affect the final borders, such as below
image

About

Prototype for Paradox-like territory maps in Unity. For educational purposes and meant to be a starting-point for those that want to create their own grand strategy games in Unity and are having difficulties on where to start

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published