4 ms·
Looks to me like a bug -- they do a value -= policeStationMap.worldGet(x, y); when they probably meant to do value -= policeStationEffectMap.worldGet(x, y);
by aaronharnly 12y ago
Looks to me like a bug -- they do a
value -= policeStationMap.worldGet(x, y);
when they probably meant to do
value -= policeStationEffectMap.worldGet(x, y);
otherwise, crime is reduced only if there's a police station right there. That's just a guess based on a cursory look, though.
- icefox 12y agohttps://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.