dt-rush / sameriver

game engine written in go
Other
1 stars 1 forks source link

optimize goap for non-temporal case #77

Open dt-rush opened 1 year ago

dt-rush commented 1 year ago

temporal GOAP is faster for plans that rely on temporal ordering to avoid modal failure during forward validation of falsely-correct paths. but it's slower for simple plans that don't actually use temporal ordering.

So, begin planning in a non-temporal state, and once the first temporal pre comes into the equation, retroactively fill out the degenerate-case "regionOffsets" ([0] for all) and activate a flag that will update them in path.inserted(), also instead of simple insert-before insertionIx, use regionOffsets lookup.