nk3nny / LambsDanger

AI enhancement mod for Arma 3
Other
105 stars 40 forks source link

Rework position commands #341

Open rekterakathom opened 1 year ago

rekterakathom commented 1 year ago

When merged this pull request will:

Replace all instances of getPos with the appropriate position command, usually ASLtoAGL getPosASL. This is because getPos is not a suitable command for getting an objects 3D position due to inconsistent behaviour and slow execution. In my tests, the new macro is almost always faster than getPos. On open terrain execution time stays the same, but indoors the new method is 3 to 4 times faster.

Edit: Also added a macro alternative to setPos. This will set objects to AGL positions which is much more consistent.

  1. Describe what this pull request will do
    • Add a new macro for getting 3D positions in positionAGL format and utilize it to replace all instances of getPos
    • Add a new macro for setting an objects 3D position in positionAGL and utilize it to replace all instances of setPos
  2. Each change in a separate line
    • New macro POSITIONAGL(object)
    • Removed getPos in favour of the new macro
    • New macro SETPOSITIONAGL(object,position)
    • Removed setPos in favour of the new macro
nk3nny commented 9 months ago

Nice PR.

@diwako For more discussion.

nk3nny commented 9 months ago

I like this solution. It seems to run significantly faster in most situations, with the odd exceptions of terrain objects gathered from nearestTerrainObjects, which is used in some hiding and fleeing functions.

https://community.bistudio.com/wiki/nearestTerrainObjects

nk3nny commented 6 months ago

@diwako Let's have a discussion once you are back about this one. :)

nk3nny commented 4 months ago

Allright. Review completed. Only to half a year.

We like the concept and appreciate the thought that has gone into it. However we are suspect about the maintainability (see review time) and would like instead to implement non-macroed version in key positions. :)

rekterakathom commented 4 months ago

Allright. Review completed. Only to half a year.

We like the concept and appreciate the thought that has gone into it. However we are suspect about the maintainability (see review time) and would like instead to implement non-macroed version in key positions. :)

The way I see it, partially implementing this PR w/o macros is the less maintainable version. That way you'll end up with various position commands across the codebase, whereas with this PR you get universal getters / setters for the most common position format with singular definitions.

rautamiekka commented 4 months ago

The way I see it, partially implementing this PR w/o macros is the less maintainable version. That way you'll end up with various position commands across the codebase, whereas with this PR you get universal getters / setters for the most common position format with singular definitions.

Yeah, hard to argue against the complexity that those macros are simplifying.