Page 1 of 1

Screen Space Aim Assist

Posted: Tue Feb 21, 2023 10:07 pm
by _ae
This is a useful phrase I keep in my spellbook for targeting entities, which selects the entity from a list closest to my crosshair (based on the average position of the entity's feet and head), within a given viewcone. It makes use of a few other utility phrases, which I've included as their own patterns below.

______________________________________________________________________________________________________
dadaddww
Clean Thoth (list<pattern>, list → list)
Thoth, but only the iotas at the top of the stack are included in the returned list. Useful if thoth is required for a phrase part way through a spell which needs to maintain a stack.
aawddqqqqwaeawqaeaqaewdqdweqqqaedeNumerical Reflection: 0deeedeeeqaeaqaawdddadad
______________________________________________________________________________________________________
wdewqaw
Inverse Screen Space Distance (vector → num)
Used instead of view angle relative to the crosshair because there's no native atan2 function, this doesn't require a conditional, is simple to calculate, and because it's monotonic with respect to view angle which is all we really want.
qaqaawddwqaqwaaaeddaadadaawwaqawddqddwedewaaeaawddwwqaqwwdedw
______________________________________________________________________________________________________
awawaa
Argmax (list<num> → num)
Gets the index of the largest value in a list. Also saves a copy of that value to the ravenmind as a side effect, which can be useful.
aadaaNumerical Reflection: 0deeedeqqwawqaawqqqaadaaqeewdweddweqqqeqqwawqaaweeeqqqBookkeeper's Gambit: Drop 1eeeawdddeaqqeeeaaedddadadBookkeeper's Gambit: Drop 1qeewdweddwdedqde
______________________________________________________________________________________________________

Aim Assist (list<pattern>, num, list<entity> → )
Takes a list of patterns which are to be executed on an entity, a threshold value (where 0 is anything in front of you, 1 is a 90 degree cone, 2 is a 45 degree cone, etc.), and a list of entities. It then executes the patterns on an entity chosen by aim assist. Does nothing if no entity is within the given threshold. Patterns in red below are convenient examples; including them in the spell changes the type to (list<pattern> → ). Note that your own location in screen space is undefined, so this will throw a divide-by-zero mishap if you include yourself in the entity list!
Numerical Reflection: 4qaqaaNumerical Reflection: 32qqqqqwdeddwqqqqaadaaddaawddaawaawNumerical Reflection: 2wdedwwdewqaweeeaaedddadaddwwawawaadeeedaawddqeewdweddwqqqqaawdddeaqqeeeqqqBookkeeper's Gambit: Drop 2eeeawdddeaqq

Re: Screen Space Aim Assist

Posted: Wed Feb 22, 2023 9:52 am
by _ae
Finally had the opportunity to check what I had in-game; fixed any errors above and replaced escapes with parentheses since they're easier to keep track of when nested.

Re: Screen Space Aim Assist

Posted: Fri Feb 24, 2023 3:33 am
by Talia
I've used this to power a mist-dispersal hex, and wow it is so much easier to use than a raycast! Plus the Clean Thoth and Argmax will be very handy to have as well, so thanks for making this!

Re: Screen Space Aim Assist

Posted: Fri Feb 24, 2023 4:27 am
by petrakat
...there's no native atan2 function...
Whoopsy 8-) I've opened a bug report, #422

Re: Screen Space Aim Assist

Posted: Fri Feb 24, 2023 4:30 am
by _ae
I wouldn't call that a bug, but if you add it I certainly won't complain! :D

Re: Screen Space Aim Assist

Posted: Fri Feb 24, 2023 4:32 am
by petrakat
Issue report, then :D

It's good for me to have a bunch of small things I can implement to keep me from getting burned out on any one particular part of development. (Speaking of .... time to get back to work on the casting context refactor)

Re: Screen Space Aim Assist

Posted: Fri Feb 24, 2023 5:46 am
by _ae
Oh, now I see why you made it a bug report! I didn't know it was already supposed to be implemented, thought you just saw that offhand comment and decided to add it :lol: