Archived

This topic is now archived and is closed to further replies.

kmne68

3D models with (semi-?)random components

Recommended Posts

kmne68    122
Can anyone give me any insight to the process of programming 3D structures where each component is selected arbitrarily but may also be influenced by previously selected components? For example, consider a roller coaster in Roller Coaster Tycoon. The coaster track weaves back and forth over and under itself and the game can tell you when a particular type of section cannot be placed due to interference with preexisting track or other obstacles. What type of reference or mapping system is used in the code to prevent two sections of track from trying to occupy the same section of space.

Share this post


Link to post
Share on other sites
Stoffel    250
Having been addicted to the game for so long, I know exactly what you''re talking about. I don''t know about the internals of RTC (aside from what I read on the author''s site--apparently it''s written almost completely in assembly!), but I can make some educated guesses:
- a new piece can''t block any other piece. It appears that tracks need a 2'' clearance, so if anything''s there or within 2'', it''s blocked.
- vertically angled pieces take up one more foot of clearance than others
- a new track must be placed at either end of the existing track
- that track must "link", which is a bunch of sub-calculations based on what two types are being connected. For example, when you wrap around and you try to connect a vertically flat track to a vertically slanted track, it won''t work even if it''s straight-on; the slanted track needs to flatten out first.

Now, whether the track tiles are kept in a linked list for each track, or whether there''s just a bucket of all pieces, or whether there''s both and they''re all cross-referenced--yoru guess is as good as mine.

Share this post


Link to post
Share on other sites