Categories
Uncategorized

Quick post about random generating content

Something worth bearing in mind when you are designing randomly generated content (eg. level layouts). Often there are certain situations and scenarios you want to avoid with random generation, such as X item appearing next to Y item. Now, before you spend time coding a detailed set of rules to try and avoid scenarios you don’t like: be sure to ask yourself ‘ is it easier to just detect an unwanted result, and re-roll the dice’

Many times it does turn out you should code the fix if the problem crops up very regularly. But other times when the unwanted scenario is rare and your randomization is quick, the answer is usually: yeah, just re-randomize it. Remember that, and don’t immediately try to fix every problem by brute force.

edit: someone pointed out that re-rolling *is a brute force technique. What I was intending to get across is this- don’t always take the problem head on if you can easily sidestep it (by simply re-generating a satisfactory result) instead of spending ages getting the perfect solution every time.

Leave a Reply