Page 1 of 3

Looking to start a chatbot expansion

Posted: Mon Oct 19, 2009 6:06 am
by unteer
Hey kindly folks at Oolite bulletins, I am a relative newbie to the game, and these forums, but I have a lot of time on my hands and have an idea for an expansion. I am a programmer, so I am not afraid of that aspect of the whole endeavor, but I have some questions.

The general idea for the expansion is to have a chatbot AI based on an AIML parsing engine which can answer questions about the game such as recent prices of commodities based on last visit, and whatnot. Also thinking of throwing in some Natural Language Learning so that maybe it can even learn from the player as you go (I have A LOT of free time, and AI was my specialty in university).

However, I am getting mixed sources on where and how to approach this project. My concept of the game is that the chatbot engine would be coded in javascript, using a javascript-based AIML parser. And from this, the questions arise:

1) Which file would I modify for the HUD of the ship to include a chatbox which you would use to interact with the AI. hud.plst seems reasonable, but is the least documented on the elitewiki.

2) is it against any oolite/elite mantra to have the AI record prices based on last visit and whatnot to aid in commodities training?

3) is it ok to maintain external databases for the AI brain and memory or would that be against mantra as well. Is it ok to use a SQL based language, or should I stick to plsts?

4) are you able to code in Objective-C for the OXPs or is everything plst and javascript based? I dont know if OXPs can be compiled seperately of the game, or if major coding forces a recompile of everything.

And finally...

5) does something like this already exist for the game, and could i just use it instead of hacking my own?

I apologize ahead of time if these answers are out there. I have googled for some of the answers and will continue to do so, so I don't appreciate, "Go google it," as a response. I have googled, am googling, and will continue to google. but people are still better than google many times :)

Cheers!

Re: Looking to start a chatbot expansion

Posted: Mon Oct 19, 2009 6:20 am
by another_commander
Hi and welcome to the forums and the game. On with the answers:
unteer wrote:
1) Which file would I modify for the HUD of the ship to include a chatbox which you would use to interact with the AI. hud.plst seems reasonable, but is the least documented on the elitewiki.
hud.plist is what you would hack to produce a graphic like a box that would hold the chat text. However, the plist alone is not enough. You still need to add the logic behind it and for this you would probably need to create a ChatAI class that interacts with the HeadUpDisplay class.
2) is it against any oolite/elite mantra to have the AI record prices based on last visit and whatnot to aid in commodities training?
In my opinion, no. It would be in the same context as having a pen and paper and writing down prices from systems visited.
3) is it ok to maintain external databases for the AI brain and memory or would that be against mantra as well. Is it ok to use a SQL based language, or should I stick to plsts?
I would prefer to stick to plists for consistency with the rest of the game interface.
4) are you able to code in Objective-C for the OXPs or is everything plst and javascript based? I dont know if OXPs can be compiled seperately of the game, or if major coding forces a recompile of everything.
Objective-C is used only for the core of the game. OXPs are made with plists, model, sound and image files and JavaScript and they are not compiled, they just provide resources that the game reads and uses accordingly. They are cached, but this is not quite the same thing. Only the core exe code is compiled.
And finally...

5) does something like this already exist for the game, and could i just use it instead of hacking my own?
To the best of my knowledge, nothing like this has been attempted before.

Posted: Mon Oct 19, 2009 7:07 am
by unteer
Thank you so much for your quick response. I am glad to see that the BB is patrolled by such helpful individuals as yourself :) I will therefore begin working on this project, and if and when I have made some major progress, possibly open up a code page somewhere and would glady appreciate contribution and experience :)

Another quick question then, is there a "hello world," style OXP out there that does not involve graphics or modeling (not my strong suits, nor my desire).

Cheers!

Posted: Mon Oct 19, 2009 8:19 am
by Kaks
'Hello World'? Not really, but farsun (see my sig) is fairly minimalstic, since all it does is move suns from position a to position b.

I'd personally have a look at each of the Articles pointed at from here before jumping in, though...

As per another thread on the boards somewhere, I suspect GalCoop would take a dim view of trade helping technologies, but that theory hasn't been tested yet!

Cheers, - & a_c already said - welcome to the friendliest boards this side of Riedquat!

Posted: Mon Oct 19, 2009 8:25 am
by another_commander
I've put together a quick and dirty Welcome To Oolite OXP as an example of what can be done. Downloadable from here:
http://terrastorage.ath.cx/Marmagka/6f4 ... te.oxp.zip
Unzip the contents of the file directly into the AddOns folder, maintaining the directory structure. This OXP displays a welcome screen the first time you start the game at Lave and also generates a "Launch sequence complete" message immediately after launch. Hope it gives an idea how it's all assembled and works out.

