Closed AtkinsSJ closed 14 years ago
It looks mostly pretty good; the only thing I can spot is the loss of randomness in the dirt-to-grass conversion. It's definetly worth a look into.
For randomness, you could always add the grass/dirt locations, with random times, to a list of delayed changes. But I'm not that bothered about having random things really. :P
Implemented, and working excellently.
(Implemented)
I have an idea that should massively speed up physics: Separating lighting from regular physics.
Now, to figure out if something is lit, you only need to know the height of the highest opaque block - anything below is in shadow, and anything above is lit. So the map would contain a 2d array of integers, for the height (I think this is Y) coordinate of the highest opaque block in the relevant column.
When a block is placed, a quick check is done: Is it an opaque block? If so: Is it higher than the highest opaque block? If so: Go through the tiles between the two heights, setting them to shaded and reacting as necessary. eg, destroying flowers, setting grass to dirt. Then, set highest to the new value.
When an opaque block is removed, another check: Is it he highest opaque block? If so: Go down through each square, setting it to lit, until you reach an opaque block, reacting as necessary - setting dirt to grass, destroying mushrooms. Then, set highest to the new value.
This way, you no longer need to check through 65000 dirt and grass tiles each physics tick - they only get checked when something changes. :D
What do you guys think?