Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Caterpillars: Moved from elsewhere

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Sat Dec 05, 2009 9:29 pm    Post subject: Caterpillars: Moved from elsewhere Reply with quote

Quote:
There are currently 16 frames of caterpillar history, numbered 0-15. Hero 0 is drawn ad caterhistory position 0. Hero 1 is drawn at caterhistory position 5, hero 2 at position 10, and hero 3 and position 15

The commands "set hero position" and "set hero direction" are actually modifying caterpillar history entries.

The history entries in between the heroes cannot be directly modified, but if you run "resume caterpillar" then the halfway positions between each hero will automatically be re-interpolated.


Let's see if I got this straight:
History slots (containing information about the leader's former positions and directions) are stored at slots 0,5,10, and 15.
I'm going to guess that it's updated every tick ... so slot five represents the party l34d3r's former position 5 ticks ago. That way you'd see the stretching of the caterpillar when you speed them up. Am I right?

Aaand ...
The intermediate positions are interpolated between the history's position and a trailing hero's actual position, divided by five. ( Are these interpolations made every ... step taken?)

Reason I'm being so annoying is that I'm trying to smoothly link up a newly formed caterpillar.
I place my heros in a row, and then "resume caterpillar".
It works, but there's a small but noticeable hiccup. I'm trying to understand what it is.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sat Dec 05, 2009 11:40 pm    Post subject: Re: Caterpillars: Moved from elsewhere Reply with quote

Bagne wrote:
Let's see if I got this straight:
History slots (containing information about the leader's former positions and directions) are stored at slots 0,5,10, and 15.
I'm going to guess that it's updated every tick ... so slot five represents the party l34d3r's former position 5 ticks ago. That way you'd see the stretching of the caterpillar when you speed them up. Am I right?


Five ticks ago, but only counting ticks in which movement happened. No movement, no caterpillar history update.

Bagne wrote:
Reason I'm being so annoying is that I'm trying to smoothly link up a newly formed caterpillar.
I place my heros in a row, and then "resume caterpillar".
It works, but there's a small but noticeable hiccup. I'm trying to understand what it is.


Could I see the hiccup in action?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Sun Dec 06, 2009 6:11 am    Post subject: Reply with quote

Sure, if you like.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Sun Dec 06, 2009 10:27 am    Post subject: Reply with quote

Is the high speed caterpillar stretching desirable?
I'm guessing not - I also can't think of any uses for it.
I don't know of any games that exploit it.

I have some thoughts on caterpillars:

If a new kind of caterpillar (based on the one you just explained) was done in the following way, it would prevent stretching/squishing, while also paving the way for non tile-based movement.

I am assuming that the magnitude of the minimum movement speed is 1 pixel per tick.

1) We have a history of leader positions (size 40 ... er ... 41).
2) The leader's position is stored at slot 0.
3) We have a pre-history for each tailing hero (size ... 20 I think).
4) The current position of a tailing hero is found in the last entry of their pre-history
5) Every time movement occurs, the leader's history entries are shifted down by n slots, where "n" is the leader's movement speed in [pixels/tick]. This will create empty entries between slot 0 and slot n - so they will have to be interpolated.
6) Positions stored at indices 0, 20 and 40 will feed into each tailing hero's pre-history (at a rate of n entries/ tick).
7) Whenever "resume caterpillar" is used the tailing hero pre-histories are re-interpolated (between current positions, and positions stored in slots 0, 20, and 40)

Note that:

This lets us use any integer speed, so long as it isn't smaller than 1.

Point 4) will guarantee that tailing heros are always 20 pixels away. If you're using a speed that isn't divisible into 20, rounding errors in the interpolation may misplace the tailing heros by 1 pixel, but I suspect that if you walk continuously in the same direction, the offset will be consistent, so the heros won't jiggle.
For tile-based movement, we're restricted to speeds of 1,2,4,5,10,20,40 etc anyway, so rounding error isn't a concern (we don't need to worry about misaligning heros to the tiles).

Also, "resume caterpillar" interpolation would have to be slightly different for tile based and non-tile based movement - the difference being that in tile based movement, we don't ever want to risk misalign a hero with a tile, and so they need to be moved to their proper place in the time of one step.

With non-tile based movement, we're free to interpolate over however many ticks we please 4 or 5 is good.

If we want to be over-the-top extravagant and make the caterpillar length customizeable, really large histories (and pre-histories) could be kept, but the feed-in indicies and hero positions indicies would change.
For example, to make the caterpillar twice as long, the history feeds into the pre-histories at indicies 0,40,and 80, and heros are positioned at entry 40 of the pre-history.

Yeah, that's it.

Okay,
In the meantime, I've thought of a use of the stretch-contract effect.
The team is walking really fast, when the leader slows abrubtly, and the queue contracts. Everyone has bumped into one another a-la-Jungle-Book-Elephants. "Hey! Watch it!", barks the party leader.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group