Dadido3 / D3bot

A very primitive AI for GMod bots designed to work with Jetboom's Zombie Survival gamemode.
40 stars 28 forks source link

Support for .nav file navmesh #85

Closed Bagellll closed 2 years ago

Bagellll commented 2 years ago

This is scuffed.

Dadido3 commented 2 years ago

This is scuffed

lol

Seems usable, works for simple maps most of the time. There are still some problems with how source navmeshs attributes translate to D3bot parameters. So sometimes bots will just get stuck trying to walk up a cliff or similar stuff.

Also, there are error messages when the second round of a map starts. This is probably due to ZS redeeming bots which will cause them to use their "survivor" path finding, which will still use D3bot nodes instead of source navmesh areas: bot:D3bot_SetPath(escapePath, false) bot:D3bot_SetPath(path, false)

It will probably be enough to prevent any path generation in that case, as survivor bots are not that useful anyway.

But other than that it works, has no side effects when not used, is set to fallback by default for new installations, and is disabled for existing D3bot installations (If the config file is not overwritten).

I'll merge it if you fix that remaining error. Any further improvement to navmesh attribute handling or other stuff is also welcome. Thanks for your efforts.

As a sidenote: Why not write a converter instead of trying to make the bot compatible with source navmeshes? It would have the advantage that you can use the editing tools to tweak those converted navmeshes. I know that it's not quite the same, as you can't have slanted nodes with D3bot, but that would be a small sacrifice.

Bagellll commented 2 years ago

Sounds good. I actually did think of that but I had fun once I started and just kept going lol. Once I find some more time I'll definitely fix the error and add a command for conversion.

Dadido3 commented 2 years ago

I took the liberty to refactor some stuff.

I also had to change some stuff, due to how D3bot decides whether it is enabled or not. Like there was an error that even when no D3bot navmesh was available, and the source navmesh usage was forbidden the bot logic was enabled, and thus bots were spawned (on a map without any valid or active navmesh).

I also fixed a bug that was causing the console to spam with errors, due to survivor bots using path finding functions that were not adjusted for the use with source navmeshes.

You can take a look over it, test it. And when you are fine with the changes i'll merge it.

Bagellll commented 2 years ago

That helps a ton, thank you. I'll test the new changes right away.

Actually, there were a couple features involving mesh conversion that I'd still like to implement in this PR. There were also a few maps I tested this on a few days ago where the generated mesh was so large that the net message responsible was overloaded with data.

With that as a potential issue I want to try and break up the net message. I think making some tools to selectively convert a boxed area for better control might also be useful, as well as fine tuning when to convert or not like whether or not a node is actually reachable, and other optimizations etc. After I push those I think everything would be good to go for the scope of this.

Dadido3 commented 2 years ago

I assume there will be no more commits for this pull request. Everything seems to work, so i'll merge it now. Thanks for all the effort.

If there is still something you want to update, feel free to open a new pull request.

Bagellll commented 2 years ago

Thanks, and I'll do just that when I come around to this again!