Integrating Prolog Engine with your game code.

This isn't so much an AI question as a code-logistics question.
How are you integrating a prolog or prolog-like engine into your code for querying AI actions?

I'm looking to use prolog for some shits & giggles in a NodeJS environment but the options are bleak. I wasn't sure if the more founded languages (like C++) had easy ways to run that code from within your application or if you were doing some sort of odd wiring to... run Prolog in parallel? Can you see I know nothing of this topic? :)


  • I'm not using Prolog.

    Prolog has many flaws, in my opinion, and would not mesh well with my program.

    For now, scripts will be written entirely in C++, and will likely remain that way. This is after a careful evaluation of options. Basic rules may be stored in JSON to hotload them. I'm sticking with C++ because performance is a large concern in the long run, and interfacing with a scripting language makes a lot of redundant work. C++ also allows direct peeking into all the engine data without marshaling anything, which is both a performance hit and more code to write.
  • you could always make your own scripting language to serve the same purpose, all while being able to rapidly push out content

  • I have the feeling I heard that before. :D
  • it's only the best method out there :P
  • Honestly, I'd like it. I think VQ would be helped by having some abstraction between the innards and the mods. If a modder needs some functionality, they can expand on the API. Which is a lot cleaner than hacking some code, in the hopes nobody overwrites your changes ever.
  • The trouble is... writing a new language takes a lot of extra time. (I speak from experience.) In addition, the modders now have to learn a new language.
  • Indeed. I'd still prefer being able to use Lua. But I understand that this is out of the scope at the moment.
    I also really have no idea how easy or hard it is to actually include another language for modding.

    All things considering, I'd rather have development time spent on cross platform rather than a modding APi, but that's just because it would benefit me directly. :D
  • edited October 2014
    Slymodi said:

    you could always make your own scripting language to serve the same purpose, all while being able to rapidly push out content


    I've written a compiler and invented my own language in the past - it is not a small job. There are things like LLVM now, but that would add a lot of bloat to the project to integrate it. The rules still can be stored in JSON - this is typically viewed as a data-driven approach. This way, you can hotload and modify rules in realtime, and have them interpreted at full speed in the engine. If I were to go with a scripting language, I would use Lua, not invent my own - Lua, and LuaJIT are way faster than anything I could make, and have a long history of stability and use in game engines. :)

    Edit: also, if you really want to get nuts the engine supports taking in JSON from a browser or websocket. So you could set up a Javascript app or Node.js server and make a mod that way - it supports two way communication. The old material editor still does this:

  • Prolog is fine (some Prologs are) but doing it effectively is a lot harder than most people think. Good Prolog code solving non-trivial problems is rather hard to understand and very hard to do without a lot of specific experience. It would also impose a huge barrier of entry for 99.99% of already experienced programmers.

    I agree that keeping it all C++ makes the most sense.
Sign In or Register to comment.