Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Martin Sedlak

#1
Quote from: Crimson Wizard on Fri 08/06/2018 22:31:23
Since we decided to split AGS into "backwards compatible" and "future" versions recently, we are currently considering what to do with pathfinder in "compatible" branch: whether to keep your new pathfinder, revert to old one, or have both with a way to switch between them in config.
This is not very critical, in my opinion, since we don't know if there is such game that would be broken by new pathfinder in practice (making it impossible to walkthrough), but has to be decided at some point.
I see, I never thought that the new engine may be used to run old games. For WIP games close to release it's probably never a good idea to switch to new engine anyway,
no matter what has changed.
Of course if a script relies on a certain behaviour of the pathfinder then it can break existing games.
Also since old pathfinder allowed you to walk over 1px/2px gaps in some cases, such games (with incorrect walkable areas) may break as well.
It's impossible to make the new pathfinder behave like the old one simply because it may choose more or less different paths, so if full backward compatibility is a concern,
the only option is to either revert or make the two coexist, because you can never get rid of the old pathfinder in that case.
#2
Quote from: morganw on Wed 30/05/2018 21:36:43
I've found that switching between the engine builds can leave characters in a different position after walking, with the old pathfinder moving the character further (which was then causing a bounds check to fail). I probably need to re-test without the smooth scrolling module, but the difference in player.x was enough to cause me an issue.
This can happen if you click on a non-walkable area, the new pathfinder tries to get you as close as possible (unlike the old one).
Also the new pathfinder is pixel-perfect, old pathfinder did something like 3x3 pixel downsampling (or actually jumping over 3 pixels - I don't remember exactly),
so even one pixel gap is no longer walkable.
However, I think these features are actually useful and desired - even if it means adjusting game code when switching to the new engine, I hope it's still worth it :)
The new algorithm also does bidirectional path filtering when extracting waypoints, so the final paths should look a bit more natural (especially the last few segments),
old code did something similar but only in forward direction, probably not a big deal and barely noticeable.

The only drawback of the new pathfinder is increased memory usage (traded memory for performance), namely 8 times more than old pathfinder (read 8 bytes per walkable pixel),
so for example if your largest background is 3k times 1k pixels, the old pathfinder used 3 megabytes where the new uses 24.
This is still ok even on todays mobiles unless you use really huge backgrounds, but it's always good to understand the implications.
On the other hand, large (hires) areas is where the new algorithm really shines in terms of performance compared to the old one.

One potential solution would be to use lowres walkable bitmap, saving 4 times the memory by 2x downsampling in each direction, but I've no idea how much work it'd represent
in the editor and pathfinder glue code.
Maybe the best solution would be to switch to navmeshes instead, but this would add new challenges of its own and it would be a substantial amount of work, completely breaking backward compatibility...
SMF spam blocked by CleanTalk