Integration with PyBrain?

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
EwanG
Miko-Class Veteran
Posts: 711
Joined: Thu Oct 26, 2006 5:37 pm
Location: San Antonio, TX
Contact:

Integration with PyBrain?

#1 Post by EwanG » Sun Jan 06, 2013 5:39 pm

Imagine, if you will, a RenPy VN where the game starts by interviewing the player for a couple of minutes, and then uses a Neural Network to find the "personalities" that you would find most interesting to interact with. It then matches these to pre-defined art you have shipped with the game, and then continues to integrate your basic story with the other personalities defined so that you could play the same game twice, but not have it be the same game twice.

Or possibly even you write the first few chapters for all the personalities you will support, and then once the nn sees how the player and the personality interacts, continues to play beyond what you wrote...

Just a couple of scenarios that I could see being possible with an integrated Neural Network such as PyBrain. Given that it is already designed to work with Python, I suspect the bigger problem would be getting it to parse RenPy syntax. But perhaps it's simply a matter of interfacing it "behind the scenes"?

Am just wondering whether this is something other folks would be interested in, and if it's something PyTom might be interested in adding?
Working on something... might even be something good :D

User avatar
PyTom
Ren'Py Creator
Posts: 15447
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Integration with PyBrain?

#2 Post by PyTom » Sun Jan 06, 2013 7:03 pm

Are you offering to code it up?

From what I understand, automatic story generation is an active research area. A system that could automatically generate a visual novel - a coherent one that's fun to read - would be a huge endeavor, and would likely advance the state of the art. I don't think that neural nets would be the right way to do it - perhaps some sort of L-system would work. In any case, a project like this is Ph.D. level work - for example, this forum spam from 2011, which generated:
A trumpeter marched into battle in the van of the army and put courage into his
comrades by his warlike tunes. Being captured by the enemy, he begged for
his life, and said, “Do not put me to death; I have killed no one: indeed, I have
no weapons, but carry with me only my trumpet here.” But his captors replied,
“That is only the more reason why we should take your life; for, though you
do not fight yourself, you stir up others to do so.”
We don't see people generating short stories or novels - I don't think we'll be generating VNs any time soon, either.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
EwanG
Miko-Class Veteran
Posts: 711
Joined: Thu Oct 26, 2006 5:37 pm
Location: San Antonio, TX
Contact:

Re: Integration with PyBrain?

#3 Post by EwanG » Sun Jan 06, 2013 7:43 pm

Not so much generating a full VN as building on a scaffolding. I know there are systems that have "written" articles and short stories, and so my thought was that if I build a "pattern" it would be possible to extend that using rules that were setup.

I gather that your preference would be to see what someone could do with it, and then offer it up as a possible extension to include in a future version. So let me see if there's something that looks like a good fit.
Working on something... might even be something good :D

ThisIsNoName
Veteran
Posts: 311
Joined: Fri Feb 10, 2012 10:15 pm
Contact:

Re: Integration with PyBrain?

#4 Post by ThisIsNoName » Wed Jan 09, 2013 10:13 am

So, just to make it clear, would this be used as a tool for creators or as part of a game, like a story generator?

I think one thing I would really like to see neural networks applied to is RPG conversation systems. For example, in the Mass Effect series, you can take renegade or paragon (evil or good, respectively) decisions willy-nilly and it doesn't affect future decisions as long as you meet a certain total of points.

What would be really cool is if, instead of simply tallying up points for good and evil decisions, it analyzed the decisions you made as a whole. So, if you make good decisions where the bad decisions would have been more profitable and/or easier, the game would treat you as a good guy. But if you just made the easiest decisions, it would treat you as an opportunist. If you went out of your way to make meaningless evil decisions that don't really affect the plot, it would treat you as a troll, etc.

User avatar
EwanG
Miko-Class Veteran
Posts: 711
Joined: Thu Oct 26, 2006 5:37 pm
Location: San Antonio, TX
Contact:

Re: Integration with PyBrain?

#5 Post by EwanG » Wed Jan 09, 2013 12:11 pm

