AI

I had an excellent play-mechanic in hand, but now I needed some AI to control the computer people. How were they to respond to the gossip they heard?

At this point, it is worthwhile to point out the obvious: The solutions I describe never came quickly. I can't remember the many trials and errors I pursued, but there were quite a few. Weeks rolled by while I struggled with these problems. The gap between problem and solution in this book is often just a line of text, but in the real world it was much greater, and the eventual solution was nowhere near as clear as I present it here; most of the time I bumbled towards it in a reverse Drunkard's Walk (that's an old mathematical problem), eventually getting myself to the street light.

The solution that I eventually chanced upon relied, once again, on an analogy with the real world. In this case, I imagined the social system in the game to be rather like a set of springs tied together. Each person represented one node; seven springs, one for every other person, were tied to that person. Each spring had a "desired length" given by the affection that the one person held for the other. Now, if you tried to build such a system, you'd get a tangled mess, but in the pure mountain air of software, tangles don't exist. The idea is that each spring pushes two people apart or pulls them together; if you let the system "relax," the springs will all push and tug at each other until each person is in his optimal social position relative to the others. Good friends are close; hated enemies are far away.

LESSON 44

With enough imagination, you can find models to solve any problem.

This imagined environment could easily be simulated on the computer, and it suggested the solution: Each person should attempt to reduce the spring tensions around him. If one spring pulls him one way and another spring pulls him the other, he'll seek to release the tension by moving toward or away from somebody else. The calculation for all this is not difficult; it's a simple physics problem. So, with a snap of my fingers, the AI was ready to go.



Chris Crawford on Game Design
Chris Crawford on Game Design
ISBN: 0131460994
EAN: 2147483647
Year: 2006
Pages: 248

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net