stohrendorf / CroftEngine

An open-source Tomb Raider 1 engine remake
Other
281 stars 18 forks source link

Ai refactoring #268

Closed stohrendorf closed 2 years ago

stohrendorf commented 2 years ago

@serishema I did my best to understand why the AI goes crazy sometimes, and it seems the step and drop limits and their checks are negated. I tried to fix these things and make the original AI code a bit more readable. I'm not feeling really confident about these changes, they might make things even worse. It would be nice if you could take a look at this and mark any WTFs or ask for clarification when there's anything that's confusing. I will add comments or further refactor the code to hopefully clean things up.

serishema commented 2 years ago

I played the first 3 levels. These are the things I noticed about enemy behaviour with this branch.

stohrendorf commented 2 years ago
stohrendorf commented 2 years ago

One more terrifying thought... I seriously hope the box floor/ceiling heights aren't negated, too. But if I remember correctly, when I once exported the level geometry to OBJ, the boxes looked fine and matched the level geometry, but I'm not sure whether I negated the heights without questioning it enough.

serishema commented 2 years ago

Unfortunately I can't tell from the code. My guess would be that if the floor/ceiling heights were negated then these changes would have made all enemies behave very strangely which isn't happening.

I'm happy with everything, except for the wolves getting stuck. Do you want to address that in a seperate PR, possibly in the future or deal with it here?

if it's to be addressed in the future i'm happy to approve these changes.

stohrendorf commented 2 years ago

I found the issue with the pathfinder, it's just another case of "reverse thinking".