I think we should start with the basics. I was pondering about this since I left work yesterday, and this is what I think we need to start with:
First, we should have a variable to represent Mood (Ayumi.Mood). It should be able to go from -100 to 100 with anything negative being unhappy, anything positive being happy. Ayumi should start at 0, and we’ll need to start as if she’s a baby.
Give her a simple rule: The lower her Mood is, the less happy she is, and she should try to keep her happyness high, but if she is content (Mood=0), then she should relax.
That general rule, is pretty much the one rule that (to me) all life forms seem to possess. It’s simple. But here’s where we incorporate it:
As time progresses, her energy will decrease (Ayumi.Energy–). Energy is needed to function, and after several hours, she will need to sleep, which slowly recovers her energy. So, if Ayumi’s been awake for 16 hours, she’ll need to go to sleep, and by then her energy will be pretty low.
Food also increase energy, and our bodies feel hungry when it is time to recharge. We should have a hunger variable (Ayumi.Hunger), and to keep it true, it should be a number from -10 to 100. Between -10 and 0, she is still ‘digesting’ her last meal, and not at all hungry. As time goes on, the hunger value will increase, and she will start to get hungry when it hits 1. Now, we don’t want her running to the fridge everytime her hunger hits 1, most people don’t do that (though there are some that do, and they have to book 2 seats on an airplane for just themselves whenever they fly), but what we can do, is add an algorithm that will say every interval (whether it’s a minute or a second, or an hour), her hunger will go up, and her mood will go down by 1/4 of the current value of hunger, rounded down, and she should get enough to want to eat hungry around 3.5 times a day.
The code might look something like this:
if (timer == interval) {
Ayumi.Hunger--;
Ayumi.Mood -= Math.Floor( Ayumi.Hunger / 4 );
if (Ayumi.Mood < 0 ) {
CheckMood;
};
};
Please excuse any syntax errors, I haven’t really done a lot of math actionscripting in a loooong time, and I’m not at my PC at home to check my syntax… but you should get the idea…
Anyway, so now her mood is going down while she’s hunrgy… so, if we put the Rule into place that says if she’s unhappy, she should try to find a way to be happy again, we would call our CheckMood procedure.
CheckMood would basically try to get her to figure out what’s making her uncomfortable. In this case, the only thing it COULD be is Hunger, so right now our CheckMood should simply say:
if (Hunger > 0) {
Ayumi.Status.Hungry = True;
};
so that she’ll know she’s hungry. Now, another piece should come into play. She should already know (since it is a basic animal instinct) that if Hunger == True, then To make Hunger != True, you EatFood.
Any objects in her world that are food, should have: Object.Type = Food as a property, and (hopefully) she won’t have to be told which items are food, 'cause if you’re hungry, you’re not going to have to try and figure out: Does Ball==Food? Does Rock==Food?
She should be able to walk over to the nearest source of food, and eat it. This will Send her hunger value back down, in an amount based on how much food there is, and will hopefully raise her mood, depending on if she likes it or not. Candy may only lower hunger a little, but raise mood alot, and broccoli may lower hunger a lot, but lower mood. (Once we get real advanced, we can try to make her “remember” which foods she likes, and does’t like.) Now, to make things have a little consequence, we could add another variable, which I haven’t thought of a name for yet, something like: ExcessFood, or something, so that if she over-eats, this value will increase, and she’ll have to burn energy to lower it, or risk either getting sick, and/or getting fat. This is just the very beggining of what we can do with food and hunger, and we can branch out from here.
Q: Do you think we should start trying to ‘officiallize’ this project? Get a list of names of people who are 100% devoted to the project, and start getting things together? It may be a good idea, since I see this thing going places if we really work together. I’ll be (finally) getting my motherboard replaced within the next week, so I can get a server going, if we all agree on it.