-
Notifications
You must be signed in to change notification settings - Fork 47
Graphics Paging v2
billw2012 edited this page Sep 10, 2019
·
1 revision
The existing system can be improved in a number of ways:
- Apply changes iteratively instead of in a single frame, keeping frame-rate smoother.
- Separate the priority and draw range for different components of a plot. e.g. Keep units and city pages in at further distance.
- Parameterize all the settings.
- Introduce an eviction function, not just using age. e.g. Distance from camera + ownership + age
First introduce a cleaner interface for controlling the graphics of a plot. A bitmask for currently active components vs active components for instance, with a single function to toggle them.
Integrate all paging information into the plots, don't need separate arrays etc. Iterating over all plots on the map every frame to perform paging isn't a big deal, 200 x 100 map is only 20000.
Pseudo code:
for each component:
for each plot in component range of view center plot:
plot.show_component(component)
if memory free < desired:
evictable = plots where any component is out side its view range ordered descending by eviction_function
while memory free < desired and not evictable.empty: