Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I hope I didn't seem to be implying there weren't hard problems in both fields-- but I do think there's a bigger gap in the current state of the art than you claim.

The path to realism in graphics is pretty clear because the real-world behavior of light is well-understood. There may be equations yet to be perfected, and challenges in efficiently simulating that behavior, but the direction is never in question; you can always tell if you've made it look more realistic or less.

By contrast, AI in games has reached a local maxima; the combination of pathfinding, scripted cues, an elaborate finite state machine, and a few basic heuristics is capable of simulating human behavior well enough, and with few enough glitches, that it presents a realistic universe to the player so long as they don't exceed the scripted bounds. However, if they do exceed those bounds, the whole thing appears paper-thin. You can extend the bounds with additional effort in scripting, but not infinitely, and with diminishing returns-- and doing so gets you no closer to having real AI which would be able to make those same decisions on its own.

Striking out and attempting to make an intelligent NPC-directed world from scratch... I'm not saying it's impossible, but I haven't seen anything, from AAA titles to indie games to tech demos, to imply it's coming soon.

But maybe that's just because I haven't seen the Minecraft of AI-driven gameplay yet.



Good points :)

I am actually working on such an AI system, believe it or not (As I am sure quite a few others are)! I don't doubt my algorithms, because I have already prototyped them and they work (at least well enough to create some interesting, if flawed gameplay), but I do doubt that I will ever get a game out that uses them effectively (making even a simple game is incredibly hard, and I have a bad habit of creating overly-complex stuff).

Your traditional AAA game does, as you mention, basically use finite state machines to determine enemy behavior (and incredibly simple ones, at that).

Why is a FSM bad?

Because someone MUST explicitly declare every combination of situation, and the paths between them.

How does my system work? It uses a combination of AI techniques that have been around a long time (just never used effectively in games).

1) Rules and queries (like prolog), with backwards chaining and propositional logic (basically a big, graph-based system). How might this work? Let's pose a few fake rules and a query. A) apples are red B) oranges are orange. C) apples and oranges are fruit D) red fruit is good...QUERY: are apples good? Using backwards chaining, this can easily be deduced.

2) Motivators and deterrents. Every NPC has their own set of motivations, as well as "bad" things they try to avoid. They attempt to maximize their output towards attaining their goals, prioritized with various points (i.e. get food: 1 point, stay alive: 10,000 points, etc)....the best outcome can be found with any traditional AI system (like a minmax tree, A*, or whatever is appropriate for the given case). This is not just about food or living, but can be emotional concepts like "seek happiness" or concepts that involve the physical world "find shelter"...

3) Basic AI for sensory and locomotion purposes (line of site, perception, planning, gathering knowledge, etc.)

4) Abstraction of communication -- not at the syntactical level, and not at the grammar level, but in its crudest terms ("higher level language")...I call it caveman-speak but there has to be a better phrase...i.e. "Me Hungry" or "Why You Steal" -- using sentence fragments, you can construct a variety of phrases without giving the computer a hard time interpreting it. On the surface, you can throw in the syntactical sugar to make it sound less crude to the user, but on the backend writing a full-blown english parser is not a wise idea.

5) There is more, but I won't type it out here...

In the simplest terms, think of it like an empty stage in a play. There is no director (Finite State Machine) but there are characters and props, and the characters have backstories/motivations/genetic makeup/birthrights that determine what they will do and how they will react to changes in their environment. When you have rules, motivators, and a knowledge base, you can let the AI run wild -- and producing new rules grows with linear complexity, rather than exponential (as with a FSM).

Alternatively, if you even played the Sims, imagine something like that, but with more comprehensive AI (NPCs seek to maximize their comfort levels (id) while acting within their restraints (ego/super ego)).

You can track my progress (or lack thereof) at gavanw.com...unfortunately I work a fulltime job in addition, so development is occasionally slow.


Very interesting, with your work on voxels will modellers soon have to model the inside of objects - eg) Rather than modelling the human 'skin', model each part - clothes, body, tissue, bone?


Well, traditional polygon-based systems will be around a long time, but I do plan to keep everything volumetric in my engine. However, for the most part a lot of the volumes are procedurally generated (i.e. the wood pattern inside a trunk is a function of distance and angle from the trunk's center).


Sounds like the Minecraft of AI-driven gameplay... I would like to subscribe to your newsletter :)


Sign me up as well. I look forward to small-scale deployments of more 'genuine' AI in games.


That makes 2 subscribers ;)


Make that 3.

I've always wondered why game rules have to be so rigid (use a state machine) and always thought it was the technology but what you described makes sense and makes use of older technology but in new applications.

I just took one AI course while in college but got hooked ever since.

Question: Can you expand on the motivators and deterrents concept? Specifically, how do you relate something like "getting food" with the world objects? Assigning points to specific world objects(apple, cow, chicken...) seems to get us back to a state-machine like game. Humans have experience (memory and patterns) to guide them, what would the characters have?


Yes, to answer your question, there are many ways to go about implementing it, but here is how I do it:

In reality, you have one knowledge base, which is simply a set of facts/rules about the world. For example...

a) berries are fruit b) red fruit is good (+1 score) c) green fruit is bad (-1 score) d) enemies are dangerous e) eating while in danger is bad (-10 score) f) eating while full is bad (-2 points)

In a finite state machine, you would have to have several combinations of state (are berries present? are enemies present? are you full? etc). Say (for argument's sake) you have 5 possible states (binary). In a FSM, this would have 32 possible permutations of the states, which all must have corresponding actions associated with them. In a motivation based system, it simply evaluates each state individually, and adds up the points. It chooses to pursue the state that gives the most points. So, here, that would be eating red fruit while enemies are not present.

The way prolog-like systems work, the computer does not have to have ANY idea what food or hunger or anything like that is -- it can be completely oblivious to abstract concepts. All it is doing, in essence, is (searching for and) matching strings. Those strings are the identifiers used for classes (or instances) of game world objects, NPCs, etc. So if you gave an NPC a motivator (kill(enemy) = +10 points, Bob = enemy, get_caught_doing(kill) = -100 points), it will find the best way to kill Bob while avoiding negative consequences. This is (obviously) metacode, and the actual implementation would require better organization and more explicit syntax.

Make sense?


Yup, makes sense.

I have written exactly 15 lines of prolog but I'm somewhat aware of how they work. This is great stuff, but as you said the devil is in the details. Please consider writing up your experiences and sharing it on HN.


Definitely, will do :) It is also encouraging to see that people are interested in this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: