Skip to content

JWalkerMailly/DAddonMap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DAddonMap

A VGUI component for Garry's Mod that renders a square map of the overall size of currently installed addons. Based on flat tree-mapping algorithms to display rectangles of uniform aspect ratios.

Note

Artificial intelligence (AI), specifically Claude, was used to translate the “properties” file into 31 other languages supported by GMod. Claude AI was also used to help cleanup the LDoc comments of the async squaremap + merge-sort module.


✨ Features

  • Size filtering for granular search
  • Fast async tree-map algorithm for space partitioning
  • Lookup index with variable kernel for near O(1) filter lookups
  • Steamworks caching and filesystem lookups for preview ids
  • Deferred rendering with batching using rendertargets to reduce draw calls
  • Async map rendering based on progress
  • Adaptive display size with 0 extra computation cost

📝 Usage

local map = vgui.Create("DAddonMap")

⚙️ How it works

  • Addons are collected via engine.GetAddons() and inserted into the square map as weighted data based on size.
  • Async process starts (coroutine) sorting addons by size using mergesort.
  • Areas are computed so rects fill a predetermined 1024x1024 space.
  • Squarify (treemap) algorithm lays out rectangles row by row asynchronously, optimizing for aspect ratio.
  • Each batch gets committed to the rendertarget while caching preview IDs to disk.
  • Upon completion, a spatial index using a variable kernel is built over the map for hit testing.
  • Completed map gets drawn in a single draw call per frame using rendertarget.

🧩 API

PANEL:OnClickAddon(addon)

Callback upon clicking an addon.

Parameter Type Description
addon table Addon object containing its meta-data. For more info, see this page: engine.GetAddons()

PANEL:OnRightClickAddon(addon)

Callback upon right clicking an addon.

Parameter Type Description
addon table Addon object containing its meta-data. For more info, see this page: engine.GetAddons()

✏️ Architecture

DAddonMap is built around:

  • Deferred async rendering
  • Batch processing of Steamworks preview IDs
  • One-time map generation through rendertargets
  • Flat tree-map algorithm with fast async merge-sort

📖 References

About

VGUI component to render square map of addon sizes on disk.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages