Showing posts with label Monsters. Show all posts
Showing posts with label Monsters. Show all posts

Wednesday, 13 July 2011

Monster Flags

I now have decided on the following list of monster flags:
  • ALIGNMENT_EVIL
  • BEHAVE_BERSERK
  • BEHAVE_COWARDLY
  • BEHAVE_FLEE
  • BEHAVE_GREEDY
  • BEHAVE_IGNORE
  • BEHAVE_RANGED
  • BREED_MULTIPLY
  • DOOR_BASH
  • DOOR_OPEN
  • DROP_CASH
  • DROP_CORPSE
  • DROP_ITEMS_ARTEFACT
  • DROP_ITEMS_COMMON
  • DROP_ITEMS_EPIC
  • DROP_ITEMS_SUPERB
  • DROP_ITEMS_UNCOMMON
  • GENDER_FEMALE
  • GENDER_MALE
  • GOT_ESCORT
  • GOT_ESCORTS
  • GOT_FRIEND
  • GOT_FRIENDS
  • IMMUNE_AIR
  • IMMUNE_EARTH
  • IMMUNE_FIRE
  • IMMUNE_WATER
  • INVISIBLE
  • NEVER_MOVE
  • POISONOUS
  • REGENERATE
  • RESIST_AIR
  • RESIST_EARTH
  • RESIST_FIRE
  • RESIST_WATER
  • TELEPORT
  • TELEPORT_AWAY
  • TELEPORT_BLINK
  • TELEPORT_TO
  • WALL_KILL
  • WALL_PASS
Most of these do what they say on the tin, although the Behaviour Flags are worth noting in greater detail:
  • BEHAVE_BERSERK: This flag means the creature will do increased damage at low health.
  • BEHAVE_COWARDLY: Creatures having this flag will run away when hurt, and use ranged combat where possible, although their priority is to keep moving away from the @.
  • BEHAVE_FLEE: Creatures having this flag will flee when hurt badly.
  • BEHAVE_GREEDY: Creatures featuring this will actively prefer to pick up equipment as opposed to engaging the @ where possible.
  • BEHAVE_IGNORE: These creatures will not attack unless attacked first.
  • BEHAVE_RANGED: These creatures will attempt to stay at range and attack from a distance where possible.
If there are any more options and flags you think should be used, feel free to say so in the comments!

Monday, 11 July 2011

More on Edit Files

Following up on this post, I've had to resort to an Excel spreadsheet to extract the data from the SQLLite database and get it into a suitable format. At least it will save me the hassle of retyping all the monster stats in (there are currently 120 different creatures).

Saturday, 9 July 2011

Moving to Edit Files

Following much thought, I've decided to move to Edit Files to store at least the Monster Definitions, instead of in an SQLLite Database. The main reason is actually flexibility.

The model I've chosen is something similar to the Angband edit file, with a few modifications. Here is the template:

# Each creature has an individual entry in the following format:
#
# N: ID : singlular name : plural name
# L: Creature Level : Rarity : Uniqable?
# E: Ecology : Type: Pickup Items?
# G: Display Character : Display Colour
# I: Hit Dice : Armour Class : Evasion : Speed
# V: Initial Alertness Level
# A: Action Frequency : Action Text
# S: Speech Frequency : Speech Text
# B: Attack Method : Attack Effect : Damage
# M: Spell | Spell | Spell | etc
# F: Flag | Flag | Flag | etc
# C: Class | Class | etc
# D: Description

Anyone familiar with the Angband source should recognise most of these options, although I've enhanced a couple, and added a few additional sections.

Below I give a couple of excerpts of 2 creatures already in Kharne translated over to the new format:

N: 2 : Kobold : Kobolds
L: 1 : Common : Yes
E: Fortress: Goblinoid: Yes
G: k: $004080
I: 1: 5: 11: 12
V: 255
A: 10: "picks a chunk of rotten meat from its teeth"
A: 10: "yips noisily"
S: 20: "I'm gonna kill you! Yip yip!"
B: HIT: HURT: 1d6
B: SHOOT: HURT: 1d6
F: COWARDLY | FLEE | OPEN_DOOR | GREEDY
F: EVIL | POISONOUS | CORPSES
F: DROP_ITEMS_POOR | DROP_CASH
C: Commando | Archer | Lurker
D: "Kobolds are short, ugly goblinoid humanoids."
D: "They are known to have cowardly and sadistic tendencies."

N: 23 : Ogre Mage : Ogre Magi
L: 4 : Rare : Yes
E: Fortress: Giant : Yes
G: O: $FF00FF
I: 4: 6: 12: 12
V: 255
A: 10: "waves a magic stick"
A: 10: "yells a magic word"
S: 20: "dis two and dat two make four, right?"
B: HIT: SLAM: 1d6
M: MAGIC_MISSILE | HEAL | HOLD | TELEPORT
F: RANGED | BESERK | OPEN_DOOR | GREEDY
F: EVIL | CORPSES
F: DROP_ITEMS_POOR | DROP_ITEMS_GOOD | DROP_CASH
D: "Ogre Magi are hideous and deformed ogres wrapped in deathly black robes"
D: "They are known to be cruel and masters of deadly arcane magics."

Sunday, 26 June 2011

Monster Con

Foes which are tougher than normal (uniques, or OOD) now have one or more bars underneath their glyphs to indicate this is so.

Monday, 30 November 2009

More on stairs and monsters

I think that, further to the comments on my last post, I won't bother, for now, allowing monsters to follow the character up and down stairs.

Wednesday, 11 November 2009

Stairs and Monsters

I'm currently writing some code to allow monsters to travel the stairs with the character, following the behaviour of those in Crawl.

As implemented, all adjacent monsters will travel with the character, as long as there is room on the destination level for them to do so.

However, I'm nearly sure that (from last time I looked at their source) Crawl puts a limit on the monster types that can come up stairs.

Do you think this is a better solution? And if so, what criteria should be used to determine ability to travel up stairs? (I don't have any Dalek monsters alas)

Friday, 25 September 2009

Necrophilia revisited

I really like the ideas suggested in my previous post about corpses. Thank you all for responding, I've decided to go with your ideas!

So....how about this for corpse-handling:
  • Corpses are always dropped where possible unless the body was hacked up beyond repair or use (but for non-corporeal beings they may not be corpses per se, but rather 'essence of blah')
  • Corpses aren't permanent but decay after a while.
  • Corpses do not provide any intrinsic nutrition (or at the most, a very small value) upon eating (perhaps even the opposite - corpses make you hungry?).
  • Eating corpses provides a temporary intrinsic thematic boost to something, e.g. a stat, a resistance, a skill etc (for example, eating the, er, flesh of a fire elemental grants a temporary boost to fire resistance).
  • Carrying a corpse belonging to a creature will grant living creatures of that type a small bonus to attack and damage ("hey, you killed my friend and you're carrying him about with you!")
I'd like the use of corpses to be a 2-edged sword somewhat, unlike Crawl, for example, where apart from the (now easily identified) poisoned corpses, and the risk of mutation, they are pretty much benefical, nay essential (unlike Crawl, I intend to be a bit more generous with standard food though)

Thoughts?

Thursday, 24 September 2009

Monster Kills

I've added monster kill totals to the character dump:
-------------
Defeated Foes
-------------

7 Giant Rats
1 Xvart
6 Giant Ants
5 Giant Bees
7 Giant Scorpions
5 Giant Bats
3 Initiate Rune Hunters
4 Snakes
5 Greedy Adventurers
3 Griffons
2 Jackals
1 Large Snake

Total: 49 creatures defeated

Monday, 14 September 2009

Necrophilia

...or how I learned to love corpses.

...in a roguelike way, of course.

So, how should I handle monster corpses in Kharne? Should they be used for food, like in Crawl? How often should they drop? Should they be used for anything else?

Any thoughts?

Wednesday, 5 August 2009

Sprucing up Monster AI #1

Monster behaviour in Kharne is currently pretty dumb. I'm not talking about (the not-implemented) special attacks and behaviour for each creature, but rather they will currently stand and fight even though the player is butchering them.

I've been thinking about this and I can achieve what's known in software engineering as a 'quick win' which will enchance AI considerably.

Put simply:

Allow certain monsters to flee away from the player if they are sufficiently injured. If there are other monsters visible that belong to the same ecology, then flee towards them. Else flee directly away from the player. If a fleeing monster cannot move away from the player, then it turns and fights.

Print fleeing/unfleeing messages as appropriate ("the wibbly flees!", "the wibbly turns and fights!")

Now, there is some additional subtlety I intend to code. If there is a Unique Monster within line of sight, injured monsters don't flee but instead shout something along the lines of "We will die for you, Wibbly the Doomy!"

Perhaps the opposite effect could also occur - when a Unique dies, all sentient monsters within view flee with a "Seeing its Champion dead, the wibbly runs away". Obviously this would not be a permanent fleeing, but of time-limited duration.

(cross-posted at r.g.r.d.)

Thursday, 16 July 2009

Monster Descriptions

As far as it goes, "The Vampire hits you inflicting 6 points of damage" isn't particularily atmosphere. One of the larger tasks coming up, as soon as I have defined the behaviour of each of them, is to give more flavour to each monster.

Sunday, 5 April 2009

AI and Melee Combat

Here is a video showing the first version of the Monster AI and Melee Combat in action. The video shows a Dwarf Warrior (the most melee-centred class) fighting creatures in the first level of the Wilderness and ends with him advancing to Level 2.



The AI routines are still slightly buggy - occasionally the positions that the Dungeon Object holds for the Monsters and the locations that the Monsters think they are at get out of sync. - this could lead to invisible monsters attacking the Player Character. I have no idea yet why that occurs, but it will need to be investigated further. Currently there is a hack in place to zap any monster that gets into this situation, but that's only a temporary fix at best. But having said that, I am pleased with progress on this, even if combat is currently horribly unbalanced (in favour of the Player Character)

Tuesday, 31 March 2009

Everybody dance now!

Just as well Monster AI was switched off!

Friday, 20 March 2009

Progress Report #9: AI Mutterings

So I've started work on Monster AI. This is going to be quite a big task. And already it has me wishing for some of the functionality of C#. The reason? LINQ.

Every turn, the AI subroutine will process the list of currently active monsters on the level, determining what to do from their programmed behaviour, current condition, hatred for the player and so on. So I need to find what monsters are currently active. Initially I have to scan the entire level looking for monsters who are both alive and awake (i.e. aware of the player's presence, usually by being in line of sight or line of sound of him/her).

I started off with storing a list of monster pointers in an integer array. Of course, to get any performance out of this method, I need a quick way of determining if the monster is already active. So I just search the array. Whoops. Its an unordered basic array of integers. Searching performance is atrocious.

Being able to search through arrays as if they were a dataset,e.g.


IEnumerable query = from s in names where s.Length == 5 orderby s select s.ToUpper();

would be the answer to this. Instead, lacking such functionality, I've decided to use an additional TObjectList to store the active monsters. Monsters that awake are added to the list, and ones that are killed are removed. Its not ideal, but it does the job, and does it reasonably quick.

Which is needed as implementing pathfinding for monster movement is pretty processor intensive. I've been experimenting with the free Delphi pathfinding components available here (demo exe here) and they seem to do the job, but for every monster that wants to move towards the @ (a later enhancement I'll add is moving them towards the last known position of the @) I need to recalculate the terrain costs of the entire level, and the only way for now to do that is to iterate through the entire level one tile at a time. Delving into the source code of the components reveals that they use a TBits array in their calculations, so I'm not sure there is much more room for optimisation.

Anyway, the AI is still a work in progress - dealing with finding the correct direction to represent monsters fleeing "directly away", (for whatever reason) from the player is proving to be a pain but for now here's a video showing the beginnings of the path-finding in action:



Since no combat has been implemented yet, the monsters cannot be killed, and near the end of the video you'll notice the @ stepping onto a monster, but the basics are there and starting to shape up nicely (that sometimes the screen draw takes more than 1 ms is due to the green diagnostic messages being displayed in the message log - standard performance even with the cost of terrain calculations being performed multiple times is still below a millisecond)

Friday, 13 March 2009

Shameless Stealing of Ideas Redux

As a followup to this post, I've now implemented a Popup Window that displays the current monsters:


I am however, starting to run out of screen space. I think I'll have to investigate making the main window smaller, or allowing all the popup windows to dock somehow with the main window.

Sunday, 8 March 2009

Monsters!

Somewhere in the Wildness, a unwelcoming committee of a Snake ('s') and a Giant Rat ('r') is waiting for our brave hero. The nearby overgrown plant decides to daydream instead.

Meanwhile, on the Plane of Earth, a Kobold ('k') and a Xvart ('g') look menacingly at our hero whilst some jewelery ('=') and food ('%') look on impassively.

Death awaits our brave hero in the Voidfields of the Abyss, as an Efreet ('E') and a Planar Assassin ('@') lurk ready to strike.

Now this was an utter pain to do, but I've now got a reasonably Gaussian distribution function to select appropriate monsters and put them into the dungeon. There are 120 monsters in total, cribbed from just about every source imaginable. Now I've got to write the code to produce the occasional enhanced monsters (e.g. a Drow Matron instead of just a plain old Drow).

Then, of course, monster AI *gulp*.

Tuesday, 10 February 2009

Progress Report #7


Drop Item functionality has now been implemented. I was originally going to include all the suggestions mentioned in the comments to my previous post on the subject, but due to a slight limitation with the Delphi VCL (for some reason TPanel components, despite inheriting from TWinControl, don't have the corresponding OnKeyDown events, and I'm not interested in creating my own TPanel descendant that can respond to said key events) I've only implemented drag-and-drop item functionality.

And now, onto monsters! This is a very exciting bit of development, as I have lots of ideas for their AI. As ever, the reference posts on AI in Roguelikes seem to be over at ASCII Dreams. Eventually, I'd like to adopt many of the ideas mentioned there, but for now, the priority is to get the monster data entered into the SQL-Lite backend and then from there a monster generation algorithm written.

A while back, before development was put on hiatus, I had written up a fragment of a top-level design document dealing with this. Here's an extract dealing with one particular set of levels:

The Fortress

Built from rooms and corridors
Filled with martial creatures
Level 1 to 5 Monsters




















































LevelMonsterSymbolColourClass TemplateFrequencyFaction
1Goblin‘g’Light GreyClass + 1Common1
1Kobold‘K’BrownClass + 1Standard2
1Xvart‘g’PurpleNoneRare2
2Hobgoblin‘g’BrownClass + 1Standard1
2Gnoll‘g’YellowClass + 2Common2
2Quokka‘r’Light GreyNoneRare2
3Quaggoth‘g’OrangeClass + 1Standard3
3Warg‘w’Light GreyNoneStandard2
3Trogg‘T’BrownNoneRare3
4Ogre‘O’BrownClass + 2Stsndard1
4Ogre Mage‘O’MagentaNoneRare1
4Hill Giant‘C’Light GreyNoneStandard4
5Cyclops‘C’BrownNoneRare4
5Ettin‘C’BrownNoneRare4
5Minotaur‘m’Light RedClass + 3Rare5


Although this document didn't go into detail on the individual monster statistics, there are a few things here which are of interest at the moment. The 'Class Template' column refers to an idea I had, of, like Crawl, a slightly tougher version of the monster appearing with a class template bolted onto it, e.g. instead of a standard goblin, occasionally a "Goblin Fighter" might appear.

The 'Faction' column referred to an idea I had of improving AI by introducing the concept of Factions and a variable called 'Hate', which would eventually allow monsters to fight each other if necessary (the player would always be Faction 0). I don't know if I'll ever get that implemented though.

(Edit: Reformatted Post to remove the big gap. Thanks to Robotics For You!! for how to do this.