Author Topic: [Fixed] Wrong Path Finding on landing assault ramp  (Read 455 times)

Offline hsbckb

  • Sr. Member
  • ****
  • Posts: 270
  • Gill Man
    • View Profile
[Fixed] Wrong Path Finding on landing assault ramp
« on: May 02, 2012, 11:57:57 AM »
I find a path finding bug for this game when a soldier is standing on the landing assault ramp:



I don't know why the soldier keep going back to the skyranger?




Others Information:

Open Xcom Built: built 2012-04-29 20:26

My System:
Windows XP SP3
Celeron 2.8GHz
2 GB Ram
Intel 82865G Graphic Controller
« Last Edit: May 18, 2012, 11:55:31 AM by Daiky »

Offline Zharik1999

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #1 on: May 02, 2012, 12:38:32 PM »
Have the same issue. It was one of the most memorable in original X-com :)

Offline hsbckb

  • Sr. Member
  • ****
  • Posts: 270
  • Gill Man
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #2 on: May 02, 2012, 01:04:54 PM »
This is one of the most annoying bug ;D

Offline Volutar

  • Hero Member
  • *****
  • Posts: 837
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #3 on: May 02, 2012, 01:24:59 PM »
Original XCom had a number of issues related to pathfinding. OXC works differently, but there is a thing, which make it slightly complicated: going upstairs without switching a level.
In original XCom they just go straight path for current level, and if this path will go through elevating tiles - unit will go different level. This was used for going upstairs without switching level up (this switch happen automatically when unit goes other level).
If it will be simple optimized a* path, it will go exactly where you pointed, but you will get tired of switching levels for going up or down. So to emulate original-like behaviour for this issue they've decided to autochange level at certain conditions.

If I remember correctly, this condition is (at least) "unit stands on elevated object (stairs)". So why it goes upper level.
They could add another condition, like "work only when pointing tile, adjacent to elevated", to avoid such issues, but in this case it will become something people haven't used to. And if you wish to go tile adjacent to elevated but lower level, it will go up.
I've deeply thinking of idea of how to make something logical and handy as original (for going upstairs without switching levels), and nothing worth of implemening crossed my mind.
You see, there are two options of situation when your unit is near stairs - to use them or to use not. How program can predict what do you actually want?

I can suggest you to rely on path hightlighting (though Daiky still haven't made it "hover" highlighting).
« Last Edit: May 02, 2012, 01:59:28 PM by Volutar »

Offline hsbckb

  • Sr. Member
  • ****
  • Posts: 270
  • Gill Man
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #4 on: May 02, 2012, 02:00:57 PM »
I can suggest you to rely on path hightlighting (though Daiky still haven't made it "hover" highlighting).

I agree with that solution.  Volutar, thanks for your detailed explanation.

Offline Zharik1999

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #5 on: May 02, 2012, 02:33:34 PM »
Fair enough, thanks. :)

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Hero Member
  • *****
  • Posts: 872
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #6 on: May 11, 2012, 09:05:17 PM »
I have debugged this today and looked at where in the code it decides to switch levels. While the explanation of Volutar is true, I see that this not a real case of "going upstairs without switching level". Because that should only happen only when you click on the tile immediatly behind the stairs. In the case here the destination is 4 tiles behind the stairs. So there is probably something else going on here.
I'll have look.

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Hero Member
  • *****
  • Posts: 872
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #7 on: May 12, 2012, 01:02:24 PM »
I found the error, it will be fixed next time I do a commit

Offline hsbckb

  • Sr. Member
  • ****
  • Posts: 270
  • Gill Man
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #8 on: May 17, 2012, 11:57:41 AM »
I found the error, it will be fixed next time I do a commit
Thanks!

Daiky, you are my hero!

Offline Zharik1999

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Re: Wrong Path Finding on landing assault ramp
« Reply #9 on: May 17, 2012, 07:00:56 PM »
It looks like we overcame this :)