Embrace the failures

Today I meant to create the system for our procedurally generated forest. What I managed to do instead, was to crash Unity consistently using functions I’ve used many times before. This felt so puzzling that I felt an urge to bang my head against the problem for several hours, instead of trying another approach like any sane person would have. Once I took a break (meaning I went home in a sulky mood) I finally got an idea worth approaching!

Instead of spawning all the trees from the center of the world outwards, testing if they’re too close to other trees (this is where I failed), I’m going to create a zone system! I intend to break up the world into increasingly smaller chunks, and spawn trees inside these zones. This way I don’t need to rely on potentially buggy features or test distance against all trees in the entire game. It also lets me optimize interaction-checks ingame, such as hugging the trees 🙂

What have I learned? Logically, I’d try and keep an eye out for when I start to get frustrated with something and take a break instead. In practice I’ll probably fall into the same trap again from time to time 😉

// Marko

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: