ALiVEOS / ALiVE.OS

ALiVE Open Source GPL v2
http://alivemod.com/
Other
160 stars 80 forks source link

Fix 2 OPCOM bugs, snap waypoints to roads #778

Closed super-gauntlet closed 2 years ago

super-gauntlet commented 2 years ago

The OPCOM changes are just bugfixes. The waypoints are a bit different. I noticed that the waypoints created by ALiVE tends to make vehicles drive off roads for no reason.

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

The addWaypoint function takes 4 args in addition to the group, one of which is radius. You'd think normally that radius would be the distance you have to be from the wp for it to be completed, but it actually randomizes the waypoint. Instead of doing this for vehicles, we find the closest road and set radius to -1 (for exact placement).

CrashDome commented 2 years ago

Awesome. Coiincidentally.....

I'm actually attempting to fine-tune the pathfinding functions and one thing I did was ensure road waypoints were on roads. Once I'm done, the profile waypoints should already be snapped (but only if using pathfinding)

super-gauntlet commented 2 years ago

oh interesting. That's essentially what I was trying to do, I just did it in the simplest way possible. It was easiest to figure out what type of group it was here.

I've got no issue removing that change if your stuff works just as well to avoid duplicating work yeah.

CrashDome commented 2 years ago

By all means keep it in, not sure when I'll be done with this. I just thought it was awesome because I used practically the same code but, in the pathfinding functions.

I'll remove it if I find it redundant later.

super-gauntlet commented 2 years ago

cool sounds good! yeah it's a simple change but it makes the AI so much less stupid along roads.

marceldev89 commented 2 years ago

@super-gauntlet nice! Seems fine to me. What bug does adding the "reserving" state to the FOB check fix exactly? I don't see a problem for it as reserving is already basically an idle state after defending but just curious.