AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   MegaHAL ChatBot (https://forums.alliedmods.net/showthread.php?t=157540)

Afronanny 05-22-2011 23:46

MegaHAL ChatBot
 
MegaHAL Chatbot

After months of development and testing, I give you the Chatbot extension. This extension brings you the full artificial intelligence of MegaHAL. It sits around and listens and learns, and will reply to input from chat when you want it to.


Quote:

Purpose: To simulate a natural language conversation with a psychotic computer. This is achieved by learning from the user's input using a third-order Markov model on the word level. Words are considered to be sequences of characters separated by whitespace and punctuation. Replies are generated randomly based on a keyword, and they are scored using measures of surprise.

Download it here
Source code is here

Cvars:

sm_megahal_talk (Default: 0) - Chatbot will reply to all input from the chat.
sm_megahal_learn (Default: 1) - Chatbot will listen to all input from chat but not reply to it.
sm_megahal_replychance (Default: 0.75) - Chance that chatbot will generate a reply
sm_megahal_replywhenspokento (Default: 1) - Only reply when spoken to (may not reply if sm_megahal_replychance is not 1.0)
sm_megahal_botname (Default: ChatBot) - The name that MegaHAL will use when printing its reply to chat.

Credits:

Jason Hutchens - Author of MegaHAL
Afronanny - Putting it into an extension


Please give any crash info here or PM me with it.

Seta00 05-23-2011 00:04

Re: MegaHAL ChatBot
 
Looks like guaranteed fun! GJ :)

jasonfrog 05-24-2011 09:33

Re: MegaHAL ChatBot
 
Have installed this on a Linux TF2 server. (I've checked the it's all loaded fine, no errors in error log either.)
Should the files in sourcemod/megahal-ext/ be updating and changing as MegaHAL learns?
If so, then they aren't for me. Where is what is learnt stored?

jasonfrog 05-24-2011 10:25

Re: MegaHAL ChatBot
 
It would be good if it ignored chat lines that started with either "!" or "/", as it's not so satisfying when it responses to triggers.

Afronanny 05-24-2011 13:02

Re: MegaHAL ChatBot
 
Quote:

Originally Posted by jasonfrog (Post 1474683)
Have installed this on a Linux TF2 server. (I've checked the it's all loaded fine, no errors in error log either.)
Should the files in sourcemod/megahal-ext/ be updating and changing as MegaHAL learns?
If so, then they aren't for me. Where is what is learnt stored?

The files will only update when megahal exits. Everything else is stored in memory.


Also, try re-downloading the plugin. I added a check so it will not reply to chat commands.

jasonfrog 05-24-2011 13:39

Re: MegaHAL ChatBot
 
Quote:

Originally Posted by Afronanny (Post 1474807)
The files will only update when megahal exits. Everything else is stored in memory.


Also, try re-downloading the plugin. I added a check so it will not reply to chat commands.

Perhaps I'm being a little silly here, but what makes megahal exit?

Thanks for making the update. I'm wondering, won't this make it ignore anything that contains an '!' anywhere, rather than at the beginning?
Code:

if (StrContains(arg1, "!") == 0 || StrContains(arg1, "/") == 0)
Maybe this instead?
Code:

new char = arg1[0];
if (char != '!' && char != '/')


Afronanny 05-24-2011 13:57

Re: MegaHAL ChatBot
 
No. StrContains returns the position of the character, or -1 if it isn't found.

Quote:

Originally Posted by jasonfrog (Post 1474821)
Perhaps I'm being a little silly here, but what makes megahal exit?

Extension unload

bl4nk 05-25-2011 01:05

Re: MegaHAL ChatBot
 
So it basically never saves then. The only time that it would "unload" is when a server does a clean shut down or if the admin manually unloads it. If the server crashes, everything will be lost. You should dump the information regularly to prevent this from happening.

Afronanny 05-25-2011 08:16

Re: MegaHAL ChatBot
 
Updated the extension and the plugin.
- Extension is now using actual version numbers
- Added the MH_Save native
- Plugin calls MH_Save on map end so that the MegaHAL brain is saved often

Drixevel 05-25-2011 11:40

Re: MegaHAL ChatBot
 
Seems like a good idea and concept but how do you work with it? Do you have it learn a fair but then let it talk or does it do it automatically? Can you make it so it doesn't respond to everything you say like if you just call it's name, it responds? Does it take up a slot? Sorry for all the questions. :3

Afronanny 05-25-2011 12:52

Re: MegaHAL ChatBot
 
I just put in a new cvar to control the probability that ChatBot will respond. And certainly, one could make it so that it only responds when spoken to by name. I put that in there as well. And a cvar to control chatbot's name.

No it does not take up a slot. It's not a real bot. Just an imaginary one.

Drixevel 05-26-2011 11:55

Re: MegaHAL ChatBot
 
