Author Topic: Pathfinder  (Read 42231 times)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Pathfinder
« Reply #15 on: October 10, 2011, 08:31:42 pm »
maybe read LoFtemplates to determine how you can move?

Volutar

  • Guest
Re: Pathfinder
« Reply #16 on: October 11, 2011, 05:13:50 am »
LOFT? Really silly idea.

Volutar

  • Guest
Re: Pathfinder
« Reply #17 on: October 11, 2011, 09:18:57 am »
Well, i've altered AVENGER.MCD and U_EXT02.MCD. Now it have "wall" flag set to 2 or 3 for either one diagonal or another.
But there are some ugly tiles outthere.

As you know UFO uses concept of NORTH/WEST walls only. If you need to get SOUTH wall - you just put NORTH wall to south tile, that's all. But it doesn't work for outer UFO walls. They were made as actual SOUTH and EAST walls of tile, so they were decided to be used as objects with "wall" property to avoid diagonal crossing. As side-effect of this - unit cannot stand beside this wall. The reason of this decision, as I think, is "convex" profile of wall, so it's the only way to make them "protrudable" outside.

Daiky, what is rendered first - unit or object?
We could make another "wall flags" of objects - south and east walls, to be rendered after unit, and allowing standing on them, but not walking through (acting as north/west walls of adjacent tiles).

On attached pictures you can see nice diagonal walls allowing walk along them, but not through them. And unit can get behind double chairs at north side of UFO (in UFOEU unit can't get there). Avenger hole also was "fixed" (but i'm not sure about this, it could bad choice to do so). There are "cross" objects, which aren't diagonals, so they act as usual "wall" object of UFOEU. On UFO these cross "objects" are those south and east walls.
« Last Edit: October 11, 2011, 09:24:58 am by Volutar »

Volutar

  • Guest
Re: Pathfinder
« Reply #18 on: October 11, 2011, 10:05:37 am »
Okay. So "is_wall" boolean field of object tile basically was improved.
Was:
0=not wall
1=wall object (cannot pass by diagonally, cannot stand)

Become:
0=not wall (can be passed by in any direction)
1=wall object (cannot pass by diagonally, cannot stand)
2=/ wall (can be passed by from south-west to north-east)
3=\ wall (can be passed by from north-west to south-east)
4=east wall (translated into west wall of eastern tile, can stand)
5=south wall (translated into north wall of southern tile, can stand)
6=east+south walls (translated into north wall of southern tile and into west wall of eastern tile, can stand)

This format of MCD is compatible with classic UFO MCD (they don't care which value exactly, if not 0). But new pathfinder will work with it much better than classic. The only thing is left - is draw order of such pseudo-objects.

========
What about LOS? I think this flag also used for LOS calculation... LOS probably also slighly glitch for these walls (look along north or west side of UFO and see if these walls block the sight). So these improved flags could be used for LOS too.

========
On second screenshot - Floater soldier cannot go where cursor pointing to. In Classic XCOM1. Isn't that a gameplay bug?
« Last Edit: October 11, 2011, 10:14:04 pm by Volutar »

Volutar

  • Guest
Re: Pathfinder
« Reply #19 on: October 11, 2011, 02:05:13 pm »
All these improvements was made only with some of MCDs modifications, and improoved pathfinder. Maps kept untouched.
Objects meant to be under units, so draworder will draw objects first and units after, but objects-walls actually are in front of units, so draworder should also be fixed to handle these kinds of objects-walls.

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Pathfinder
« Reply #20 on: October 11, 2011, 02:24:43 pm »
Daiky, what is rendered first - unit or object?
Object. Take the skyranger ramp as example, the unit need to be rendered on top of that object.

Volutar

  • Guest
Re: Pathfinder
« Reply #21 on: October 11, 2011, 02:39:15 pm »
Thus rendering draworder tweak will be required in order to handle such wall objects.
« Last Edit: October 11, 2011, 02:52:31 pm by Volutar »

Volutar

  • Guest
Re: Pathfinder
« Reply #22 on: October 11, 2011, 10:01:28 pm »
There's another "outer wall" object which have "wall" flag... It used in "Terror Ship" (I guess it's the only place).

So I decided to add value=6 of this "wall" field. It's like value 4 + value 5 (both south and east walls).
I think that's too much but I dont see any alternative how to make this "object wall" path/view blocking shit fixed.

On bottom image there was an explosions happened, so why not all inner walls out there :)

I've made new application for this purpose. Now it loads UFO savegame ("game" folder) and can use it for "pathfinding". Although you may see every level, pathfinding works only on current level (still 2D). And it doesn't know anything about elevation and different TUs cost for moving (4/6TUs only).
https://volutar.eu5.org/ufomap.zip
« Last Edit: October 11, 2011, 10:13:07 pm by Volutar »

Volutar

  • Guest
Re: Pathfinder
« Reply #23 on: October 12, 2011, 02:32:20 pm »
Another finding.
Some of ground tiles have 0TUs cost, instead of 4.
The thing, is you can walk through them for free, but you cannot stop at them(!).
These tiles marked as crossed.
Actual testing: In source point unit has 47 TUs. It's behind the powersource. Destination point is 4 steps away from it. One of step is diagonal. So this path should consume 6+4+4+4=18TUs. But instead we have only 8TUs consumed. How's that? Two of those steps was made through "free" tiles, so only 4+4=8TUs been consumed.
In summary, I can say, there are ground MCDs which have abnormal behaviour:
1) They are free to move through.
2) You cannot go directly there, only walking through is possible.

Isn't that a bug? Doesn't it require a fix implying MCD modifying?
What should we do with it?
« Last Edit: October 12, 2011, 02:34:58 pm by Volutar »

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Pathfinder
« Reply #24 on: October 12, 2011, 04:41:11 pm »
A good topic to think about - how to implement MCD (and eventually MAP) files mods in openxcom.
Currently they are treated as "resources", while they actually ARE NOT, they are rulesets/datasets. And all other rulesets/datasets are now part of openxcom package instead of extracted from the game, like all the weapon info etc.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Pathfinder
« Reply #25 on: October 12, 2011, 05:15:07 pm »
There is no particular reason some things are called "resources" and others aren't, aside from keeping all the file loading in one separate place. I didn't really put much thought into it, the only reason stuff like weapon info wasn't loaded from original files was because IT'S A HUGE PAIN IN THE ASS (and kinda limiting). :P

Optimally you'd want all the game logic stuff in the Rulesets, while the ResourcePack (terrible name) should be for cosmetic stuff which can be swapped around without impacting the game (graphics/sounds/etc). I'm not sure where MCD/MAP/etc fall in this.

Volutar

  • Guest
Re: Pathfinder
« Reply #26 on: October 12, 2011, 05:20:14 pm »
Another glitch which easily can be fixed. Roof of Aventer. Have you ever walked on the roof? Are you happy with how units walk down roof? 1. Units actually falling into roof, instead of being elevated; 2. When trying to go away, he just flies up and then down, spending alot of TUs.
So obviously MCDs have alot of bugs inside which should be fixed.

Volutar

  • Guest
Re: Pathfinder
« Reply #27 on: October 12, 2011, 05:35:50 pm »
My opinion - we should use our OWN map format and OWN mcd format (which would handle more accurate LOFT objects). Don't know about images, probably we should use PNG images instead of pck's.
You may ask - and what's the point of using original UFO resources? There's no point! I think every game resource of original XCOM1 have bugs to be fixed. Original resources - just a temporary solution.

Though, YAML is not very good choice, specially for non-structured raw data like map (even for savegames). Or there should be some sort of RAW (base64) fields

Offline DaiShiva

  • Sergeant
  • **
  • Posts: 39
    • View Profile
Re: Pathfinder
« Reply #28 on: October 12, 2011, 07:54:11 pm »
Once the method of pathfinding is determined, it would make for good information to display in the map editor. What did you write the pathfind.exe in?

Volutar

  • Guest
Re: Pathfinder
« Reply #29 on: October 12, 2011, 08:24:45 pm »
It's written in Delphi. And it's not finished yet.
I think MAP editor don't need to know anything about pathfinding. It would be helpful if it shows how much TUs will cost for moving from one cell to another (neighbour one). Or at least TUs values for each selected tile element (and elevation which also used to block movement). Anyways it will require setting up movement type (walk/slide/fly).

By the way, there's another interesting thing about movement cost. For 2x2 units TUs cost counted for 4th sub-tile (south-east part of unit), although main part of 2x2 unit is 1st one (north-west).