[updated]: Make certain objects arrive in the scene (a lorry)

Started by
23 comments, last by mdias 9 years, 9 months ago

We need more info...

What is the intended behaviour?

Should the lorry appear once every x seconds?

Once the level starts?

After a random amount of time?

Advertisement

Date              Time       Apple    Orange   Pear
10/10/2009        7:00       1
                  8:00       1                 1

The Date and time are the "Cartons or pallets" arrival dates and times, they arrive in the trailer of the truck

I need to convert this data into the probability of truck arrival time....

Thanks

Jack

I dont understand this list.

Doesn't it mean that the truck will always arrive at a specified time? If so, why the randomness?

You may think of it as if there is some deviation based on this data.

Thanks

Jack

so you have a list of trucks that arrive after a specified amount of minutes plus or minus a random amount of minutes. And you want to take the next truck out of this list when the amount of minutes has passed.

Is this correct?

Yes, and it would be perfectly nice to post some example code for me.

Thanks

Jack

Come on... I'm not going to write the code for you. My last post should have all the info you need to implement something that you can build upon.

Keep in mind that "random" isn't necessarily random in the way it sounds.

I.e. if you're going to add/subtract a random amount of time to when a truck arrives you'll want to determine a threshold, what is the maximum amount of time the truck could be early/late. for instance if the truck arrived at 1:00 you could set a 20 minute threshold for both arriving late or arriving early.

After that it kinda depends on the math you want to use, you could use a rand function between -20 and 20 and apply the difference(that may require a little fiddling if you're using an object representing time with a unique type) or you could pick a random 0-20 and then decide to add or subtract based on a second rand roll.

Anyway the math doesn't matter that much, the point is more that in terms of computers you're almost never going to just pick some totally random number. Most of what everyone has been trying to convey to you so far in the thread is that you have to look at your problem and decide how best to tackle it for your unique situation.

If you want to model number of arrivals in a discrete time period (e.g. number of arrivals per hour, with some mean number of arrivals per time unit), you want to use the Poisson distribution:

http://en.wikipedia.org/wiki/Poisson_distribution

If you just want to model time between arrivals (with a certain mean time of arrival) you want the exponential distribution:

http://en.wikipedia.org/wiki/Exponential_distribution

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

Okay, I'll think thru it, and see I can come up with a solution.

Sorry, I was too impulsive to ask for an instant answer....

Thanks everybody

Jack

This topic is closed to new replies.

Advertisement