Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: deltree on Sat 27/12/2003 23:01:26

Title: about character view
Post by: deltree on Sat 27/12/2003 23:01:26
hi,
I've asked many times here about that question, but still I don't have an answer:
I want my character to do a specific animation (crouching).
This animation consist in only 1 frame.

I know I could use "animatecharacter(...)' to do it, it would be very simple.
unfortunately, this only frame would "lock" a whole loop, since "animatecharacter" works with a full loop.
my characters will need many animation loops, for specific actions.
he can crouch right, left, lay down, jump (left and right....)

if I use "animatecharacter" I will need a lot of loops.

loops are limitated for 1 view. (15 loops per view)
So, I will need to create others animations on other views.
my character will stand on many different views, it's gonna be quiet hard to create animations.

there's an excellent function called "setobjectframe" that allow to chose a specific frame from any loop for an object.

there's no function like this for a character. this could be so simple...

How can I deal with this problem easily?
Title: Re:about character view
Post by: Scorpiorus on Sat 27/12/2003 23:17:07
hello,

QuoteHow can I deal with this problem easily?
Well, if it's just one frame you could probably alter the character[].frame variable. :P

Title: Re:about character view
Post by: deltree on Sun 28/12/2003 13:02:03
hi,
I've tried this already, but , has the help file said, the "character[..].frame" must not be modified.
it does some strange results, sometimes it doesn't work, it display the wrong frame.
Title: Re:about character view
Post by: Scorpiorus on Sun 28/12/2003 16:09:07
Yeah, it's a read-only global var but sometimes appears to be a good workaround. What do you mean with strange results? Whenever I tried to change that var it works fine. Of course the character shouldn't be animated or moved at the same time. Here is a little function a made for blocking one-frame animation:

function AnimateCharacterFrame(int CharID, int speed, int view, int loop, int frame) {

StopMoving(CharID); // <EDIT>

//saving old values:
int old_view = character[CharID].view;
int old_loop = character[CharID].loop;
int old_frame = character[CharID].frame;

ChangeCharacterView(CharID, view);
character[CharID].loop = loop;
character[CharID].frame = frame;

int timer = speed;
while (timer>0) {
Wait(1);
timer--;
}

//restoring original values:
ChangeCharacterView(CharID, old_view+1);
character[CharID].loop = old_loop;
character[CharID].frame = old_frame;

}

Doesn't it work?
Title: Re:about character view
Post by: deltree on Sun 28/12/2003 20:45:12
in my game, on one loop, there are multiple frames, for different actions.

- on the 1st frame, the character knees, on the second , he lays down, on the 3rd, he jumps.

As you can see, there's absolutely no link between these frames, they are not meant to be played continuously:

In the scene I'm working on, the character is suposed to be kneeing.
so I use the first frame.
when I run the game, the game display the second frame, instead of the fisrt frame.( the character lays down instead of kneeing).
I first thought I used the wrong parameter, So I chose "frame 0" instead of frame 1. it still displays the same fucking frame, the character laying down.
sometimes, it depends, it displays the character kneeing properly...
I really don't understand, it looks like it doesn't work , or works weirdly!
Title: Re:about character view
Post by: Scorpiorus on Sun 28/12/2003 21:24:08
And with the function I posted the same result? :P
Title: Re:about character view
Post by: Chicky on Sun 28/12/2003 21:35:11
im no expert but couldnt you have a different view, 1 for each crouching frame so when you want him to crouch on which ever hotspot choose the right view and use animatecharacter ?
Title: Re:about character view
Post by: deltree on Sun 28/12/2003 23:02:57
yes, it's possible to do that, but since I've a lot of different animation for this character, I'm gonna need a lot of view.
there are plenty of characters in my game that have many different animation, that can be played in many different ways.

in the end, there won't be enough possible views, and most of my characters will have there animations frame in so many different view...it's gonna be a terrible chaos for choosing the right frame.

Anyway "animatecharacter" doesn't allow me to move the character while he is animating.
Title: Re:about character view
Post by: deltree on Sun 28/12/2003 23:07:01
Quote from: Scorpiorus on Sun 28/12/2003 21:24:08
And with the function I posted the same result? :P

didn't tried yet.
anyway,since it uses the same "character[].frame" that didn't work....
Title: Re:about character view
Post by: Scorpiorus on Sun 28/12/2003 23:11:50
hmm, if you want to be able to move him also then it won't work in either way. Keep in mind you shouldn't alter character[].frame variable while the character is moving or animating, it doesn't work.
Title: Re:about character view
Post by: a-v-o on Mon 29/12/2003 06:10:41
Why don't you use objects instead of characters?
Title: Re:about character view
Post by: Squinky on Mon 29/12/2003 08:01:10
Okay, why don't you just give each of these actions there own views, then if you fill up all fifteen just start up another view and use setcharacterview?

