Monster Artificial Intelligence

This is an archive of the Dungeon Master Encyclopaedia forum
Locked
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Monster Artificial Intelligence

Post by Paul Stevens »

I have decided to try (once again) to understand a little
bit of how the monsters operate. To this end I have first
drawn a VERY VERY VERY simplified diagram of the program's
flow of control when a monster movement timer expires.
You can view/fetch the diagram at:

dianneandpaul.net in the /CSBwin/Documentation folder.
Its name is 'monster.gif'.

You will see that the code is not well-structured. I want
to simplify the diagram. I will probably start by duplicating
some of the pieces in many places to try and make the
diagram 'flatter'. This is dangerous work, however. It is
rather fragile code and the fact that I do not understand
it makes it likely that I will break something. Testing the
result will be an important part of the process.

Testing requires that I compare the new code with the old
code. For that I need a few (the more the better) recorded
games. I will make a nice long CSB game with lots of
combat. I could make a DM, too, but it would be a lot better
if someone else could provide such a game. Better because
our playing styles are so different.

So this is a request for help. Can anyone provide a complete
recorded game using CSBwin version 9.6? Any game will do.
DM, CSB, or any other....provided I can get the proper files
to be able to play it back. And the more combat, the better,
since combat is what I will be changing.

Your reward? Perhaps we will all have a better understanding
of the monsters' artificial intelligence. And I will be posting
notes and diagrams as I make them for my own use.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Monster Artificial Intelligence

Post by Paul Stevens »

I have posted my first approximation to a structured
program for monster AI. dianneandpaul.net in the
csb/documentation named monster_A.gif.

It ain't pretty yet but it is less ugly. I am using my own
CSB game and the new 38-minute DM game as tests.
I could still very much use one or two more complete games.

The program is going to get somewhat manageable. I see
two loops right now: d302-d3cc-d63c-d6d6-d302 and
d28a-d36e-d28a. They are small and the rest looks
like it can be made straight-through. I am going to
concentrate of making those loops nice looking. Not sure
I can do it reasonably because one of them has more than
one entry point.

If anyone would like to help make heads-or-tails of any
of this code - like adding comments or figuring out what
some variable represents - I would be more than happy
to post the most recent code itself.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Monster Artificial Intelligence

Post by Paul Stevens »

The Monster AI routine is yielding slowly. Compare

Monster_B.gif in the CSBwin/documentaion folder at
dianneandpaul.net

with the original. A couple more passes and we will
be ready to begin to figure out what it does. Already
it begins to be apparent that there are two sices
to the diagram and that each of the two sides converges
on its own 'exit' routines (D74e on the left and D27e
on the right).

I haven't heard from anyone concerning this project.
This is an opportunity to find out how those monsters
really work.
User avatar
Antman
DMwiki contributor
Posts: 517
Joined: Fri Nov 14, 2003 9:05 am
Location: Lost in TOC

Re: Monster Artificial Intelligence

Post by Antman »

This would be interesting, i have been trying to find out how i can amke the worms move foward a square after i fall down a pit, then i can teleport on thier heads. Anyway, I have a game of CSB when i do everything with character and one of DM when i do everything, they are about 9 hrs each.
I also have loads of failed DM attemps sitting in my recycle bin, over 100.
If any of these will help, ask me.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Monster Artificial Intelligence

Post by Paul Stevens »

They MUST be done with version 9.6 in order to
be of any value to me. The long games would be
very nice to have. If they are verion 9.6.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Monster Artificial Intelligence

Post by Paul Stevens »

The Monster AI code is now FLAT. Every single
'goto' has been removed. A diagram of the overall
shape of the function is in Monster_C.gif in the
documentation directory at
dianneandpaul.net.

It appears that the actions are highly dependent on
a monster variable that I had named 'fear'. Perhaps
that was a bad name....don't remember how it got
that name but probably because it was set when you
attacked a monster with 'WarCry'. The variable is computed
once at the beginning of the function and thereafter is
kept in a volitile register, which explains why it was so
difficult to see its importance. I think I will try to get this
variable out of the register and give it a decent name....sounds
easy but, believe me, it ain't; very tedious and prone to
error because the register is used for other things, too.

I also put a T524.gif at the same location. This is a function
that is called from several places to attempt to move the
monster in one of several directions. It appears to change
its function when the direction is the same as (something???).
Lots of these puzzles to work on.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Re: Monster Artificial Intelligence

Post by Zyx »

"fear" wouldn't happen to be "morale"?
We all know that warcrying or hurting a monster can cause it to run. If you narrow it in a corner, then it stops running and fights.
Maybe successful gigglers flee because they are scared by their criminal thievery?
I can't help you Paul, however I think you're doing a great, challenging and stimulating task. Just hope some people will help you.
Cheers
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Monster Artificial Intelligence

Post by Paul Stevens »

No...not morale, I think. It changes a lot. I would
expect 'morale' to be more nearly constant.

It is more like the current 'state' of the monster. 'Planning',
'approaching', 'attacking', 'retreating', etc. This 'state' would
certainly be dependent on the monster's morale.

But I don't want to use the word 'state' as it is simply
too general. 'Condition', ditto (and implies too much).
Maybe 'StateOfMind'. 'CurrentTactic'. 'Plan'. What else?
Might become more clear as we study the algorithms.

This variable ranges from 0 to 7. When a Giggler steals
something this variable is set to 5.
meynaf
Novice
Posts: 23
Joined: Fri Jan 05, 2001 3:49 pm

Re: Monster Artificial Intelligence

Post by meynaf »

I would love to help, but I know next to nothing about monsters AI.

But I have planned to have a look into the code.
Maybe one day...

Anyway, if you want to study good monsters AI, better try DM2.
Monsters here are more creative.

They can open and close doors (and try to crush you while doing so),
they don't systematically attack, they move a lot more than DM1/CSB.
The Giggler clicks on buttons to kill you with fireballs.
And a lot more... I suspect that the AI is scripted.

But I'd bet you've got a big enough todo list even without this ;-)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Monster Artificial Intelligence

Post by Paul Stevens »

In an attempt to organize some of this work I have done and
to make it more generally available......I built a simple web page
in the CSBwin/documentation folder at dianneandpaul.net.
Then I added a little bit of prose to help folks get around.

None of this is going to go very far without feedback/complaints/
suggestions/help from others.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Monster Artificial Intelligence

Post by Paul Stevens »

Want to see a DM game from start to finish? But
you only have four seconds available? Get QuickGame.rar
from dianneandpaul.net. Unpack it. Double-click on the
QuickGame.bat file, and enjoy Dungeon Master. It will depend
on the speed of your machine but on mine it takes 4.0 seconds.

I rearranged things a bit because I was running six test cases
every time I made a small change to the MonsterAI code. I got
tired of waiting.

In the playback file, you can change the playback rate by changing
the value on the #FastVBL line. 99 is a special case and means
that all the frames should be displayed. Otherwise, it skips a
lot of frames to go faster.

This is my third attempt to post. Four seems to be the magic number.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Monster Artificial Intelligence

Post by Paul Stevens »

I see evidence that the monsters can follow the 'Magic
Footprints' to locate the party. No idea if it works in
CSBwin or even if it worked in the Atari version (or any
version, for that matter). Has anyone seen any evidence
that monsters can do this? Anyone willing to experiment?
User avatar
sucinum
Pal Master
Posts: 872
Joined: Wed Apr 18, 2001 1:00 am
Location: Karlsruhe, Germany
Contact:

Re: Monster Artificial Intelligence

Post by sucinum »

sry for leaving you alone a bit there - long time ago, i was experimentating with the magical footprints and i got the feeling, the monsters are following them.
i think, the party sends out some "signals" to monsters, light, noise etc, and the footprints increase the range of those a bit and/or make monster follow you even if you are outside of their "senses".
User avatar
PaulH
Ghastly gastropod
Posts: 3763
Joined: Wed Aug 07, 2002 10:27 pm
Location: Level 6

Re: Monster Artificial Intelligence

Post by PaulH »

This spell, and many others have become redundant in this age of dungeon mastery that we all seem to possess. I use about four spells at most, vi, ma, oh ven, and ful ir.
Everyone has explored the original to its deepest secrets, and know where every switch, generator and false wall lies. In a new dungeon we all just want to get to the end as quick as possible and possibly not explore or take our time. This makes certain spells useless. And hopefully we will breed a new dungeon to take in the new skills and speed that we have.
I wait...

A birdie
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: Monster Artificial Intelligence

Post by beowuuf »


lol, i do try and explore new dungeons fully, but some people *you know who you are amber : ) * put monster triggers in that make it an interesting approach!
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
User avatar
PicturesInTheDark
Arch Master
Posts: 1154
Joined: Mon Aug 26, 2002 4:47 pm
Location: Vienna, Austria

Re: Monster Artificial Intelligence

Post by PicturesInTheDark »

Knights in the matrix ;) Amber certainly does not like to leave you time to explore spells...

Regards, PitD
Locked