Game Development Reference
In-Depth Information
Getting ready
This recipe requires height differences to make it interesting. A heightmap will work very
well.
The model we'll develop will evolve around cells that are defined by two parameters: the
height of the ground it resides on and the amount of water in it. If the height and amount of
water combined are higher than a neighboring cell, water will pour out of it and into its
neighbor. To make sure the cells are updated simultaneously, all of the water pouring into a
cell will be stored in a separate field and applied at the end of the update cycle. This en-
sures that water can only move one tile through the field in one update. Otherwise, the
same unit of water might travel across the whole grid in one update as we loop through the
tiles.
The example mentions a CellUtil class. The code for this can be found in the The
CellUtil class section in Appendix , Information Fragments.
Search WWH ::




Custom Search