[SOLVED] Walkable Areas spanning a scrolling room unresponsive

Started by jonesmarkphone, Mon 11/05/2020 19:05:15

Previous topic - Next topic

jonesmarkphone

Hi all - my first post so feel free to tell me if i have done anything wrong here. I did search the manual and forums but cant find this specific issue referenced sorry.

My problem goes as follows:

Walk-able areas all work perfectly on the room I am having issues with - except for a specific issue. I have found a solution that works but it isn't very elegant and is for want of a better word "CLUNKY".

Imagine you have a scrolling room (2560 x 720) and your character starts at the top right of the screen. He needs to walk in a "C" shape walk-able area from the top right corner (POINT A) to the bottom right corner (POINT B) when you click the left mouse button to walk. You can see point A and point B on the same side of the screen.

The walk-able area (the C Shape) extends the full width of the room - so not all of the walk-able area your character will use is on the viewable screen at once (1280 x 720). (The walk-able area is also split in three equal segments, all of which can be navigated perfectly in a manual arc or between any two points of the arc that are connected, and on the screen at once i.e. there is no issue with the set up of the areas)

My testing shows that if you attempt to walk from point A to point B in a single click, it will not respond. You have to instead tease the character along the walk-able pathway around the c-shape manually which works, but.... id rather the user clicks once to perform the task to head to point B.

My workaround for this is to test at what position my character is stood on the screen using the following:

Code: ags

Display("The player is at %d,%d.", player.x, player.y);


Then I use the values provided to create an if statement as below. This checks if the player is at or above a certain point on the curve, and then if they are above the test value, it gradually walks the player around the curve from point A to point B. If they are NOT above that value then do something else.

Code: ags

if (player.y >= 592) {
    
    player.Walk(788, 638, eBlock, eWalkableAreas);
    player.Walk(117, 614, eBlock, eWalkableAreas);
    player.Walk(1076, 543, eBlock, eWalkableAreas);
  }
  else
  {
    player.Walk(1076, 543, eNoBlock, eWalkableAreas);
    }


Now the issue with this is three fold.

1) Its a lot of coding for something so simple - so there is probably a better way that i am unaware of in my AGS infancy.

2) you HAVE to use eBlock for it to work at all, meaning that if this is a long pathway - the user has no escape if they clicked it by accident. I would rather avoid that. If you do not use eBlock, the character does not move.
PLEASE NOTE ALSO - if you use an eBLOCK script line to try and go directly from Point A to Point B - this also doesn't work  - you still need to navigate the curve in several steps.

3) if the path was more complicated then there would be many more variables of the y position to consider and even more code. (this needs applying to all clicks such as Talk To, Interact etc - that span the whole curve.)


Help, criticism, and ridicule where valid are all welcomed :) !!!! Thank you in advance.



Crimson Wizard

#1
Quote from: jonesmarkphone on Mon 11/05/2020 19:05:15
My testing shows that if you attempt to walk from point A to point B in a single click, it will not respond. You have to instead tease the character along the walk-able pathway around the c-shape manually which works, but.... id rather the user clicks once to perform the task to head to point B.

This is unexpected. Recently we added a new pathfinder, and tests showed it works pretty well with curved walkable areas. Perhaps there's still some issue with the scrolling rooms... Can you tell, what version of AGS are you using?

jonesmarkphone

Hello - and thank you for replying.

I am using 3.4.3 - it was the build i began this particular game with so I haven't as yet upgraded? Happy to try that first if you believe it to be patched!! :)

Do you know if there will be anything game-breaking if trying to open an older version in the newest?


jonesmarkphone

Hi everyone - resolved.

As mentioned by Crimson Wizard this issue is resolved in the new pathfinder.

I have now upgraded to AGS 3.5 - and the issue is thankfully not there. The game also functions the same as before (I was concerned it may break between versions like some UNITY games do)

Much appreciated for the help and super quick response.

Now i just need to figure out what all these fancy new things do :D :D

Cheers again

Crimson Wizard

#4
EDIT: Lol, whoops, you already upgraded while I was typing :)

Quote from: jonesmarkphone on Mon 11/05/2020 19:52:51
I am using 3.4.3 - it was the build i began this particular game with so I haven't as yet upgraded? Happy to try that first if you believe it to be patched!! :)

New pathfinder was added in 3.5.0, and it proved to be significantly faster in large rooms and with complex areas. I believe it's worth trying as an experiment.

Quote from: jonesmarkphone on Mon 11/05/2020 19:52:51
Do you know if there will be anything game-breaking if trying to open an older version in the newest?

I do not think there should not be anything critical, as AGS editor suppose to upgrade old projects. Maybe you will have to adjust "Script compatibility level" in general settings to 3.4.1 version to keep deprecated functions working.

Regarding pathfinding, practice showed there are some differences in how characters walk. This difference may seem only random, but some expectations of where exactly character ends up walking if it meets the obstacle may prove wrong. It's hard to explain, but for example, if you wrote conditions like "if (player.x == 123 && player.y == 456)" to test when character reached exact point may fail, as character stops 1-2 pixels away from that. I think it mainly happens if Walk command was ordering to move to unaccessible place. Morgan Willcock (another dev) knows better as he was experimenting with this problem.

jonesmarkphone

Honestly the help is appreciated!

I have a larger game area which did have some minor issues also - will see if this update has resolved those too in a mo :)

Such a brilliant tool! Thanks again for your help and the insight - always helps. Do i need to do anything in particular to mark the  thread as solved?

Crimson Wizard

Quote from: jonesmarkphone on Mon 11/05/2020 20:15:56
Such a brilliant tool! Thanks again for your help and the insight - always helps. Do i need to do anything in particular to mark the  thread as solved?

You can add "[SOLVED]" to the topic title.

SMF spam blocked by CleanTalk