Advertisement
Guest User

Untitled

a guest
Aug 9th, 2024
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. --======================================================================================================================
  2. --[[
  3.     MODDED REGION DEFINITIONS
  4.  
  5.     The mod will include all imported files whose name starts with "Suk_RegionDefinitions_"
  6.     include("Suk_RegionDefinitions_", true);
  7.  
  8.     Regions are created using a DBSCAN clustering algorithm.
  9.     https://www.geeksforgeeks.org/dbscan-clustering-in-ml-density-based-clustering/
  10.  
  11.     Insert a new entry into g_RegionDefinitions with the following format
  12.  
  13.     g_RegionDefinitions[sRegionType] = {
  14.         CheckerFunction = function(pPlot) return bBool end,
  15.         MinSamples      = iInt, -- Minimum number of neighbors to create cluster
  16.         Epsilon         = iInt, -- Maximum distance to consider another point a neighbor neighbors
  17.         MinSize         = iInt, -- Minimum size of cluster for it to be valid. This is BEFORE Dilation. Optional. Default 0.
  18.         Dilate          = iInt, -- How many tiles to grow the group by before finalising. Optional. Default 0.
  19.         CoastalOnly,    = bBool -- Whether to limit the FINAL cluster to only coastal tiles.  Optional. False 0.
  20.     }
  21.  
  22.     sRegionType MUST MATCH your Database entry
  23.  
  24.     the "Checker Function" determines which plots are considered valid "Nodes"
  25.     for the algorithm
  26.  
  27.     Regions are grown from "Core Nodes", which are any Nodes with >= MinSamples number of neighbors
  28.     Nodes are considered neighbors if the distance between them is <= Epsilon.
  29.     Regions will include both regular and Core Nodes. It's just that regions are grown from Core Nodes.
  30.  
  31.     Regions are < MinSize are culled. MinSize defaults to 0 if not provided.
  32. ]]
  33. --======================================================================================================================
  34. -- DEFINITIONS
  35. --======================================================================================================================
  36. -- Forests
  37. -------------------------------------
  38.     g_RegionDefinitions["REGION_SUK_FOREST"] = {
  39.         CheckerFunction =
  40.             function(pPlot)
  41.                 return (pPlot:GetFeatureType() == GameInfo.Features.FEATURE_FOREST.Index)
  42.             end,
  43.         MinSamples  = 2,
  44.         Epsilon     = 1,
  45.         MinSize     = 4,
  46.         Dilate      = 1,
  47.     }
  48. --======================================================================================================================
  49. --======================================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement