Page 1 of 1

should we be using QTPFS?

Posted: 01 May 2021, 22:47
by raaar
https://springrts.com/wiki/Modrules.lua ... nderSystem
int pathFinderSystem  default: 0 New in version 85.0

Which pathfinder does the game use? Can be 0 - The legacy default pathfinder, 1 - Quad-Tree Pathfinder System (QTPFS) or -1 - disabled.

float pathFinderUpdateRate  default: 0.007 New in version 98.0

Controls how often the pathfinder updates; larger values means more rapid updates.
my game has been using legacy, so does ZK and BAR.



On this post gajop wrote that it crashed when he tried to use it, but may be outdated or depend on context

There was also this issue which has apparently been fixed:
https://springrts.com/mantis/view.php?id=5936

I've tested enabling QTPFS for a 2v2 game between ais and it apparently worked properly. Not sure about how it performs relative to the default.

Any opinions?

Re: should we be using QTPFS?

Posted: 01 May 2021, 23:20
by Forboding Angel
Well, despite repeated pleas, kloot refused to explain his settings in order to achieve the awesome movement he got.

However, if you want flowfield style movement, you can have a look at this. I have some videos on some movement thread here showing how awesome this pathing is, but fucked if I can be bothered to find them.

Flowfield and unitheat are the MVPs here.

Code: Select all


if Spring.GetModOptions and Spring.GetModOptions().unitheat ~= nil then
	unitHeat = Spring.GetModOptions().unitheat * 0.0042
else
	unitHeat = 0.0042
end

flowMappingToggle = true

local genericDepthmodParams = {
		minHeight      = 0,
		maxHeight      = 5000,
		maxScale       = 1.25,
		quadraticCoeff = 0,
		linearCoeff    = 0, -- deprecates "depthMod"
		constantCoeff  = 1.25,
}

local amphibDepthmodParams = {
		minHeight      = 0,
		maxHeight      = 5000,
		maxScale       = 1,
		quadraticCoeff = 0,
		linearCoeff    = 0, -- deprecates "depthMod"
		constantCoeff  = 1,
}

local moveDefs = {

--Hover--

   HOVERTANK2 = {
      footprintx=2,
      footprintz=2,
      maxslope=30,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

   HOVERTANK3 = {
      footprintx=3,
      footprintz=3,
      maxslope=30,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   HOVERTANK4 = {
      footprintx=4,
      footprintz=4,
      maxslope=30,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   HOVERTANK5 = {
      footprintx=5,
      footprintz=5,
      maxslope=30,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   HOVERTANK6 = {
      footprintx=6,
      footprintz=6,
      maxslope=30,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   ORBHOVERTANK6 = {
      footprintx=6,
      footprintz=6,
      maxslope=30,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

--End Hover--


--hBot--

   HOVERHBOT3 = {
      footprintx=3,
      footprintz=3,
      maxslope=90,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=3,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   HOVERHBOT4 = {
      footprintx=4,
      footprintz=4,
      maxslope=90,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=3,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   HOVERHBOT5 = {
      footprintx=5,
      footprintz=5,
      maxslope=90,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=3,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   HOVERHBOT6 = {
      footprintx=6,
      footprintz=6,
      maxslope=90,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=3,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   HOVERHBOT8 = {
      footprintx=8,
      footprintz=8,
      maxslope=90,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=3,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

--End hBot--


--All Terrain--

   ALLTERRTANK3 = {
      footprintx=3,
      footprintz=3,
      maxslope=90,
      maxwaterdepth=30,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

   ALLTERRTANK4 = {
      footprintx=4,
      footprintz=4,
      maxslope=90,
      maxwaterdepth=30,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

    ALLTERRTANK5 = {
      footprintx=5,
      footprintz=5,
      maxslope=90,
      maxwaterdepth=30,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

   ALLTERRTANK6 = {
      footprintx=6,
      footprintz=6,
      maxslope=90,
      maxwaterdepth=30,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

--End All Terrain--


--Amphibious--
   TANK1 = {
      footprintx=1,
      footprintz=1,
      maxslope=30,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=0,
	  depthModParams = amphibDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=2,
	  depthMod=0,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   NORMALTANK2 = {
      footprintx=2,
      footprintz=2,
      maxslope=30,
      maxwaterdepth=10,
      maxwaterslope=26,
      badwaterslope=26,
      crushstrength=20,
	  depthModParams = amphibDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   TANK2 = {
      footprintx=2,
      footprintz=2,
      maxslope=30,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = amphibDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=2,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   TANK3 = {
      footprintx=3,
      footprintz=3,
      maxslope=30,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = amphibDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=2,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   TANK4 = {
      footprintx=4,
      footprintz=4,
      maxslope=30,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = amphibDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=2,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   
   TANK6 = {
      footprintx=6,
      footprintz=6,
      maxslope=30,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = amphibDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=2,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   

--End Amphibious--


--UBoat--

    UBOAT4 = {
      footprintx = 4,
      footprintz = 4,
      maxslope=60,
      minwaterdepth = 30,
      crushstrength = 20,
      subMarine = 1,
	  depthModParams = amphibDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

--End UBoat--


--Endbringers--

   EXPERIMENTALTANK10 = {
      footprintx=12,
      footprintz=12,
      maxslope=30,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=100,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   HOVERTANKEXPERIMENTAL9 = {
      footprintx=9,
      footprintz=9,
      maxslope=30,
      maxwaterdepth=30,
      crushstrength=100,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   EXPERIMENTALTANK12 = {
      footprintx=12,
      footprintz=12,
      maxslope=90,
      maxwaterdepth=80,
      crushstrength=100,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

--End Endbringers--


--Commanders--

   COMMANDERTANK4 = {
      footprintx=4,
      footprintz=4,
      maxslope=90,
      crushstrength=20,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },
   COMMANDERTANKAI4 = {
      footprintx=4,
      footprintz=4,
      maxslope=30,
      crushstrength=20,
      maxwaterdepth=10,
      maxwaterslope=255,
      badwaterslope=255,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=10,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
   },

--End Commanders--


--ZAAL--
   
	ZAALQUEEN3 = {
		footprintx=3,
		footprintz=3,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},
	ZAALKBOT1 = {
		footprintx=1,
		footprintz=1,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},
	ZAALKBOT2 = {
		footprintx=2,
		footprintz=2,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},
	ZAALKBOT3 = {
      footprintx=3,
      footprintz=3,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},
	ZAALKBOT4 = {
		footprintx=4,
		footprintz=4,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},
	ZAALKBOT5 = {
		footprintx=5,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},
	ZAALKBOT6 = {
		footprintx=6,
		footprintz=6,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},
	
--End ZAAL--

--Pattern--

	PATTERNKBOT2 = {
      footprintx=2,
      footprintz=2,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},
	
	PATTERNKBOT3 = {
      footprintx=3,
      footprintz=3,
      maxslope=40,
      maxwaterdepth=5000,
      maxwaterslope=255,
      badwaterslope=255,
      crushstrength=20,
	  depthModParams = genericDepthmodParams,
	  minwaterdepth=0,
	  heatmod=unitHeat,
	  slopemod=4,
	  allowRawMovement=true,
	  flowMapping=flowMappingToggle,
	},

}

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

-- convert from map format to the expected array format

local array = {}
local i = 1
for k,v in pairs(moveDefs) do
	v.heatmapping = false -- disable heatmapping
	v.allowRawMovement = true
	array[i] = v
	v.name = k
	i = i + 1
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

return array

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


Re: should we be using QTPFS?

Posted: 02 May 2021, 01:34
by Forboding Angel

Re: should we be using QTPFS?

Posted: 02 May 2021, 17:19
by raaar
Thanks!

So we'd need to change the move defs as well.

Re: should we be using QTPFS?

Posted: 03 May 2021, 10:26
by Forboding Angel
Yeah basically you just enable flowfield on a per class basis. You really need to spend time getting unitheat right though. The number that I came up with produced the best results with my units. They might do the same for yours, but I can say that unitheat was an important factor in getting it to work well.

Re: should we be using QTPFS?

Posted: 19 Sep 2021, 20:11
by raaar
I've tried setting *10 or *100 values on heatMod and heatProduced and checked that it makes some units turn around away from where they're supposed to go when moving in clumps, but the default values match what you recommended and seem to work fine (not very noticeable, though).

I'm enabling heatMapping on my game with the default values. It seems to produce less clumping when moving groups.

The flowMapping seems to be enabled by default.

These features seem to affect the default pathfinding, not QTFPS, correct?


Old threads related to these issues:
Feedback on QTPFPS pathing
https://springrts.com/phpbb/viewtopic.php?t=29776
Forby's guide to making the pathfinder like you