Hey guys,
I’ve been messing around with a couple things in the source and one thing I’d heard about but haven’t been able to locate is how to flag specific submaps as needing to be added to the mapbuffer for “reality bubble” crunching when the player isn’t currently in the area. The topic has been touched on recently during discussions on forest fires and/or NPCs and/or roaming hordes but I wasn’t able to find any specifics. Any pointers would be much appreciated.
Thanks!
Short answer: you can’t flag submaps that way.
Long answer:
The mapbuffer is used to store/load submaps. It does not process them in anyway.
The “reality bubble” is the map. Anything that is contained in game::m. This object contains a grid of “active” submaps (see map::grid). The map class itself acts as a wrapper that uses the specific submaps. For example to get what terrain at (40,77) is, the map translates that into the submaps coordinates (40/SEEX,77/SEEY), gets that submap from the grid and looks up the terrain at (40%SEEX,77%SEEY) in the terran array of the submap.
Active items are processed by map::process_active_items, which is called somewhere in game.cpp each turn. The function looks through each “active” submap and each item there and processes it.
Note that NPCs are different. They are stored in the overmap and only a pointer to nearest npcs is put into game::active_npc.
another note, you can create a “tinymap” if you need to load/adjust/save map data that’s outside the reality bubble, or in it for that matter.
that is how map generation works, along with some mission setup and monster despawning.