Would it be possible for a future version of AGS to support built in transition views?
I noticed that the walking views MUST have one of the idle (standing) sprites in frame 1 for the animation to work properly in-game. While this seems a little 'backwards', Chris has suggested that theres not much gain to be had by changing the way this works.
(However if transition views were indeed implemented, then I imagine this step would become unnecessary.)
The resulting view structure:
Views:
- Idle: stationary and/or blinking character
- Walking: walking frames only
- Transition: frames that are called in sequence before walk views are played. (smooths out transition from standing still to first walking frame)
I think this would be a suburb feature for AGS 3.0.
Cheers,
Paul.
Well, I know a lot of people have been telling you that you can do several of your suggestions easily in ags already, and in this case I will say that you definitely can.
Basically, what you can do is create a function that examines the player's (or any character's) movement status (.Moving) and goes down a basic if/else check to see which state is just occurring.
For example:
int stop_transition = 0; // a global variable to keep track of whether the stop animation has been used.
if(cSubspark.Moving== true && stop_transition==1)
{
//we want stop_transition to be 0 now so it will play the next time you stop
stop_transition=0;
}
else if(cSubspark.Moving == false && stop_transition==0)
{
//he's just stopped moving, let's run an animation of him stopping based on the
//current loop
int curr_loop == cSubspark.Loop; //down =0, left = 1, right = 2, up = 3
//play the animation for him stopping slowly
//
cSubspark.LockView(SUBSPARK_TRANSITION);
//can make this blocking or not, it depends on you
cSubspark.Animate(curr_loop,5,eOnce,eNoBlock,eForwards);
cSubspark.UnlockView();
//set stop_transition to 1 so this transition animation cannot be run again until the character starts moving
stop_transition=1;
}
Basically what this should do (I haven't actually tested this, yet) is check cSubspark for movement every time it is called (you could put it in repeatedly_execute to ensure it happens regularly). The moment it detects that he's stopped moving AND has not been stopped already it runs a transition animation in SUBSPARK_TRANSITION using the same loop layout as his walk cycles, so if loop 0 is walking down then loop 0 in SUBSPARK_TRANSITION is him stopping while facing down. Once it plays the animation it will then set the stop_transition variable to 1 so it does not repeatedly play the animation and will continue to bypass these loops until cSubspark moves.
To have a transition to walking you'd check for a start_transition variable or something like that. It might require some fiddling to get the animation timing just right, and you'd probably want to make the function able to check any character, but I'm pretty sure it would work.
I managed to get it to compile by removing one of the = from the int however upon running the game it crashes due to the following line:
cSubspark.Animate(curr_loop,5,eOnce,eNoBlock,eForwards);
While this may be done in code I still stand by my suggestion towards having a built in system for a future version of AGS.
Any ideas?
Cheers,
Paul.
Since V3.00 is already at RC stage, I don't think these kind of features will be added (that's also why CJ asked you to start a new feature-request thread instead of posting it in the V3 thread).
I think this may be useful sometimes, but doubt whether many people will use it (that also means EXTRA work when making sprites).
Moreover, your suggestion would mean basic changes to how stuff are implemented, which is not very preferable as it can break backward compatibility.
I have an idea, maybe, instead of using separate views, use the same view for everything like how it is done currently, but you have an option to choose the number of "easing" frames, which is nothing more than an extra integer parameter for each character:
1. When it is set to 0, there'll be no "easing" frame, so when the character stops walking he stays at that frame of graphics instead of displaying the stationary frame (may be useful to simulate the effect of say, some earlier AGI games).
2. When it is 1 (default), that means it has one "easing" frame, which is the standing frame, this is identical to what we have currently.
3. When it is larger than one, we can have several frames of "easing" animation to transist into the walking animation. Say, when the parameter is 5, then when the character starts to walk, the animation in frames 0-4 would be played (with frame 0 being the standing frame) and then cycle through 5 and the last frame while walking.
Anyway, though I can't speak for others, I have doubt on whether there're many people who need this feature to warrant it an addition of high priority.
High priority no. But something worth exploring for future versions, I believe so.
You've raised some interesting points, btw.
Is what your suggesting the same as what ProgZMax wrote? I'm not sure what you mean when you say,
Quotewhich is nothing more than an extra integer parameter for each character:
Cheers,
Paul.
No, what I suggested was a possible feature upgrade (as opposed to the method you suggested), not a scripting workaround.
Oh I'm on the same page now. Thats actually how I originally imagined it would work until I thought about the separate views thing.
Good suggestion Gilbot. If we could add this feature without incurring any collateral damage on the current system then it's definitely something to look into for a future version of AGS. Would you agree Chris?
Cheers guys,
Paul.
Personally, I'd rather CJ spent his valuable time enabling people to do things that can't be done by scripting, rather than hard-coding what a module could do into the engine.
Well I imagine its pretty low on the list of priorities anyway, SSH but we'd be wrong to rule it out. :)
Cheers,
Paul.
One thing you must do is ensure that all the loops in question are filled, because if curr_loop moves to something that isn't there it will crash. You can further protect the code by checking to make sure the current cSubspark view is set to your SUBSPARK_WALK view (or whatever you want to call it) and to make sure all the walking loops (4 or 8 depending) are full. All 4 or 8 loops of the transition view will need to have sprites in them as well :). If it still crashes, pm me the error or something.
Something that has been suggested before (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=472) was the ability to mark a Start and End frame in the walking loops, such that any frames before the Start frame would be played as a transition into the walk, and after the End frame would be played as a transition out of the walk.
However, this isn't as easy to implement as it sounds. Because the movement could end at any time, how do you go from a random walking frame to the stopping transition smoothly?
In the case of relatively small walk cycles, I suppose it could just play out the sequence and then transition, but this would not be as practical for a walk animation with many frames.
Quotehow do you go from a random walking frame to the stopping transition smoothly?
Thats a good point CJ. I imagined that the transitions would only be necessary for starting rather than both starting and stopping. But if one is willing to draw xx sprites ;) ...
Cheers,
Paul.
Quote from: ProgZmax on Tue 04/12/2007 21:59:55
In the case of relatively small walk cycles, I suppose it could just play out the sequence and then transition, but this would not be as practical for a walk animation with many frames.
Potentially, but if it played out the full sequence then you'd end up with the character standing on the spot animating when he'd already finished moving.
QuoteThats a good point CJ. I imagined that the transitions would only be necessary for starting rather than both starting and stopping.
I think this would look even stranger, because you'd have a smooth start to the walk and an abrupt end; it would probably result in more complaints than doing nothing!
I think your right Chris, about developers complaining that there isn't any transition out. Having said that there are alternate ways to go about this.
For example, in a moderate length walkcycle there are about 3 or 4 frames during the course of the animation where one transition would look smooth enough for those three frames to be undetectable by the player. The player could indeed 'walk' through enough frames to reach one of the transition friendly frames. To stay true to the point at where the user clicked, the movement speed could slow slightly to compensate. This might all sound too complicated but it's the only way I can think of to accommodate transitions for starting AND stopping.
Cheers,
Paul.
If one wanted to go ALL the way, one would have to find a way to get the engine know when the character's foot has reached the ground. If it has and the next step would end character movement with a foot in the air, DON'T take that next step and instead play the "stopping" animation.
Kinda like Broken Sword. I once asked here if it was possible, but only as a hypothetical exercise. I remember being told that it was, and I left content.
Make of this what you will. Seems like a rather insane amount of work for a visual effect, but then again, it IS a purty damn nice effect.
QuoteSeems like a rather insane amount of work for a visual effect, but then again, it IS a purty damn nice effect.
Your not wrong there Rui. It sure is a visually pleasing aesthetic to a game. So you beleive what i said above can be done with some effort? Does anybody know how they tackled this for Broken Sword?
EDIT:Quoteone would have to find a way to get the engine know when the character's foot has reached the ground.
Actually this could be acheived with the suggested foot plant plugin from this thread:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=33099.20 (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=33099.20)
You could set states besides offset coords for each frame like foot down or leaning forward and you could draw your actions from there.
Do you like where I'm going with this Chris?
Cheers,
Paul.
Quote from: Rui "Trovatore" Pires on Thu 06/12/2007 09:43:59
If one wanted to go ALL the way, one would have to find a way to get the engine know when the character's foot has reached the ground. If it has and the next step would end character movement with a foot in the air, DON'T take that next step and instead play the "stopping" animation.
But this would'nt work either. Suppose that the character's foot has just reached the ground, and there are 2 more game loops before he stops.
Even if at this point it switched to the stopping animation, unless that animation happened to have 2 frames in it, it would still look strange.
Am I correct that the x- and y-speeds are handled as floats internally?
If I am, the walk speed could be slightly adjusted so the character will reach the end point at exactly the right frame.
Say the x speed was 3 and the character is going to walk 100 pixels straight to the right using 6 frames.
With the current system he'll reach the 90th pixel using the 6th frame, then 1st @ 93, 2nd @ 96, 3rd @ 99, standing frame at 100. Thus, the animation jumps from the middle of the walk-cycle right to the standing frame.
AGS could calculate the two boundaries (90 & 108), choose the closer one (108) and adjust the x-speed of 3 to 3*(100/108)=2.77.
The downside is that this will screw up elaborately drawn walk-cycles and won't look too good with short distances.
QuoteThe downside is that this will screw up elaborately drawn walk-cycles and won't look too good with short distances.
Your right about that. In my suggestion above I mentioned decreasing the movement speed and increasing the animation speed by 1 or somesuch but the success of this is entirely dependant on how far the player travels. Darn. I can't beleive that didn't hit me. :-[ Late nights.
Paul.
Perhaps I've misunderstood, but I don't understand why this needs to be so complicated. I've cobbled together a stopping animation which I think almost works:
http://www.2dadventure.com/ags/Stopping.zip (http://www.2dadventure.com/ags/Stopping.zip)
(Walk left!)
For the left view there are two stopping animations: one with the left foot starting in front and one with the right foot starting in front. It is possible to move from any walking frame relatively seamlessly to one of the first few frames of each view.
Because it isn't possible, as far as I'm aware, to animate a segment of a view I have to set the frames manually so it's a blocking script.
The big problem with it is that AGS still displays the standing frame for a fraction of a second once the character stops. I tried altering the standing frame, but it still displays the old sprite for a fraction of a second.
If AGS allowed us to animate a segment of a view and to switch off standing frames, I think this would work quite effectively. Please let me know if I've overlooked something.
You could quite easily make your own walking function that includes walk speed and such and then add in this functionality to it, Ali. Then you wouldn't 'need' a standing frame at all, just a check to see if the character has stopped moving and then you would handle it accordingly (do the transitions).
That's incredible Ali!
I can't beleive what i'm seeing. How is that possible!? :o
Edit: A plugin for custom character movement might ultimately be a good idea. Maybe instead of reinventing the wheel, we can handle walking movement using a completely different approach. The current AGS walking/movement system has been around for ages. Perhaps we can experiment a little.
Paul.
Quote from: ProgZmax on Fri 07/12/2007 23:36:38
You could quite easily make your own walking function that includes walk speed and such and then add in this functionality to it, Ali. Then you wouldn't 'need' a standing frame at all, just a check to see if the character has stopped moving and then you would handle it accordingly (do the transitions).
You're stretching the word 'easily' a little there! If I created my own walking function wouldn't I be constrained to using 320x200 co-ordinates, making hi-res games look poor?
While I would
love to have control over transition animations and turning animations in AGS I'd rather not depend on a plugin, because it would render the game windows-only if it was used for something as central as walking.
No, you wouldn't be limited to any set screen size as long as you kept an eye on viewportx and viewporty :).
Hmm, I guess the question is, does it matter if the character stops moving while the stopping animation is played? If it doesn't then that would be easy enough to add.
Quotedoes it matter if the character stops moving
What do you mean Chris? I though the character is supposed to stop moving while the stopping animation is played. You wouldn't necessarily need an 'ease down' to a halt. You could just stop movement suddenly and rely on the animation to do the easing as Ali has demonstrated.
Cheers,
Paul.
Quote from: Pumaman on Sat 08/12/2007 22:13:44
Hmm, I guess the question is, does it matter if the character stops moving while the stopping animation is played? If it doesn't then that would be easy enough to add.
I think Paul's right. I doubt this would matter because the animator's hand should be quicker than the eye. It won't always be perfect but it'll rarely look bad. And if the character is animated carefully it will
always look a lot better than snapping to a stopped position.
The important thing on the authors side is to produce two different stopping animations, one with each leg in front. The character should come to a stop in a manner that resembles the walking animation as closely as possible fior the first 3/4 frames.
The important thing on the editor/scripting side is choosing the right view and beginning the animation on a different one of those 4 frames depending upon the 'out' frame of the walking animation.
I might be able to modify my script using timers to prevent the stopping animation from being blocking, but I'm still uncertain of whether I could get rid of the standing frame flicker. through scripting. If this was a simple thing to implement in the editor I would find it a real boon.
As I said above, animated turning is another thing that I would find
extremely useful, and have failed successfully to script. Would that be a difficult thing to have built-in to AGS? I'm sorry to be piling demand on demand, but aesthetic features like these are the ones I'm most interested in.
Quote from: ProgZmax on Sat 08/12/2007 20:17:11
No, you wouldn't be limited to any set screen size as long as you kept an eye on viewportx and viewporty :).
I'm sorry, I wasn't meaning 320x200 room size. I meant that I think a character in a 640x480 game would move in double-pixel jumps if its X/Y values were altered by a module script. Or am I confused?
If I'm understanding you right, a custom walk function could move at any rate (within reason) you wanted, and not just 2 pixel jumps for higher resolutions. There's more to the movement than just adjusting x and y values, of course; you'll need to factor in animation delay and movement speed if you want some characters to move faster than others, but it's entirely possible to have a character moving at one pixel per loop :). If I have some time today I'll get a working function together and post it here for you, ok?
If you have the time that would be very useful. I'm afraid it sounds beyond my scripting capability!
Sounds interesting. It's something I'll certainly consider for a future version.
Here's a short demogame: http://www.2dadventure.com/ags/CustomWalk.zip
The first custom mode adjusts the frame offsets so the character wont jump to the standing position from the middle of the cycle.
The second one additionally updates the character's position every frame.
(Obviously, both versions ignore (non-)walkable areas.)