Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Besh on Thu 02/03/2006 08:02:54

Title: where AGS stores the path info
Post by: Besh on Thu 02/03/2006 08:02:54
Excused if I post here but I didn't know who to address.

I'd like to know where/what AGS stores the info about the character walk and if they are usable from the script orÃ,  from the plugin interface???

eg.
When I click on the screen in WalkToMode the engine calculates the entire path then looks for collision or simply stores only the destination point and updates the positionÃ,  every cycle or ...?Ã,  ???

Title: Re: where AGS stores the path info
Post by: Pumaman on Thu 02/03/2006 18:31:21
Currently you cannot access the character's movement path, because nobody has ever wanted to do so.

What sort of thing would you want to do with it?
Title: Re: where AGS stores the path info
Post by: Besh on Thu 02/03/2006 23:31:16
As you'll sure have understood, every question that I make is turned to the improvement of the Character3D plugin.

Currently I'm trying to solve two problems:

1) the character turns itself in strange positions for the distance to carry out (8 directions are enough in a 2d world  but not in a 3d one)

2) the speed of the character doesn't diminish with the distance

I think that to be able to use such variable can solve this problems, an alternative could be to put a new event (I'm talking about the AGS plugin API) between  AGSE_PRESCREENDRAW and AGSE_PREGUIDRAW in which the position and in a generalized manner all the variable relative to the character are updated and the character has not been still painted.

eg.
...
Call AGSE_PRESCREENDRAW
update variable
Call AGSE_NEWEVENT
Draw objects and characters
Call AGSE_PREGUIDRAW
...

I do not know...
...what do you think?
Title: Re: where AGS stores the path info
Post by: Kweepa on Fri 03/03/2006 00:30:22
For (2) you could use the continuous scaling of walkable areas combined with the "Adjust Speed With Scaling" checkbox of the character.

Although obviously if CJ somehow gave you access to the characters' pathfinding path point array you could move and rotate the character much more smoothly.
Title: Re: where AGS stores the path info
Post by: Besh on Fri 03/03/2006 09:02:19
QuoteFor (2) you could use the continuous scaling of walkable areas combined with the "Adjust Speed With Scaling" checkbox of the character.

I have tried to use those property but it is complicated setting them in a correct way, specially for the people who uses C3D.
I'd like to do an automatic procedure, transparent for the user, tha solve this problem.
Title: Re: where AGS stores the path info
Post by: Pumaman on Sat 04/03/2006 11:08:55
So what would you want? Just access to the X/Y array of the waypoints in the character's movement path?
Title: Re: where AGS stores the path info
Post by: Besh on Sat 04/03/2006 12:38:38
Yes... maybe... I don't know

The question is?? In the X/Y array of the waypoints in the character's movement path there's stored only the final point or also all the intermediate ones (I'm sorry for my English).
eg.
If I write player.walk(x,y) in the array there's only the point(x,y)??

However I think that acces the X/Y array of the waypoints in the character's movement path can solve my problem.Ã,  :)
Title: Re: where AGS stores the path info
Post by: Pumaman on Sun 05/03/2006 13:06:58
When the Walk() command is called AGS calculates the path and stores all the waypoints such that the character can move in a straight line between them in order to reach his destination.

Would you want to be able to change these, or just to read them?
Title: Re: where AGS stores the path info
Post by: Besh on Sun 05/03/2006 22:23:00
I hoped worked in this way.  ;D

It would be better to be able to modify them.

Thanks very much!!
Title: Re: where AGS stores the path info
Post by: Pumaman on Mon 06/03/2006 20:23:45
AGS stores the X/Y co-ordinates of each waypoint, as well as the character X & Y speeds necessary to move between each point; so as long as you didn't modify the current one that the character was currently moving on, it would probably be ok...
Title: Re: where AGS stores the path info
Post by: Besh on Mon 06/03/2006 22:06:21
Do you think to put these variable accessible only from the script or also from the plugin?
Title: Re: where AGS stores the path info
Post by: Pumaman on Tue 07/03/2006 21:45:08
I would say this should only be available from plugins, I don't think that the game script should ever be fiddling with something this internal; unless anyone has any objections to that?
Title: Re: where AGS stores the path info
Post by: Besh on Tue 07/03/2006 22:34:02
Ok, thank you very much.
Title: Re: where AGS stores the path info
Post by: Scorpiorus on Wed 08/03/2006 14:09:13
Hehe, once I needed to know the destination X,Y co-ordinates calculated by the pathfinder, before a character actually starts moving. But I have to admit that were under quite specific circumstances -- I used it to implement a certain puzzle, if I recall correctly.

I workarounded it by using another invisible dummy character to fastly go though the same path before. That forced me run the pathfinder routine twice in a row, though.

I can see a situation when one may find it useful to look for such data (well not the whole path array or speeds, but destination X:Y) to, for example, mark location where the player character is going to move to. If that's how user interface is designed to assist players in some way.

Anyway, probably it's not something to be used frequently and even if it is, we can always use plugin API to retrieve the necessary info.