Share your repls and programming experiences

← Back to all posts
Critical Role Markov Chain!
h
21natzil

Good Morning Replitors!

My favorite show of all time, Critical Role, is at a bit of a standstill due to COVID-19. Therefore, I decided to spend the time and write my own Critical Role episodes! Not by hand of course, but with Machine Learning.

To generate the scripts, I use a Markov Chain. I'm not an expert in AI in any way, but from what I can tell, it generates sentences based on the probability of what words would follow other words. I've trained my Markov Chain based on transcripts from almost every episode of Critical Role Season 2. In theory, it shouldn't generate sentences that are the same from the show.

The sentences don't tend to make a lot of sense. However, the kinds of things characters talk about is very accurate. Liam, the wizard, is usually talking about spells. Matt is usually talking as a narrator. I also never explicitly told the bot to start with their name and then :, but it was able to pick that up consistently.

Overall I'm quite happy how this turned out. Until I can figure out a way for them to somewhat maintain the same context, I don't think I'll be making any scripts. If you're not familiar with Critical Role, then what are you doing? Go check it out! But the sentences might make even less sense. If you are familiar with it, I hope you enjoy it, and the sentences it makes for you make sense too!

Instructions

Run the repl, press enter (or type in load, then enter), and then wait for the AI to load (this may take a minute). Once it's loaded, press enter to generate a new line! Enjoy!

Voters
Warhawk947
eric_wang
Codemonkey51
yeetuscleetus
Roar123
21natzil
Comments
hotnewtop
RussellCampbel1

Perfectly! It helped me quite a bit, I think it's worth spreading. I am currently working on writing a critical thinking essay and reading a bit about it on this site and I think I will use your ideas because my essay is about refuting some computer myths. Thank you for the information.

Warhawk947

zwack moment

Codemonkey51

ERRROR

21natzil

@Codemonkey51 Hmm, yeah that happens because it uses a lot of resources. Try changing the state_size to 2 and compiling your own AI, granted it will take a minute or 2 to compile.

Codemonkey51

Cool!

replitjeremy

@replitjeremy this is cool!

Roar123

This is pretty cool but does it need information from all of those text files :)
Wait for it . . . Wait for it . . . 5 minutes later . . . am I a victim of the Sunk Cost fallacy . . .
Noooo! I waited for so long and the program ended!


Can you please fix this and reduce the wait time? Surely your Markov chain will still be intelligent with 1/4 of the text files

21natzil

@Roar123 That's because you typed new, which generates the AI from scratch. Just type "load" or nothing and hit enter, it should use the pre-made AI.

21natzil

@Roar123 The more files, the better it'll be!

Roar123

@21natzil This is actually really cool! I think what happened is I tried load first but nothing happened (because of the time delay) so I restarted the program and tried new which atleast looked like something was happening. Thanks for explaining to me!

21natzil

@Roar123 Glad you enjoyed it!