October 14, 2015

Why can't machines feel emotion?

This is a heavy topic, in my opinion. This is something that has been thrown around as a artificial intelligence stereotype since the topic of artificial intelligence via computer was thought up.

Maybe I should start with why this bias against machines was first used. In early days of computers, it was assumed that no matter how much math a computer could do, a human would always be more intelligent. Eventually, a computer was designed specifically to play chess. After beating a professional chess player with little effort, computer scientists began to see that there really was potential in computer programs surpassing human level intelligence. The idea of AI has been thrown around for centuries. Even Leonardo Da Vinci once built a robot (armor, that was controlled by a series of ropes and pulleys), to simulate AI. But now, this seemed like it was actually within reach.

Years later, the first "chat bot" was a created. A program that was designed to respond to human sentences, in a was they was comprehensible. Many people even thought that there was just talking to a regular person over a computer. However, though the program formed correct speech, and was able, to an extent, respond correctly to human input, the responses all seemed emotionless and heartless. This is where the famous serotype that all machines were "forever emotionless."


I disagree with this, completely. Though, to explain my logic, I should explain what "emotion" is. Or at least what it is in my opinion. I believe that what we think of as emotion, is nothing more then a complex scoring system. Whether you believe in evolution or not is irrelevant for this point. Simple adaptation, a quick and observable event, is all the proof that is needed to convey this reasoning. People who are loving are more likely to have families, kids, and relationships, etc. Thus, they can pass down this mental trait to their children, grandchildren, and further down the line. So imagine if a person was unable to feel. They would have nothing to motivate them to live. To encourage them to have families, or take care of those families. Their chances of having children are significantly low. Even if they did, their children would share this trait and the pattern would continue until the trait finally woven out of their family tree, from the mental traits of the other parent.

So emotion is definitely important to keep a family tree going. It can also been observed that more emotional people can also strengthen this point, as they are even more encouraged to have families, and similar. So emotion is a key factor in creating families. Ok, simple enough.

Let's move on to another point. Emotions such as fear, happiness, anger. With fear, fear keeps people alive. People with little fear are more likely to do stupid stuff, and get themselves killed. Thus, fear keeps you alive longer, and gives you more time to start a family and carry on that trait of fear to your children. Anger, gives you a boost of adrenaline to fight off threats and protect yourself, or loved ones from what your brain sees as danger. (Mental or physical.) Happiness, pleasure, and similar, gives you an objective to work towards; a purpose in life. A feeling of pride when you hold your child, or a gleam across your face when you see someone else you care about smile. That motivation also keeps us alive as a society. The drive to build better tools, stronger shelter, faster means of travel. Each of these helping the survival of humans immensely. Sadness, tells us points or things to avoid. Pain causes sadness, and pain hurts the body. So stay away from what causes you pain. Better, and longer life. Etc. I could keep going for hours, but I feel I've made my point.

Emotion has given us the ability to learn as well. Imagine if a baby was born without the ability to feel emotion in any way. It wouldn't be able to learn even simple tasks, as it would be unable to answer the simple question, "why?"

"Why should I walk? Why should I read and write? Why should I do this instead of that?"

Without being able to understand why it needs to do something, it has no reason to do it. No push. No encouragement. No remorse, no regrets, nothing to aim for, or avoid. Pain would mean nothing. Pleasure would mean nothing. It would uncaring do dangerous things without caring if it was hurt in the process. Simple just because it could. There's also a good chance it wouldn't even move. As why bother wasting the energy?

Emotion is critical in learning. And in social situations, more emotion is much stronger for learning, and survival as a whole. So is it not sort of like a goal? People always seek out to please their emotions. Avoid pain, seek pleasure, try to be happy, protect yourself with anger or fear as necessary, etc. In simple adaptation, traits that are better for a being's survival are more likely to be traced to their kids, grand kids, and enviably everyone generations down the road. Almost like a score on how helpful that trait was.


AI is no different. It has a goal, and gets a score based on that goal. If it gets a low score, it's sad. A higher score makes it happy. It is constantly surviving towards whatever makes the program said makes it happy. (I.e. Gives it a higher score.) Using multiple score situations, the AI basically can feel multiple emotions. The current score being it's current emotion. Tracking scores over long term could even translate towards long term goals, hopes, or dreams. As each AI learns in their own way, they each have their own personalities, and ideas of what makes them happy, and what doesn't. Depending on how the scores are set up, AI can have the exact same emotions as a human can. Or more, or less. Or a set that's completely different from ours in every way.

So why can't an AI feel emotion? It very well, can.



So, did I screw up somewhere? Disagree with something, or simply want to add your own input? Go ahead and leave a comment. :)

October 7, 2015

Increasing Performance in Path Finding AI

As I stated in my previous post, performance is a huge issue when it comes to simulating AI. Well, here's a swing at a way to attempt to reduce the amount of time it takes to come up with a solution. Instead of releasing all of the actions at once, release in chunks, with similar actions combined. Then, after coming up with a possible path, test each chunk to see if it can be preformed. If it can't, disable that node chunk, and check again.

For example: Imagine that you had a group of actions:

  • Move Forward
  • Turn Left
  • Turn Right
  • Sprint Forward
  • Heal
  • Fire Arrow
  • Swing Sword
Now, all of the move commands are basically under the same category. So you can simplify the whole process by changing the nodes to:
  • Move to Player
  • Move to Nearest Hiding Location
  • Run away
  • Heal
  • Fire Arrow
  • Swing Sword
Doing it this way significantly lowers the number of nodes that must be traveled in the first attempt. Though the overall amount of possible nodes is increased, the depth is much, much lower by comparison. As always, there are pros and cons to this.

Pros being obviously much higher performance, and faster calculations. Cons: Well, there is not as much flexibility as there would be without. As the AI might have found a potentially better solution to the problem that was not listed as one of your pre-made nodes. In the example above, the pathfinding may have found a spot on the bridge where it can shoot the player, dodge behind a pillar, and heal in less then a second. This solution would not have been available in the chunk based system.

Al-in-all, this solution is only reasonable if you are willing to give up some accuracy in exchange for performance. It may or may not be useful in some situations. Either way, hope this helps. xD (Sorry for the short, quick post. Just a simple idea I thought up earlier today.)

October 5, 2015

Pathfinding as Better AI

When most people think of pathfinding algorithms, such as A Star, they think of simply finding the shortest distance between two locations on a map. Although this was it's original purpose, it can be so much more then that. A lot of implementations of pathfinding take advantage of the movement cost to make the paths more realistic. Such as avoiding wall-crawling, or preferring to walk on the sidewalk instead of grass unless necessary. These are very simple operations, but yet have already rocketed the simple find-the-shortest-path to a more natural, actual walking pattern.

But why do we have to stop there?
Let's build onto this a little bit. Instead of messing with solely the cost to move to a specific node, let's add more nodes. In addition to nodes like "move north," "move south," etc. Let's add "sprint forward," and "jump forward." Then adjust the cost to include time taken, and energy consumed, and demand to get to the end as quickly as possible. By doing this, more complex paths are available. Enemies will walk around normally, but when a player starts to walk by, they will rush towards you. Possibility breaking into full sprint to get to the player if they need. Adding a maximum energy could even persuade the enemy to give up, if it becomes too difficult to reach the player. Imagine how realistic monster movement would be now!

We can go even deeper.
What if we add even more complex functions. Such as "wait," "swing sword, " "shoot bow, " "drink healing potion." At this point, imagine how much more complex the creature's intelligence will become. It could actually hide behind a pillar out of the player's sight, and shoot a bow when they're not looking. Or charge up and hit you with a sword, then run. The possibilities quickly become immense. Simple enemies are become something to fear, and computer controlled pets become the most important companions.


Pros and Cons?
Well, there are a few of each. For pros, it adds a very high intelligence simulations. And it's highly flexible.
Cons, wells, balancing the point values can be a little tricky. I'll explain how to work with scoring, below. But the biggest issues are calculating heuristics, if applicable, and performance.

Performance is something that becomes a huge resource on this. As so many more dimensions are being explored. Working even on a simple grid instantly becomes a massive chore for the CPU. In addition, if heuristics, which are already very difficult to calculate, are done incorrectly, the computer could be wondering around for quite a while before finding an acceptable path. As for heuristics, it's much harder to calculate, as now multiple paths are being explored, such as "should I sprint or not?" This effect can hugely break the outcome for algorithms that depend on it. A star can get away with it, by always setting the value to 0. Though it will take longer to find a path. (Though it will always be the most accurate path to meet your needs.

Scoring is a little weird, but easy if you use square mean. Basically, make sure all values you're scoring, raise about the same way. (Such as the all have roughly the same starting and ending values. And none level up faster then the others.) Now, for each node, get all scores for it. Raise all of them to the power of 2. And find the average. That is the cost for this cell. :)

Now, much sure for make each cell store as little memory as possible. In really difficult situations, it may take many, many nodes to find a result.



In summary, this is my proposal. It sounds great in theory, but I'll have to test it some to see how practical it would actually be in real AI. Thanks for reading, and I hope this gives you some ideas for your game/program/whatever. xD
Hello, everyone. Sorry I've been gone for so long. But, I'm back now. :)
I should be able to post again, over-killing simple concepts and ideas with unnecessary and irrelevant, over explained, information. I hope you enjoy reading my mind, again. xD