ptrefall / fluid-hierarchical-task-network

A simple HTN planner based around the principles of the Builder pattern.
MIT License
338 stars 48 forks source link

C++ version #4

Closed amoldeshpande closed 3 years ago

amoldeshpande commented 3 years ago

hi,

I needed a C++ HTN and ran across your project while searching. Since I found the code easy to follow and you have a ton of Unit tests, I was able to convert it to C++.

It lives here https://github.com/accesshoops/fluid-hierarchical-task-network

I converted most of the Unit Tests to C++ as well and am trying to get the TextAdventure working in C++ too. That part is here https://github.com/accesshoops/fluid-text-adventure

My eventual goal is to have an UE4 example project, but that will probably take a while longer.

If you'd like to take a look at my fork and consider integrating it with this project, let me know. I totally understand if you don't want to deal with a whole another language :-) .

Edit: TextAdventure needs more work.

ptrefall commented 3 years ago

That's so cool @amoldeshpande! I will have a look through the code and consider it! I'm glad you found the code easy to follow, that was one of the primary goals writing it.

ptrefall commented 3 years ago

If you make a pull request I'll go through your code and can comment if there's anything that sticks out.

ptrefall commented 3 years ago

Could we use CMake rather than Visual Studio for the project generation? It would be nice if we could keep this variant cross-platform. Framework.h looks a bit alien in the main library as well. But the HTN specific port looks good so far. But yeah, please make a pull request and I can comment straight into the PR instead of comments here.

amoldeshpande commented 3 years ago

I removed framework.h and moved the windows-specific code into the fluid-text-adventure header that deals specifically with the windows console. That is all that was platform-dependent in the core library.

For the adventure app, those parts can be compiled out and replaced with specific code for other platforms. It might be better to use the new ANSI-processing capability of the Windows 10 console and just output those codes, which would work on all platforms except for Windows 7 or 8.

As far as CMake goes, I detest that tool and am not the person to add support for it here. If you have any other suggestions, I am open to trying those out. I can make a simple GNU makefile, but most people don't like dealing with those :-)

The other issue is that I am using the Microsoft Test framework, which would have to be converted to something else. Perhaps Google Test.

I can still make a PR so you can review the code itself. We can then close out the PR (or leave it open) without merging until I or someone else with an itch gets the bandwidth to do the necessary work to make it properly build cross-platform.

Let me know if that works for you.

ptrefall commented 3 years ago

Yes, that sounds good to me. I'm still undecided whether the C++ repository should sit in the same repo or whether i would prefer to break it out into its own repo, kind of like I did with the extension library, to keep each repository focused. Writing this I think I would prefer that.

You might just have stirred the fire in me to do these last bits myself. It was really cool to see this port and I hope you found it interesting and useful. Its such a powerful technique.

amoldeshpande commented 3 years ago

ok, here we go https://github.com/ptrefall/fluid-hierarchical-task-network/pull/5