P
Paolo Negri
Method 3
I choose my offset through a dedicated class (WanderingWalker) that
works always in seconds.
Basicly I start from the current offset (or position) and I genereta a
target to reach (by default a random number between -300 + 300) after
that I begin moving my offset of 1 unit per every consumed second in
the direction of the target. So in one second my offset moves of +/- 1
second, in one minute moves of +/- 60 seconds and so on.
When I reach the given target offset I just generate another target to reach.
I choosed this approach because it forces the clock to reach smoothly
any generated target at any update rate, and, in theory, moving the
offset this way is possible to avoid the check against going back with
the time.
But since I'm lazy I didn't tested/verified my theory so I had to keep
this check in my code.
cheers
Paolo
I choose my offset through a dedicated class (WanderingWalker) that
works always in seconds.
Basicly I start from the current offset (or position) and I genereta a
target to reach (by default a random number between -300 + 300) after
that I begin moving my offset of 1 unit per every consumed second in
the direction of the target. So in one second my offset moves of +/- 1
second, in one minute moves of +/- 60 seconds and so on.
When I reach the given target offset I just generate another target to reach.
I choosed this approach because it forces the clock to reach smoothly
any generated target at any update rate, and, in theory, moving the
offset this way is possible to avoid the check against going back with
the time.
But since I'm lazy I didn't tested/verified my theory so I had to keep
this check in my code.
cheers
Paolo