arl/go-detour

Add new obstacles

Opened this issue · 5 comments

Hello!! And thanks for porting this library!! I'm starting to implement this in my project.

I've got a Recast Navmesh in .bin format and I've already loaded it inside my .go project without issues!
I need now to add to this navmesh some spheres and cylinders by code (i've got the orientation vectors, radius and center coordinates). Is there any way to do this with this library?

Again, THANK you very much!!

arl commented

Not sure you can add volumes by hand on an already built navmesh, even with the original lib.
However you can add volumes to a geometry (before building the navmesh) and rebuild the navmesh. That's how this is done in games I guess, the volumes need to be built inside the navmesh in order for them to be avoided (as obstacles).
You can build your navmesh directly with Go, starting from your level geometry, have a look at https://github.com/arl/go-detour/blob/125fe722a13350f4429eaa427cec25b30bde6a49/sample/solomesh/builder.go
and https://github.com/arl/go-detour/blob/master/recast/inputgeom.go#L213

Hope this helps

Thank you so much for the quick responses. I'm starting to understand a bit more now.
I managed to export my game's navmesh and now it's all loaded in my server with your plugin!
I'm starting to send polygons from the client to calculate the characters walking paths in the server, and store them with a timestamp.
I was thinking about making a new subroutine in the server that checks all this stored pending paths, and updates the character's positions based on the current timestamp, the character's movement speed and the path itself. What do you think about this approach?
I was thinking that, for implementing that, I'll need a way to get the distance between polygons. Is that possible?
Also, is there a way to translate in the server a polygon to the game's world position coordinates? Or should I send the polygon ID to the client, and then translate it to world position in the client?

Again THANK you and sorry if I'm being too troublesome, I'm just too passionate about this hehe.

arl commented

Hey. I'm not sure how to answer your questions without having more details on what you're doing.
I just want to warn you that library does need some love and is not maintained at the moment.

That being said I know it works since I've using it with success in a game demo I did with colleagues years ago.
If you think that may help you, you can have a look at that specific branch of this repo: https://github.com/RookieGameDevs/surviveler/blob/go-detour-pathfinder/src/server/surviveler/world.go
Game server is done in Go and uses this lib to compute very smooth paths.

I'm super happy to have someone interested in this lib, that was years of work, even if it's a port. Just hoping that you'll be able to get something out of it ☺️

If with this I can compute a path between 2 points in a navmesh, that's more than enough for my project!

Thank you for all the hints and the awesome work!! I'll also be checking out that repo.

Yess being passionate about this things really bites up a great chunk of our lives! I'm working on this game as solo dev for more than like 5 years I don't remember, and I'm still programming it's core funcionalities!
The steps are SO small but every one gives me so much gratification!

Cya around!

arl commented