Grid city map d208/8/2023 ![]() ![]() If we instead want some kind of square island, we will need to check our distance from the borders instead. If randint(someval) yields a value larger than 20, we might not get any water at all at the border, so look out for such scenarios. The island will still be rather circular, but how scragged it is depends on what you feed randint in the condition. ![]() It can be solved but not with such an easy condition, Thomas Matthews ideas would work better in this case. It is possible that we get small isolated land tiles with this condition. Now we get some kind of scragged coast line. We modify our condition to if D > ((w - 20) + randint(4)) (where randint(x) returns a random integer, from 0 up to x). ![]() This gives us a "perfectly" circular island. if D > (w - 20), we mark the tile as water, otherwise we mark it as land. Iterate over every tile, and calculate D. P - C = D gives us a new vector D, the length of which is the distance from the center to the point being evaluated.Īs a first implementation, let's say that when the length (or magnitude) of D is larger than w - 20 we put a water tile down. Let's call the point currently being evaluated P, it too is a 2 dimensional vector (x, y) where x and y is the coordinates. C is a 2 dimensional vector (w / 2, h / 2).Īs you get farther away from C, the probability of water should increase, preferably with some kind of cut-off point. Let's call the width of your map w, the height h and the center point C. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |