Handling the route
I've first of all ruled out using scripts in each section as I think that for a fast moving vehicle the issue of communicating with them reliably could be difficult.
So this leaves to store the points in the objects itself, which ought to be easy enough, I won't be randomly changing track sections or anything.
My current thoughts are:
A big list, the number of points could be fairly large, not large enough to cause memory issues but large enough that I'm concerned that looking up entries might be annoying for any tight corners with several points fairly close together. What is the look-up time for a list like for such an application, are there any alternatives? Lookups would be mostly sequential (1, 2, 3, 4), does this actually make a difference?
Also, while I said I don't need it to update for dynamically changing tracks, I may have alternate routes that it will randomly take. My current thinking for that is that after looking up a new target, the main script would communicate with a secondary script to find out which point to go to next (ie it'll use a link message to request an integer back).
This other script may actually be state based, so if there are two possible routes, then it will go into one of two possible states, and branch in that way rather than using ifs. Again, is there a better way or is this a reasonably sound way? Each state would run through it's range of numbers then change to another state as needed. I was also considering using this method for retrieving the next co-ordinates, ie each point would have it's own state in this secondary script, and it would change state after each lookup, thus following a route. However, would passing the co-ordinates in a string via link messages be fast enough, or are list lookups faster?
Coding the actual movement
Physical objects are something I haven't touched and this one strikes me as potentially being annoying.
What it needs to do:
- Follow a series of points that may differ in height. Each pair of points will correspond to a straight piece of track, though gradients may differ.
- Ignore collisions or obstructions when moving from point to point, pushing aside avatars if necessary
- Travel at a fairly high, constant speed between points. Starting out relatively slow though picking up speed quickly (ie it'll start on a steep-ish part).
I'm thinking, is it possible with a physical object to tell it to move somewhere and have it do that without worrying about other things, or falling or whatever, in the same way a non-physical object and llSetPos moves directly to a point but smoothly? Would physical + phantom work, if so, can a target be set BEFORE making the object physical, as I don't want it to fall into the ground before it starts moving. ie; it will be non-physical to start with while avatar(s) get into the cart. Does movement support the at_target events for immediately knowing where to move next, how quick is this likely to be when heading to another point immediately after arriving at one?
Any script samples or advice on this is welcome, as I can see it requiring a lot of experimentation and I'd like to get it done sooner rather than later if possible.
Cheers to anyone who gives help
