Added generating structure in separate thread

This greatly reduces lag on my laptop, and will be needed if we create
even bigger structures than the castle.