How to optimally lay out a few miles of roadway

I am working on a Rally style racing app and I would like to get some input on how to optimally lay out a few miles of roadway to race on with out the iPhone melting in my hands… :slight_smile:

My approach is to divide the course into small prefab sections, 1/8 to 1/4 mile in length, and only have 1 or 2 visible at a time. As you leave one section and enter the next you will, after a short distance, hit a trigger that destroys the section you just left and before you would see the next section you would hit another trigger that instantiates the next section and so on.

Each course has many twists and turns as well as berms and hills so the next section to come in will do so before it would be visible to the player.

The triggers also act as the restart location for that section when the player goes off the road and gets stuck so they would never respawn in a section that is no longer there.

I’ve read up on Occlusion Culling which I think is perfect for indoor scenes but for large outdoor environments I’m not so sure about it’s use. It would seem to me that I would have better control doing it in this manner.

Also, would it be best to bring in all sections while the level is initially loading then destroy all but the first section and then start the race?

Instantiating/destroying stuff all the time would not be optimal. Turning it off and on would be a lot better.

–Eric

You can script that?

It would make things easier if I could switch the Parent/Children on and off. Is there reference in the scripting manual for this?

Never mind. Just found it… GameObject.active

Should I deactivate sections after the level has loaded so that all textures, etc are in memory?

If all the objects are ready to roll (ie, just switching active on/off), you won’t experience slowdowns as the phone struggles to pull things into memory.

Of course, that also means you’ll need to be pretty thrifty on textures, etc. There’s not a huge amount of ram to play with.

Each of the course sections will use pretty much the same textures and most will be combined onto a couple image files.

After further investigation I think I found the best approach thanks to fvgNYC45 who posted the following,

Each section will have an empty gameObject as a parent and all of the children will make up that portion of the course.

Seems logical to me anyway. Thanks everyone for leading me in this direction. :lol: