Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Pie in the sky daydreaming: DF as an AI testbed  (Read 696 times)

Malenfant

  • Bay Watcher
    • View Profile
Pie in the sky daydreaming: DF as an AI testbed
« on: October 26, 2007, 11:02:00 am »

This isn't so much a suggestion as a bit of idle ‘pie in the sky’ daydreaming. It occurred to me that DF would make the ideal testbed for some pretty awesome GA* based AI.

I can picture each fortress been housed with a breeding population of self directing dwarfs whose AI is based on an initial hand crafted external script.

Those who fail would die in the game; those who succeed would go on to breed and further the fortress. Emigrants would be handled by importing the genetic profiles of other player’s fortresses.

Bold adventurer AIs could also be evolved; left in the wilderness to fend for themselves they could over time become crafty heroes of the wilderness.

Hell you could even turn the animals over to GA scripts, let the DF ecosystem dictate the survival of the fittest.

* Genetic Algorithms:

http://en.wikipedia.org/wiki/Genetic_algorithm  

http://www.gignews.com/gregjames1.htm  

http://library.thinkquest.org/18242/ga.shtml

[ October 26, 2007: Message edited by: Malenfant ]

[ October 26, 2007: Message edited by: Malenfant ]

Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #1 on: October 26, 2007, 01:19:00 pm »

This sound like a good idea...  :)
... if you have a supercomputer and a couple of millennia on hand.  :(

I think really DF is to demanding for the computer for tis to work, what length would a generation be?
Some simpler DF-like environment on the other hand...
Like kobold quest, in a large world or with digging maybe, and kobold quest is open source...

Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

JT

  • Bay Watcher
  • Explosively Canadian
    • View Profile
    • http://www.jtgibson.ca/df/
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #2 on: October 27, 2007, 05:18:00 pm »

The problem with genetic algorithms is that they're about 1 billion years too late.  All of the true genetic lifeforms on this planet have had a billion years to work out bugs in their software, and we have core ideas like instincts, hormones, and basic carnal needs to influence our behaviour in the fashion that is most successful (protip: 10% of surviving in today's society is skill, the rest is going with your gut).  In the year 1,000,002,008 I'm sure we'll have some kick-ass genetic AI, but until then...

I'm also reminded of how the U.S. Department of Defense tried to make a neural-net AI (admittedly not a genetic algorithm, but vaguely similar) which would identify tanks in photographs.  They ultimately got the AI to give a 100% accuracy on all of the test photos, so they started testing it in the field and found it had only roughly a 25% accuracy.  Perplexed, they looked for what could possibly account for the discrepancy.  Turns out, all of the test pictures that they used were taken on cloudy days, so the AI simply reported whether the picture was taken on a cloudy day or not.

No idea whether that's a real story, but it's hilarious even if it's just a joke.

[ October 27, 2007: Message edited by: JT ]

Logged
"The very existence of flamethrowers proves that some time, somewhere, someone said to themselves, 'You know, I want to set those people over there on fire, but I'm just not close enough to get the job done.'" --George Carlin

Zemat

  • Bay Watcher
  • Zemat, programmer, cancels coding: Too insane.
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #3 on: April 24, 2008, 11:52:00 pm »

Sorry to revive this old thread but it just occurred to me the same idea of applying Genetic Algorithms to DF. I wish to put my two cents and flesh out this a little bit more and make it feasible and easy to implement.

First of all. Maybe in real life GAs are overrated. But, I believe, they are mostly being used in the wrong way (Disclaimer: I'm a GA researcher). Regardless, in games and simulations GAs have a lot of potential and, unlike Neural Networks, are very easy to implement and use. Already some games like Europa Universalis: Rome implement simple GAs so that ingame characters inherit traits from their parents.

Toady already uses parameters to define the personalities and base skills of each dwarf so implementing a crude but functional GA wouldn't really take too much effort. Selection and fitness functions aren't needed at all because the game itself and the players do all the hard GA stuff already. So really all that Toady needs to do is just implement a way so that dwarves inherit some of their parent's attributes and Voila! DF has a working Genetic Algorithm!

The idea is simply to use a combination (crossover) of the personality and physical parameters of the parent dwarves to generate a child's parameter values instead of just randomizing them each time a new baby is born. A little mutation could be added so that each new child doesn't end up being just a clone of each parent. Also, dwarves could have initial bonuses or penalties that could be inherited, like a tendency to get sick more often or heal wounds faster or learn faster. A single parameter could act both as a bonus/penalty for two different stats (like intelligence/strength) so that a fortress doesn't end up full of dwarves having the best stats in all categories after some time.

Think of this. If a player plays a survivalist fort where dwarves have a hard time surviving they will end up being hardy and brute dwarves that survive anything and don't get stressed up but are hardly sociable or creative just after a few generations. While a player who manages too well it's fortress will end up with highly creative and productive but ultimately wuss dwarves that will succumb to a rather mild siege if the player gets caught off-guard.

[ April 25, 2008: Message edited by: Zemat ]

Logged
You too can help bring to life the RogueLife Project!

Kagus

  • Bay Watcher
  • Olive oil. Don't you?
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #4 on: April 25, 2008, 12:07:00 am »

"Diggles: the Myth of Fenris" and "Creatures" come to mind.


Still though, it would most likely require a pretty big reworking of the way creatures are handled, because right now it's about as simple as you can make it.  You want a creature spawned?  Look for the tag in one of the creature_*.txt files, and just read the information there.  Voila, instant elephant!  

To handle the genetics of creatures, it would have to treat the information in each creature as a little more important, and possibly add on several new facets for creatures to be defined by.  It would need to track even the "unimportant" critters just to have the information ready for when/if they were to breed.  


However, this is really just a "dream" thread, so we can think as much as we want about how cool this would be if it were implemented.

Zemat

  • Bay Watcher
  • Zemat, programmer, cancels coding: Too insane.
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #5 on: April 25, 2008, 01:39:00 am »

Well, I know Toady always thinks big and, if he ever tried to implement genetics he probably would try do so for every creature and make it more complex. Yet I guess a simple version could be implemented that worked only with dwarves for starters and only with those stats that already are different from dwarf to dwarf. Is not like Toady implements all features for all creatures. We don't see creatures other than dwarves and humanoids eating, drinking or sleeping. So I don't see why genetics needs to be implemented for all creatures in order to be playable.
Logged
You too can help bring to life the RogueLife Project!

Cajoes

  • Bay Watcher
  • "I'm a damn cat."
    • View Profile
    • http://none
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #6 on: April 25, 2008, 07:32:00 am »

Because some people are sticklers for absolute redundant flawless perfection.

And should be shot.

That said, evolution had to start from mono-atomic amino acid scratch to produce the results that is now typing out sapient thoughts to a disregarding audience. I'm sure a few IBM brand super-clusters could get some interesting results within the next ice-age or so.

Or we could just hash off the results from the Human Genome project and work from there.

Anyone got a pen?

Logged
Quote from: Roman Proverb
Do not argue against the sun. For it is a lot brighter than you are.

Mikademus

  • Bay Watcher
  • Pirate ninja dwarves for great justice
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #7 on: April 25, 2008, 07:45:00 am »

quote:
Originally posted by Armok:
<STRONG>This sound like a good idea...   :)
... if you have a supercomputer and a couple of millennia on hand.   :(

I think really DF is to demanding for the computer for tis to work, what length would a generation be?
Some simpler DF-like environment on the other hand...
Like kobold quest, in a large world or with digging maybe, and kobold quest is open source...</STRONG>


Replying to an old post, but: nah. GAs are not computationally expensive, since you're not simulating neural networks but only applying very basic algorithms to a relatively well-defined problem. It is not CPU cost that is a blocking stone to GAs in DF but rather to make a good implementation that positively contributes to the game. On the other hand, a simplified implementation might be very suitable for this kind of game (or any generational simulation).

Logged
You are a pirate!

Quote from: Silverionmox
Quote from: bjlong
If I wanted to recreate the world of one of my favorite stories, I should be able to specify that there is a civilization called Groan, ruled by Earls from a castle called Gormanghast.
You won't have trouble supplying the Countess with cats, or producing the annual idols to be offerred to the castle. Every fortress is a pale reflection of Ghormenghast..

Normandy

  • Bay Watcher
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #8 on: April 25, 2008, 11:36:00 am »

I am against such an implementation. What would become of my elaborate trap system built to take advantage of the AI? Those spike traps don't fill themselves with corpses, you know.
Logged

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #9 on: April 25, 2008, 04:42:00 pm »

I like the idea.  Instead of the goblins wandering in between those massive fortificationed valley full of corpses and broken, bloody bolts, They might figure out that it's actually much safer to just jump down one z-level and attack the trader entrance.

Course this is probably a step up from what is suggested, once we can start breeding nobles for easy mandates it would be the next step.

Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

Drunken

  • Bay Watcher
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #10 on: April 25, 2008, 10:55:00 pm »

the goblins that attack you are not bred from goblins who survived the traps but from goblins that haven't attacked you yet. Therefore if that logic were applied it would result in less warlike goblins and less invasions not an ability to survive or avoid traps. Mind you some random traits might make them start avoiding traps more often and if they survived they could breed...
Logged
A stopped clock is right for exactly two infinitessimal moments every day.
A working clock on the other hand is almost never ever exactly right.

Mikademus

  • Bay Watcher
  • Pirate ninja dwarves for great justice
    • View Profile
Re: Pie in the sky daydreaming: DF as an AI testbed
« Reply #11 on: April 26, 2008, 08:53:00 am »

quote:
Originally posted by Drunken:
<STRONG>the goblins that attack you are not bred from goblins who survived the traps but from goblins that haven't attacked you yet. Therefore if that logic were applied it would result in less warlike goblins and less invasions not an ability to survive or avoid traps. Mind you some random traits might make them start avoiding traps more often and if they survived they could breed...</STRONG>

That is assuming (1) that the only goblins allowed to breed are the survivors from besieging your fortress, and (2) that battle-mettle is not the selection criteria for worthiness itself for goblins.

Logged
You are a pirate!

Quote from: Silverionmox
Quote from: bjlong
If I wanted to recreate the world of one of my favorite stories, I should be able to specify that there is a civilization called Groan, ruled by Earls from a castle called Gormanghast.
You won't have trouble supplying the Countess with cats, or producing the annual idols to be offerred to the castle. Every fortress is a pale reflection of Ghormenghast..