Well i installed the extension and the plugin and it says it's running but the bot doesn't like to respond for some reason. I've tried setting CVARS but it still doesn't say anything so i'm kind of confused to how this works.

Mecha the Slag 05-26-2011 14:11

Re: MegaHAL ChatBot
 
Links are down D:

psychonic 05-26-2011 14:22

Re: MegaHAL ChatBot
 
Quote:

Originally Posted by Mecha the Slag (Post 1475970)
Links are down D:

It's just been going down for a few minutes at a time for the last half hour or so. Try again.

Mecha the Slag 05-26-2011 15:27

Re: MegaHAL ChatBot
 
I'm experiencing some very frequent crashes when the bot is generating responses

edit: This is on a Windows TF2 server

Afronanny 05-27-2011 11:44

Re: MegaHAL ChatBot
 
Do you have a mdmp I can use to debug?

Mecha the Slag 05-27-2011 18:10

Re: MegaHAL ChatBot
 
I don't think TF2 uses mdmp dumps anymore.
edit: yeah, no dump what-so-ever D:

But this time when I tried it, it worked for half a minute before crashing. Still crashed, though.
edit2: and this time 10 seconds.


I can run the extension + plugin just fine with replies off, but sometimes when the bot has to generate responses, it crashes.
I wouldn't mind running a debug version of the extension to help you track down the issue, though!

Afronanny 05-28-2011 09:52

Re: MegaHAL ChatBot
 
Here's a debug build: http://downloads.afronanny.org/megahal.ext.dll

By the way, I downloaded the windows server and am running this without crashes when it's generating a reply. It may need a higher playercount before it starts crashing but we'll see. I appreciate your help in tracking down the problem.

Mecha the Slag 05-28-2011 10:29

Re: MegaHAL ChatBot
 
I ran the debug build and the bot crashed after a few responses. Where are the logs stored?

edit: found the logs. Here's what it said:

error.log
Code:

MegaHALv8
Copyright (C) 1998 Jason Hutchens
Start at: [2011/05/28 10:48:50]
MegaHALv8
Copyright (C) 1998 Jason Hutchens
Start at: [2011/05/28 10:49:34]


status.log
Code:

MegaHALv8
Copyright (C) 1998 Jason Hutchens
Start at: [2011/05/28 10:48:50]
User:    yes?
User:    Bot, is Crpl. credit to team
User:    im dancing
User:    okay we are moveing out
- this is where I turned sm_megahal_talk on -
User:    dance partay
User:    DANCE PARTAY
User:    me
User:    ME
User:    um, kirby?
User:    UM, KIRBY?
- crash happened here -
MegaHALv8
Copyright (C) 1998 Jason Hutchens
Start at: [2011/05/28 10:49:34]
User:    lol bot crashed the server
User:    lol
User:    hi bot :D
User:    bad bot
User:    RTV!!!!!!!!!!!!!!!!!!!!!!!!!

and here is the console log:
Code:

*DEAD* Christian Brutal Sniper :  okay we are moveing out
sm_megahal_talk 1
*DEAD* Bring Back Dodgeball!!! :  dance partay
Bot : Hey guys, what does the victory dance.
*DEAD* epic cookie of epicness (DK) :  me
Bot : Imma own you all.
The Legendary dragon cat :  um, kirby?
- crash happened here -


Afronanny 05-28-2011 11:05

Re: MegaHAL ChatBot
 
I just compiled it with MegaHAL's debug files, looks it'll write to stdout when some of the memory functions are called (malloc, realloc). Redownload megahal.ext.dll that i linked to above.

I'm not sure where the debug logs are located :X

Mecha the Slag 05-28-2011 11:32

Re: MegaHAL ChatBot
 
status.log

Code:

MegaHALv8
Copyright (C) 1998 Jason Hutchens
Start at: [2011/05/28 11:25:09]
User:    how do you fuck friendly?
User:    Smile
User:    SMILE
User:    ...
User:    ...
- crash happened here -
MegaHALv8
Copyright (C) 1998 Jason Hutchens
Start at: [2011/05/28 11:25:44]

Can't seem to find any logs anywhere other than that

Afronanny 05-28-2011 15:51

Re: MegaHAL ChatBot
 
I'll look over the MegaHAL code for pointer calls and add checks where necessary.

EDIT: I just started crashing too. Time for the debugger
EDIT#2: I stopped crashing.

KyleS 07-23-2011 21:08

Re: MegaHAL ChatBot
 
Is this still unstable?

Afronanny 07-24-2011 21:59

Re: MegaHAL ChatBot
 
I've been running it for a couple months and it seems pretty stable. Haven't seen any crashes relating to this extension for a while. The only thing I would consider adding is a word filter for the input. People have been teaching chatbot bad, bad things.

Ice1 07-29-2011 11:19

Re: MegaHAL ChatBot
 