Am I missing something?
Title: Re:about character view
Post by: deltree on Tue 30/12/2003 21:26:57
Quote from: a-v-o on Mon 29/12/2003 06:10:41
Why don't you use objects instead of characters?


I've tried it already:
But what I want to do is have the most "clean" code possible. I mean, if I want to play my animation, I need to do all this:

-hide the character
-position the object
-give the object the proper frame
-wait for a while...
-hide the object
-display the character again.

It would be so simple if I could do:
setcharacterframe(character,view,loop,frame) you see?

this function exists for an object, why not for a character???
Title: Re:about character view
Post by: deltree on Tue 30/12/2003 22:30:33
Quote from: Squinky on Mon 29/12/2003 08:01:10
Okay, why don't you just give each of these actions there own views, then if you fill up all fifteen just start up another view and use setcharacterview?

Am I missing something?

ok, that's what I'm doing for now.
but, to me, It's not a smart solution.
it's a waste of place, a waste of views.
some animations (such as crouching) consists in ONE frame only. it would be so simple to have these "one frame animation" on the same line. it would be easier to pick up the right frame when it's needed and have only 1 view for 1 character.

Some animations are using almost the same frame compared to others. it's stupid to have to redo almost the same animation if only 1 frame is changing.
Title: Re:about character view
Post by: Squinky on Wed 31/12/2003 04:01:47
Okay, that makes sense. Hopefully it'll be one of those things that Chris might take a look at later....I mean, the man gave us the ability to flip a view in the editor, instead of having to import a whle bunch of the same frames just flipped, you gotta give him credit for that right? heh....

/me thinks back to dos version days

Title: Re:about character view
Post by: deltree on Wed 31/12/2003 15:07:09
when you talk about "flipped" view, that's exactly what I mean:
before the "flipped" view was allowed by AGS, everybody had to create manualy a flipped view of his character.
Waste of time, waste of memory for the game, more complicated.

Now, this option seems obvious and natural for us.

The function I'm talking about seems more obvious again, to me.
premade script are good for beginners, but when it comes to make your own game, everything needs to be set up by yourself.

A "walking animation" for example, is generaly a standard thing.
When the player walks to the left, then, he must generaly look like he walks left.
But, for some reason, sometimes we want it to walk backward, or walk in a different way....

Anyway, I'm not critisising chris work, since it's the most amazing and fun free software I've ever seen!

ho, again: merry christmas!

Title: Re:about character view
Post by: Pumaman on Thu 01/01/2004 15:08:53
So can we just clarify what your request is here?

A SetCharacterFrame function? If so, then that sounds reasonable enough, I'll add it to my list.

Did you want to be able to move the character while it was locked to this frame?
Title: Re:about character view
Post by: Scorpiorus on Sat 03/01/2004 15:32:32
QuoteDid you want to be able to move the character while it was locked to this frame?
Would be very handy I suppose. Altering the .frame var worked just fine to me (maybe it doesn't work under certain conditions, though) unless the character is moving of course, when the engine sets his frame regarding his current direction.

~Cheers
Title: move the character while locked in a frame
Post by: deltree on Sat 03/01/2004 16:14:13
yes.
indeed, I think everyone needs much more control over characters animations:

--a "setcharacterframe" function for example.
--a "movecharacterframe" that would allow to move the character while locked in a specific frame, as you said.
--a "moveanimatedcharacter" that would allow to move a character while animating a specific loop, (why not? )

I think these functions would help to create easier animations...

Ho, again:
I think it would be very cool to think again about 3D representation, I don't mean a 3D engine, but, to allow us, or even make a tutorial about it)
something like a isometric view, or , for a given character, not only X and Y view, but a third coordinate: Z, the dept.

this would allow jumping over things, climbing, walking on different floors...
the Z axis would work for object too!
it would make easier and more natural the "walk behind" aspect.
Title: Re:about character view
Post by: Pumaman on Fri 09/01/2004 23:09:20
Hmm - what about if while the view was locked (ie. between SetCharacterView and ReleaseCharacterView), the default walking animation wasn't used? This would seem a more intuitive way of doing things (thus it would stay on whatever frame you locked it to, or continue playing a seperate animation, or whatever) - however, changing this would have the potential to break people's scripts.

Title: Re:about character view
Post by: Scorpiorus on Sat 10/01/2004 00:07:53
I like the idea. And I hope people use ChangeCharacterView() command to set char's walking view. Btw, will that command unlock the frame or should we put ReleaseCharacter before, following the warning message?
Title: Re:about character view
Post by: Pumaman on Sat 10/01/2004 00:30:40
ChangeCharView doesn't currently unlock the view. The warning is because you shouldn't really be using a Change while the view is locked - finish the animation first, release the view, then you can Change it.