4 ms·
https://github.com/lo-th/3d.city/blob/6d206e4df362444d4c2a36bf3582b343f5afe93c/src/utils/BlockMapUtils.js#L204 https://github.com/lo-th/3d.city/blob/6d206e4df36
by icefox 12y ago
https://github.com/lo-th/3d.city/blob/6d206e4df362444d4c2a36bf3582b343f5afe93c/src/utils/BlockMapUtils.js#L204 https://github.com/lo-th/3d.city/blob/6d206e4df362444d4c2a36...
Before the for loop it "smooths" the policeStationMap 3 times. And this is reset every 15 cycles and in the first 8 cycles it re-populates the policeStationMap before performing the crimeScan.
(https://github.com/lo-th/3d.city/blob/5827c3be180c6b7b39076dde27f02492e9022681/src/game/Simulation.js#L168 https://github.com/lo-th/3d.city/blob/5827c3be180c6b7b39076d...).
So a cursory investigation it doesn't look good and any policeStation needs to be within 3 to have any effect.
What the simulation should do is never clear the policeStationMap. The policeStationMap is constantly cooling and diffusing and it is only by refreshing where the police stations are is how new energy is introduced into the system (policeStationMap). The simulation doesn't even need to reset the spot on the map when a Tile.POLICESTATION is removed because the value will on its own cool. As an added bonus the simulation doesn't need to waste cpu cycles calling smoothStationMap three times in a row, but only needs to do it once.