I'll try it out on my server :P

KyleS 08-13-2011 23:31

Re: MegaHAL ChatBot
 
Training from file: 100%
Unable to open file `Unable to open file `%s''[SM] Loaded extension megahal.ext.so successfully.

Crash Stack after saying "What does BotName think about dogs"
Code:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xd83feb70 (LWP 14875)]
0xf00817fb in babble(MODEL*, DICTIONARY*, DICTIONARY*) () from /*/extensions/megahal.ext.so
(gdb) backtrace
#0  0xf00817fb in babble(MODEL*, DICTIONARY*, DICTIONARY*) () from /*/extensions/megahal.ext.so
#1  0xf0081f54 in reply(MODEL*, DICTIONARY*) () from /*/extensions/megahal.ext.so
#2  0xf008321b in generate_reply(MODEL*, DICTIONARY*) () from /*/extensions/megahal.ext.so
#3  0xf0086460 in megahal_do_reply(char*, int) () from /*/extensions/megahal.ext.so
#4  0xf007f28c in ThreadedReply(void*) () from /*/extensions/megahal.ext.so
#5  0xf7649cf2 in start_thread () from /lib32/libpthread.so.0
#6  0xf75b998e in clone () from /lib32/libc.so.6
(gdb)


Fearts 08-14-2011 00:07

Re: MegaHAL ChatBot
 
This is loaded but doesn't seems to be doing anything at all. I think I might be putting megahal-ext folder in the wrong place. Where do I put this folder?

Afronanny 08-14-2011 15:20

Re: MegaHAL ChatBot
 
By default it doesn't reply unless you set sm_megahal_talk to 1

SomeSortOfDuck 08-19-2011 05:09

Re: MegaHAL ChatBot
 
Works but not at all how I thought it would.

Me: Chatbot
ChatBot: Who are you Chatbot.

Me: Chatbot you are cool.
ChatBot: Because I decided to have a child, and here you are cool.

I hope it learns fast.

Afronanny 08-19-2011 17:51

Re: MegaHAL ChatBot
 
It takes a while to learn, but you just gotta talk to it for a while. Respond to what it says but don't tell it that it is wrong. Then it'll start telling you you're wrong.

Dr. Greg House 08-26-2011 14:25

Re: MegaHAL ChatBot
 
Is there any hope you can make it support multiple running instances of one srcds-installation (+ l4d2-forks, which is the same as multiple instances)?

It's a great plugin but to save ressources I'm running the fork-command with one installation, which crashes the server since both plugin-instances use the same files. It would be a shame to be forced to waste the double amount of disk-space and additional ressources to make it work, although the libraries/minds would be seperated then.

It would be also nice if people would be able to share the chatbots "minds" and maybe able to combine them.

Afronanny 08-26-2011 14:48

Re: MegaHAL ChatBot
 
I'm working on a new Markov implementation. Implementing MegaHAL is not working out as well as it could. It could support 1 brain with multiple forks if I used SQLite or something. I'll think about it.

Dr. Greg House 08-26-2011 15:08

Re: MegaHAL ChatBot
 
kk, thanks that would be really awesome. I'd be willing to betatest in this case.

KyleS 08-26-2011 17:25

Re: MegaHAL ChatBot
 
Quote:

Originally Posted by Dr. Greg House (Post 1541561)
kk, thanks that would be really awesome. I'd be willing to betatest in this case.


databomb 08-27-2011 16:02

Re: MegaHAL ChatBot
 
When people found I loaded this they started to spam the chatbot. When spammed the chatbot reliably crashes the server. I have no crash dump but I could try and get gdb running again when the server is less crowded. Could you add some anti-spam code to this when you get a moment?

Afronanny 08-27-2011 17:48

Re: MegaHAL ChatBot
 
Quote:

Originally Posted by databomb (Post 1542159)
When people found I loaded this they started to spam the chatbot. When spammed the chatbot reliably crashes the server. I have no crash dump but I could try and get gdb running again when the server is less crowded. Could you add some anti-spam code to this when you get a moment?

It's because I messed up and didn't make the megahal code thread-safe. when 2 threads are trying to do stuff with an object at the same time, kapoof. Server explodes.

databomb 08-30-2011 23:41

Re: MegaHAL ChatBot
 
Could this be worked around in the SP file by setting the reply chance to 100% and blocking future learning and replies until a response is received?

Dr. McKay 04-22-2012 22:54

Re: MegaHAL ChatBot
 
Download link is incorrect, use this instead.

davidov 04-25-2012 14:00

Re: MegaHAL ChatBot
 
Is it abble to speak in another language than english?

Oshizu 06-20-2013 13:59

Re: MegaHAL ChatBot
 
Site seems to be down.
Would it be possible for extension to be reuploaded?

- Thanks


All times are GMT -4. The time now is 20:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.