MapPreviewGenerator
Generates real map preview thumbnails for Bopl Battle — vanilla maps and BoplMapMaker custom maps — cached as PNG. Exposes a public API for other mods (used by NextMapVote).
About this mod Author’s original text
PMod Map Preview Generator
Generates real map preview thumbnails for Bopl Battle and exposes them to other mods through a small public API.
What it does
- Captures real in-game screenshots of every vanilla map (once per map, cached as PNG in BepInEx/plugins/PmodMapPreview)
- For BoplMapMaker custom maps: loads the map's biome scene, places the map on it and screenshots it — real thumbnails, not placeholders
- Installs the previews into the game's map selection UI automatically
- Re-generates a preview when a map is edited in the Map Maker
- Shows a progress panel at the top of the screen while previews are being generated
Matchmaking
This is a client-side mod: it only renders/creates preview thumbnails and never alters gameplay state. At load it increments the game's client-side-mod counter (CharacterSelectHandler_online.clientSideMods_..., via reflection), so matchmaking stays enabled — you can queue and play normally.
Reference the library
Two options:
Option A — compile-time reference (recommended)
Reference PMod.MapPreviewGenerator.dll from your project and add the dependency to your manifest.json:
"dependencies": ["BepInEx-BepInExPack_BoplBattle-5.4.2100", "PMod-MapPreviewGenerator-1.0.0"]
using PMod.MapPreviewGenerator;
Option B — runtime reflection (no compile-time dependency)
Resolve the type by name and call members via reflection. The type never causes a hard dependency, so your mod still works (without previews) if this one isn't installed.
static Type PreviewLib =
AppDomain.CurrentDomain.GetAssemblies().Select(a => a.GetType("PMod.MapPreviewGenerator.PreviewLibrary", false)).FirstOrDefault(t => t!= null);
The vote mod NextMapVote ships a working example of this pattern (PreviewLibAdapter.cs).
API reference
All members are public static on the class PMod.MapPreviewGenerator.PreviewLibrary.
Lifecycle overview
The generator is fully automatic: when you enter a menu scene (buildIndex | Fired whenever a real preview becomes available — vanilla mapId in vanilla mode, custom customIndex in MapMaker mode. Subscribe to refresh your UI. |
Vanilla maps
| Member | Type | Description |
|---|---|---|
| VanillaMapCount | int | Number of vanilla maps in the build. |
| HasRealPreview(mapId) | bool | True when a real (captured or cached) preview exists for the map. |
| EnsurePrepared(mapId) | void | Makes sure a preview exists for the map. Async: loads the PNG cache, otherwise queues a background capture and shows a procedural placeholder until it lands. Safe to call every frame. |
| TryGetSprite(mapId, out Sprite sprite) | bool | Fetches the current preview sprite, if any. Returns false (with sprite == null) when there is none yet. |
| InstallTexturePreview(mapId, tex) | void | Replaces the preview of a map with your own Texture2D. The generator tracks it for cleanup. |
| EnsureRealPreviewSync(mapId) | void | Synchronous variant of EnsurePrepared for vote-result time: guarantees the real cached screenshot even if its async load has not finished. Blocks briefly (one small PNG read). |
| StartPreloadAll() | void | Re-arms the menu preload and queues anything missing. Normally called automatically when a menu is entered. |
| QueueAllMissing() | void | Queues every map that still lacks a real preview. |
BoplMapMaker custom maps
| Member | Type | Description |
|---|---|---|
| CustomMapsAvailable | bool | True when the BoplMapMaker mod is present with loaded maps. |
| CustomMapCount | int | Number of custom maps available. |
| CustomMapName(customIndex) | string | Display name of a custom map (from its MetaData.json). |
| CustomMapType(customIndex) | string | Biome of a custom map: "grass", "snow" or "space". |
| CustomMapBaseLevelId(customIndex) | int | Vanilla base level id a custom map plays on (derived from its biome). |
| CustomMapJson(customIndex) | string | Raw.boplmap JSON of a custom map. |
| EnsureCustomPrepared(customIndex) | void | Same async semantics as EnsurePrepared, for custom maps. |
| Try
Install & use Install: follow the bundled instructions
- Unzip the archive from playbuff and read the bundled readme / instructions first.
- Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
- For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
- Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.
Install locations vary a lot between mods — the bundled readme is the most reliable guide.
Install these first, or the mod will not work: