Thirst or hunger? What is more important to a dinosaur?

A drinking hadrosaur from I think the reference of the

A drinking hadrosaur from a set of 1916 German collector cards “Tiere der Urwelt” (Animals of the Prehistoric World) by Heinrich Harder, from here. (Copyright expired.)

What is more important to an animal that is very hungry and very thirsty: water or food? I just encountered this problem when writing the AI code for dinosaurs finding food and water. When ‘new’ dinosaurs are currently created in Dinosaur Island they haven’t yet eaten or drunk water so the stored values for every new animal is ‘0’. Obviously, we can, and will, change that so ‘new’ dinosaurs are created with some values (these ‘new’ dinosaurs are not ‘just hatched’ dinosaurs but rather adult animals that are created and placed on Dinosaur Island for testing purposes).

Screen capture showing a very thirsty Edmontosaurus named Gertie who is now walking towards the closest observed water. (Click to enlarge)

Screen capture showing a very thirsty Edmontosaurus named Gertie who is now walking towards the closest observable water (click to enlarge).

The above screen capture from Dinosaur Island shows a very thirsty Edmontosaurus, named Gertie, that can see fresh water (solid blue line) in a nearby tributary. It is interesting to note that because of the height of the river bank Gertie can only see the water on the far side of the tributary. Nonetheless, Gertie is now moving towards the water she can see and will stop and drink as soon as she encounters it.

While working on the AI routines for a dinosaur finding water (see also Dinosaurs, tanks and line of sight algorithms here) I realized that some dinosaurs travel in herds and that where the herd goes is the decision of the leader. Consequently, we will need to have the ability to designate one dinosaur in a group as the leader and the others as followers. Were dinosaur herds matriarchal (led by the senior female, like elephants)? Were dinosaur herds patriarchal (like buffalo)? We just don’t know the answer to these questions but we will be able to explore the possibilities by using Dinosaur Island and observing the results.SmallRule

After posting yesterday’s blog I received an email from my friend, Siobhan, who wrote, “I think dinosaurs are closer to elephants than buffalo, and thus require a matriarch.  Please tell me who I need to pay off and how to see a matriarch implemented! (that’s me subtly casting a vote).

Bribery isn’t necessary. We believe Dinosaur Island should be flexible enough to allow the user to set up any scenario they wish. Today we added the following to the ‘Dinosaur Species’ dialog box:

Just added Herd Leadership variable (Matriarch, Patriarch or Neither in bottom right). Screen capture (click to enlarge).

The just added Herd Leadership variable (Matriarch, Patriarch or Neither in bottom right). Edmontonsosaurus, by default, is now a matriarchal herd. Screen capture (click to enlarge).

Edmontosaurus regalis is now, by default, a matriarchal herd which means that the senior female decides where the herd goes, where it eats, where it drinks, where it rests and how to avoid predators. The default for Tyrannosaurus rex is ‘Neither’ or no herd leadership.



Dinosaurs, tanks and line of sight algorithms

A screen capture of MATE (Machine Analysis of Tactical Environments). Click to enlarge.

A screen capture of MATE (Machine Analysis of Tactical Environments). Note the blue armor unit (labeled ‘0’) just left of the center of the screen. Click to enlarge.

MATE screen capture showing the calculated line of sight of Armor Unit 0 (click to enlarge).

MATE screen capture showing the calculated line of sight of Armor Unit 0 (click to enlarge).

Adjusting the height of an object in MATE to calculate its line of sight (click to enlarge).

Adjusting the height of an object in MATE to calculate its line of sight.

(This article is cross-posted in my “21st Century AI” blog).

My doctoral research involved ‘computational military reasoning’¹, a phrase that I coined that means, “computers making tactical combat decisions.” My research was supported in part by DARPA (Defense Advanced Research Projects Agency, the people that really invented the internet). I was able to demonstrate in my MATE (Machine Analysis of Tactical Environments) program that a computer could make what computer scientist John Laird, called, “Human-Level” decisions and could do so very rapidly (see here for more information about MATE). Indeed, my friend, retired Lieutenant Colonel Mike Robel, once said that a computer Course of Action (COA) program like MATE was vitally important because “it’s hard to make your best decision when someone is trying to kill you.”

When I first began working on the design of Dinosaur Island I joked with some colleagues that the AI (Artificial Intelligence) wouldn’t be too difficult as I would just use my MATE program and cross out ‘tank’ and insert ‘triceratops’. There is some truth to that, as we will see today.

One of the first AI routines that I’m adding to Dinosaur Island enables the dinosaurs to find food and water. How does a dinosaur do this? Well, there are actually three ways that a dinosaur finds food and water:

  1. The dinosaur looks around for food or water.
  2. The dinosaur smells food or water.
  3. The dinosaur remembers where it last found food or water.

Right now we’re interested in the first option: looking around (this will also come in handy for spotting predators, too). How does a computer dinosaur ‘look around’?

Luckily, I’ve already solved this problem some years ago in grad school with TIGER (the predecessor of MATE). The solution is a 3D Bresenham line algorithm (I’m not going to write out the algorithm because you can see it here). The Bresenham line algorithm was invented by Jack Bresenham in 1962 when he was working at IBM and it was originally used for controlling a pen plotter (a type of printer that would pick up colored pens with a mechanical arm and draw on rolls of paper). However, if we have a 3D landscape (and we do in Dinosaur Island), we can take Bresenham’s two dimensional algorithm and extrapolate it into three dimensional space to determine if the terrain blocks an object’s view in a particular direction. If we do this in all 360 degrees and plot what can be seen (and what is obscured) we’ll have an image like the second screen shot, above.

Now, in MATE, I had to add a little dialog box so the user could input the height of the observer (the third screen shot showing the height of a tank). But in Dinosaur Island I realized that not only the height of every dinosaur can be calculated (just like the length and weight) but that taller dinosaurs, like the giant sauropods, might have a great advantage because they’ll be able to see farther. This will help them find food and water and see predators before the predators can see them.

Next, I’ll work on the ‘smell algorithm’ which will involve wind direction and speed. Luckily, I solved that problem a long time ago with a game/simulation I did in 1989 called, “UMS II: Nations at War.”


1) My doctoral thesis, “TIGER: An Unsupervised Machine Learning Tactical inference Generator,” can be download here. TIGER was an earlier version of MATE.


Dinosaur Island data structures are complete.


A section of the C# code describing the class of Dinosaurs.

Well we passed another milestone today: all the data structures for terrain, elevation, vegetation, plant species, individual plants, dinosaur species and individual dinosaurs are completed as well as all the methods for saving and loading the data and building the island, and its inhabitants in memory are completed and tested.

This is one of those milestones where the most exciting picture we can post is a screen capture of a fraction of the source code. Yes, we know, not very interesting at all.

However, it’s still a very significant milestone because now we begin working on the artificial intelligence (AI) that controls the dinosaurs. We also have a very interesting surprise for any computer science nerds out there. Here’s a hint: it involves genetics.


Chris Crawford’s First Law of Software Design

My well-read copy of Chris Crawford's, "On Game Design." It can be ordered here.

My well-read copy of Chris Crawford’s, “On Game Design.” It can be ordered here.

We recently had the wonderful opportunity to get the legendary Chris Crawford’s comments about Dinosaur Island. If you don’t know who Chris Crawford is, click here. Chris has written many famous and important computer games. The list is far too long to add here (the above link goes to his Wikipedia entry which lists some of them).

Chris has also had an extraordinary important impact on the history of computer game development. Chris was the founder of the Journal of Computer Game Development (Chris was kind enough to accept one of our articles for publication back in the day) and the Computer Game Developers Conference. Chris was also a pioneer in artificial intelligence for computer wargames (for which we cited him in one of our published papers here).

Recently, Chris took a look at Dinosaur Island and was enthusiastic about what he saw. But, he also posed his famous Chris Crawford’s First Law of Software Design: “‘what does the user DO? ¹

That’s a great question because even though we know what the user does, and we have written about it in internal design documents, we haven’t really made it clear to you, the potential user.

On Dinosaur Island the user can interact with the software on a number of levels.

  • At the ‘topmost’ level the user can simply load any one of a number of ‘pre-designed scenarios’ and use Dinosaur Island as a digital terrarium, zooming in to watch specific dinosaurs feeding, fighting, and interacting. The user can always ‘pick up’ and move dinosaurs around (once a dinosaur is selected a helicopter appears, captures the selected dinosaur and moves it to the new desired location). The user can also request to be notified when specific events occur, or record them for later viewing. The user can also make large, sweeping changes to the environment, changing the weather, reducing the health and number of plants, increasing or decreasing the water levels, etc.
  • At the next level the user can actually ‘jump in’ a dinosaur and control it.
  • At the lowest level the user can modify all the important variables that we have seen in previous blog posts like the energy requirements, growth rates, sexual maturity dates and lifespan for dinosaur and plant species. The user can create their own new islands and decide what plants and dinosaurs inhabit it.

There is no ‘right’ or ‘wrong’ way to interact with Dinosaur Island. It is designed to be fun and educational. To some extent it may be thought of as a Sim City for dinosaurs; except with the ability to ‘get under the hood’ and change the parameters of the model itself.

SmallRule1) Our good friend and the producer of our second #1 game, UMS: The Universal Military Simulator, Dan Horn, once said, “Gameplay trumps everything.” Gameplay is just another way of saying, “what does the user do?” A classic example of great gameplay, but minimal graphics is Alexey Pajitnov’s Tetris. Every game programmer in the world has said, or at least thought, “I could have written Tetris in a month.” Yes, but it’s the gameplay that makes the game not the graphics or the complexity of the programming.


Evaluating 3D engines for Dinosaur Island

Herd of Brachiosaurus at night by Ed Isenberg (click to enlarge).

Herd of Brachiosaurus at night by Ed Isenberg (click to enlarge).

Three dimensional models of things like dinosaurs are created using modeling programs like Maya, Lightwave and 3DS Max. When these models are completed they can be placed in an environment and rendered in real-time using a ‘3D engine’. There are a number of 3D engines available to game designers. We’re now at the stage of development of Dinosaur Island where we need to look at all the products that are out there, evaluate them, do some tests and make a decision as to what works (and looks) best.

Our main concerns are what engines make it easy to import our data (the island itself, the terrain, the plants and the dinosaurs) how will it support our artificial intelligence (AI) routines and, of course, what looks great.

So screen shots of the island in 3D should be coming soon!