Posted: Mon Oct 19, 2009 8:49 am
by unteer
As per another thread on the boards somewhere, I suspect GalCoop would take a dim view of trade helping technologies, but that theory hasn't been tested yet!
I was actually reading that thread and was about to mention my thoughts, and even just had an Elite-canon discussion with a friend of mine as well. What I was hearing was that system-wide and galaxy-wide trade-assistance programs are frowned upon for obvious reasons: it would make the game a whole lot less fun. Part of the game is taking a risk in commodities-trading and because the game cannot easily represent the risks of real-life commodities-trading, the universe creates artificial risks, such as price-masking through information obscurity.

What I am proposing is simply an electronic version of the paper and pencil method to price watching. Your ship AI will a) only remember prices from systems you have visited and b) only remember certain prices when you ask it to, on a per item basis (ie, "AI, please remember this system's food price"). I feel like this puts enough onus on the player to remember to tell the AI to remember the prices while allowing people like me to fly around in-game as well as in real life without needing to worry about bringing their physical log-book. I am trying to find a balance between learning how to write OXPs, give the Ship AI some functionality which will help me to select its working vocabulary for training its NLP engine, and adhere as much as possible to Elite/Oolite canon.

Anyone ever read McCaffrey's Nimisha's Ship? If so, think that for the AI minus the voices. If you haven't read the book, it's not the author's best, but it's certainly fun, and keeps me entertained when the electricity goes out and I am reading by lantern-light, lol.

Thoughts?

Re: Looking to start a chatbot expansion

Posted: Mon Oct 19, 2009 9:47 am
by pmw57
unteer wrote:
2) is it against any oolite/elite mantra to have the AI record prices based on last visit and whatnot to aid in commodities training?
Oh bugger - that's what I'm quietly working on here. To store the commodities in a packed manner, and then to show the best price differences from what you know of the systems around you.

Posted: Mon Oct 19, 2009 1:30 pm
by Cmdr James
Im not sure how useful that is, as prices will not be the same next time you visit.

Posted: Mon Oct 19, 2009 1:41 pm
by unteer
I think much of this AI work is moot anyway, as there is no way to intercept key presses using spidermonkey apparently (according to another thread I've started). If this is the case, there will be no way for the user to interact with the bot. This is most sad!

Possibly a companion program then, depending on what sorts of variable-values I can access externally of the game.

Does anyone else have any thoughts on this matter?

Cheers!

Posted: Wed Oct 21, 2009 12:19 pm
by PhantorGorth
Does anyone else have any thoughts on this matter?
Yes, I have been looking into ship to ship communications a little while ago. I have already looked into to adding an interface and how to do a relatively simple response mechanism whilst you are in flight.

To do this you will have to alter the core code.

I have already got a copy of the code that adds a semi-transparent window that overlays the HUD for selecting your response which can be toggled on or off on the F9 key. But I put this on the back burner as it was too ambitous to be my first modification.

I was going to to do the response method by having te player select options using the equivalent of cursor keys (thought not the real cursor keys as you will still need those for flying the ship). The response method was to be grammer based with each option selected to be able to add further options if required so building up your sentence. The left-right keys would select which part of in the of the sentence to alter and the up-down keys would cycle through the options for that part. Typing would only be needed for special options such as numeric fields for money for example.

This would be an injection system so OXPs can have ships transmit a message to you and add to your comms system the grammers or basic options for a response. When you respond a message is sent to the ships AI using the normal mechanism. AIs then can call a JS script to check your response and decide if to change state or send another message and grammers to you.

As well as responding to messages you can send messages to ships, police, stations etc.

The choice of a grammer based system was to make it easier for the language to changed.

I can provide examples if you want but it will have to be later. (I'm at work)

Posted: Wed Oct 21, 2009 12:35 pm
by Svengali
Great idea PG! I'd like to see some examples .-)

Posted: Wed Oct 21, 2009 4:01 pm
by overmage
I think it's a great idea. We can have a SmarterTharglet ;)

Posted: Wed Oct 21, 2009 8:02 pm
by PhantorGorth
Svengali wrote:
Great idea PG! I'd like to see some examples .-)
Here is an image of the comms interface overlap:
Image

It is a simple test so there is no interactivity in it at the moment. Just toggles on and off with the F9 key and is removed if you dock.

Examples of now I expect the communications interface to work:
Image

The first example is a basic response. The second is sentence construction with the on screen message that goes into the normal log is shown underneath. The third is another sentence construction.

These may have huge issues that have yet to be worked out but I hope these examples at least gives everyone a feeling to what I am suggesting.

...

Posted: Wed Oct 21, 2009 9:29 pm
by Lestradae
Very cool idea :D

Posted: Wed Oct 21, 2009 10:18 pm
by pagroove
PG: my dream comes true when you get this implemenred. I like the idea of the com channels :)