ThisIsNoName wrote:So, just to make it clear, would this be used as a tool for creators or as part of a game, like a story generator?
There would need to be a bit of each. For the creator, you would need to have the ability to "train" the network, and then specify which things it could (or couldn't) touch in the game. Then there would need to be the trained part that would go with the game to execute as the items came in.

I've so far had just enough time to look at this to get some ideas of how it might be done, but I still have the issue at the end of the day that I can choose to help extend a tool, or I can choose to build a game. Hopefully the games start getting successful enough that helping with the tool can become the "hobby" :-)
Working on something... might even be something good :D

ThisIsNoName
Veteran
Posts: 311
Joined: Fri Feb 10, 2012 10:15 pm
Contact:

Re: Integration with PyBrain?

#6 Post by ThisIsNoName » Wed Jan 09, 2013 12:45 pm

EwanG wrote:There would need to be a bit of each. For the creator, you would need to have the ability to "train" the network, and then specify which things it could (or couldn't) touch in the game. Then there would need to be the trained part that would go with the game to execute as the items came in.
Ah. I was trying to figure out how it would be trained.

Anyways, I'm not sure I would be able to help a whole lot, considering that I'm just starting to learn about NNs, but you can consider me interested. :)

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Integration with PyBrain?

#7 Post by Ryue » Wed Jan 09, 2013 1:04 pm

EwanG wrote:
ThisIsNoName wrote:So, just to make it clear, would this be used as a tool for creators or as part of a game, like a story generator?
There would need to be a bit of each. For the creator, you would need to have the ability to "train" the network, and then specify which things it could (or couldn't) touch in the game. Then there would need to be the trained part that would go with the game to execute as the items came in.

I've so far had just enough time to look at this to get some ideas of how it might be done, but I still have the issue at the end of the day that I can choose to help extend a tool, or I can choose to build a game. Hopefully the games start getting successful enough that helping with the tool can become the "hobby" :-)
Question is if a neural network of that magnitude can be used on a "normal" pc. Or if you would need to get a connection to a server farm in the end.
I'm not that much into neural networks but I know a few genetic algorithms and even on modern pc's they CAN take some time to do their calculations and I guess
that a neural network will be more processor intensive (at least during the training phase).

User avatar
TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Integration with PyBrain?

#8 Post by TrickWithAKnife » Thu Jan 10, 2013 11:02 pm

While PyBrain does sound exciting, I can't see the advantage of using it in VNs.

I do agree that it is great if games are able to look closely at the players actions, rather than just lumping it into "good" or "bad" categories, but that isn't that hard to do with proper planning, good writing and variables.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

ThisIsNoName
Veteran
Posts: 311
Joined: Fri Feb 10, 2012 10:15 pm
Contact:

Re: Integration with PyBrain?

#9 Post by ThisIsNoName » Fri Jan 11, 2013 11:52 pm

Like I said earlier, I'm still learning about NNs, so feel free to correct me if I get something wrong.

From a player's point of view, it wouldn't make a whole lot of difference, but the background of the game would be completely different. Instead of setting separate variables that the game would look at to make decisions, a neural network has a sense of "state" (as in "state of matter") that the game looks at. So, using Mass Effect as an example, what characters you choose to go on a mission with, what you shoot at, how often you shoot, and even the abilities you choose all effect this "state". The computer can then use this to make decisions that are independent of each individual variable, but are affected by all of them.

User avatar
EwanG
Miko-Class Veteran
Posts: 711
Joined: Thu Oct 26, 2006 5:37 pm
Location: San Antonio, TX
Contact:

Re: Integration with PyBrain?

#10 Post by EwanG » Sat Jan 12, 2013 6:18 am

Or, to give the specific example I'm thinking of, there was a study done a couple of years ago (talked about in a BBC article) on a questionnaire a social scientist came up with to foster closeness. So I would train a NN with a Tsundere personality, a Imouto personality, etc - and then the game has the player walking through that questionnaire with each of the personalities. That would get old fast if you ended at the end of the questionnaire. But partner it with some semantic tool, and you could let the player pick the personality they wanted to continue to play with, and let the NN drive the responses.

Obviously I don't have the skill to pull off a full Turing client. But if I constrain the field to experiences that the player and the NN are given to react to, I should be able to give a "plausible" result.

Again, not something I will be doing tomorrow. But hopefully someday :-)
Working on something... might even be something good :D

User avatar
pkt
Veteran
Posts: 322
Joined: Tue Jul 28, 2009 10:09 pm
Completed: I dunno
Projects: Something special
Contact:

Re: Integration with PyBrain?

#11 Post by pkt » Wed Feb 20, 2013 8:12 pm

This is the area in which I have put in a lot of thought since I was a baby even...now the problem of tailoring a story is practically two parts...generating the story from loose parts...and finally mixing those parts to match...if you want to throw in another step to say tailor it to a mood or thought pattern or personality then that part is kinda like a type of thing where you need to analyze these input structures into categories and the next part is subtle tweaks to the story to suit the mood...I'm saying you don't have to kill off a character or swing the plot wildly in the wind to go with a mood swing but the other part is from my times going with all of this is all of the technology to do this and more has been here...I've seen and used it...the next part is integrating it into renpy...I personally see renpy as kind of like a platform that sits on python as java does to the os...as such renpy + python forms a greater tool than java could in my mind at least because in python a lot of it is constructed in text but that text can sit on top of java itself so there's that too...text being transformable and morphable more readily and human readably than bytes structures might be a thing where when all of the tools are put together that this will all form a bridge where we write directly from our thoughts and branches in thoughts are anticipated and noted as such it could all take a simple structure of computers or a simple device programmed right to really go the next step and write out the paths...we'll think about how the basic thing should be and the world will shift around us maybe at first digitally and later physically to suit thoughts and moods...the psychic thing I also study covers parts of the implications of these things on the outside world as it is and really I could go on and on about this...

tl;dr
write a story in small branching chunks and the rest should be easy...
No Active Public Renpy Projects...

Post Reply

Who is online

Users browsing this forum: No registered users