Turning Diagonal pathfinding off?

Started by Molin, Tue 12/08/2003 22:09:16

Previous topic - Next topic

Molin

Hi all,
hm  I have looked through every bit of info i could find. AM I missing something or have none asked about only having 4 views for the pathfinding?? That is, only to have the top,left,right and down directions for character movement.

Anybody has any hints or pointers on  how to do this i would appreciate it.

thx
/Molin

MrColossal

do you mean turning off the entire ability of the character to even move diagonaly?

or stopping the game from running diagonal animations when there is none?

there should be a checkbox in the character display, right about the character image that says "no diagonal walking views" or something

which do you mean?
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

scotch

I made an extensive post about this >:| my connection is being really bad.

I think they mean BASS style walking, only walking up or across and ive needing to go on a diagonal moving in an L shape.  AGS can't do that by default, although it sounds like it might be possible to script.. not easy by any means though.

Archangel (aka SoupDragon)

Yeah I noticed as I was playing BASS how nice the walking was, no sliding diagonally, and I thought "wouldn't that be a good feature in AGS" *nudgenudgeCJ*

MrColossal

i hated the walking in BASS, walking around someone was so annoy-noy

i have an idea maybe i'll play around with it

eric
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

Molin

#5
wow great replys.  thx for the transfer admin....

hm yes A L shape pathfinding like BASS is exactly what i meant.
Ill look into scripting this as well.

Perhaps some issues if you have wery narrow diagonal walkareas. HOWEVER that is a layout and design issue if one wants this "L" system.

MachineElf

#6
I can think of something like this.
Some global variables first:
int walkmode = 0, x, y;


// in click script, when walk to is launched:
x = mouse.x;
y = mouse.y;
walkmode = 1;

// in rep exec:
if (walkmode == 1)
{
MoveCharacterStraight (EGO,character[EGO].x,y);
walkmode = 2;
}
if (walkmode == 2 && character[EGO].walking == 0)
{
MoveCharacterStraight (EGO,x,character[EGO].y);
walkmode = 0;
}


In this script the character always walks to the y-coordinate first. You could easily do it the other way in case the x coord is closer than the y coord with a simple if/else statement based on the coords and the character coords.

Don't know if this will work, but it's worth a try, I guess. Might be a start.
There are 10 kinds of people in the world: Those who understand binary and those who don't.

Molin

#7
hi .
hm i tried this in a wery similar way yesterday and had some trouble when it hits a obstacle on the way. Also some trouble when having a scrolling screen.
What coords are used here for everything..? Charactermovement is Screencoords? Mouse is room coords??



Gilbert

Nope. Character/object movement/placement is room coordinates, mouse position is screen coordinates.

In general,

room x = screen x + viewport x
room y = screen y + viewport y

Molin

thx Gilbot.
Ok now it works with scrolling rooms if X and Y var i set like this,
x = mouse.x+GetViewportX();
y = mouse.y+GetViewportY();


Molin

ha a really nice hack this...;))

Anyways it walks sick sack on diagonal walkareas now such as stairs....;D.. UGLY but exactly what i wanted..

ITS STILL not in any way smart so i need to add smartest way prediction and so on..

but this works so far..

globals
int walkmode = 0, x, y, cX, cY;

function repeatedly_execute;
// put anything you want to happen every game cycle here

// <DM> X translation
if (walkmode == 1 && character[EGO].walking == 0 && character[EGO].x != x)
{
 // <DM> For every gamecycle collect character X,Y pos.
 cX = character[EGO].x;
 if (cX < x) { cX = cX+1; } else { cX = cX-1; }
 MoveCharacterStraight (EGO,x,character[EGO].y);
  // <DM> For every gamecycle check 1 pixels ahead in X to se if its walkable
 if (GetLocationType( cX, character[EGO].y )!=0 )
 {
  // <DM> we are here if X is nonwalkable, start Y translation
  walkmode = 2;
 }
 if ( character[EGO].y != y )
 {
  //<DM> We are here if character havent reached X goal
  walkmode = 2;
 }
}

// <DM> Y translation
if (walkmode == 2 && character[EGO].walking == 0 && character[EGO].y != y)
{
 cY = character[EGO].y;
 if (cY < y) { cY = cY+1; } else { cY = cY-1; }
 MoveCharacterStraight (EGO,character[EGO].x,y);

  // <DM> For every gamecycle check 1 pixels ahead in Y to se if its walkable
  if (GetLocationType( character[EGO].x, cY )!=0)
  {
    // <DM> we are here if Y is nonwalkable, start X translation
    walkmode = 1;
  }
  if ( character[EGO].x != x )
  {
     //<DM> We are here if character havent reached Y goal
    walkmode = 1;
  }
}

function on_mouse_click(int button);
StopMoving(EGO);
 x = mouse.x+GetViewportX();
 y = mouse.y+GetViewportY();
 walkmode = 1;

Im off to hackl soms more!
WOA!
/Molin

MrColossal

i think when you decide that your characters will not move diagonally you really have to design the backgrounds to not make them move diagonally.

otherwise you end up with a character making little zig zags up and down diagonals, which is probably what's happening to you.

eric
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

Molin

#12
yes ofcourse..;)... BUT that was just to test the pathfinding. WICH sucks at the moment when trying to cross round things. BUt its all fun anyways.. I think i will get some help from the techs at my gamecompany to help me out. THAT way they can hack away to make it cool...

Ill post the functions here later when they are finsihed.
Later
/Molin

Pumaman

Helm asked for a feature like this a while back. It's not as easy to implement as it sounds though, and would probably involve some fairly extensive modification of the pathfinder. I'll have another think though.

SMF spam blocked by CleanTalk