NPC States


I am going to try and post a basic topic of interest each week.  While my topics will generally be geared toward application for gaming, the topics should be of interest to programmers in general.  I will use psuedo-code in most cases, but will also try to include Basic code for any specifics.  I normally code in Purebasic or DarkBasic but also do some coding in C/C++, PHP and Perl (of which I hate C/C++ the most).


The first topic I want to address is "Stateful"-NPCs.  A "Stateful"-NPC is a computer controlled actor that can recognize different "States" of the game.  For example, each NPC monster might have a "State" of Hunger.  If they are hungry ("Hunger state = 1"), they may be allowed to wonder further than normal from their spawn point.  If they are not hungry ("Hunger state = 0") then they stay closer to their spawn point, and/or return.  If an NPC monster has a Hunger state = "1" and there is a nearby NPC Mob that is smaller then it can attack and eat.  This would allow for a wondering adventurer to hear/see "natural" activities.

For example suppose we want to define the following states of an NPC:

  • Does the NPC currently have a quest to hand out?
  • Does the NPC have a magical item for reward?
  • Does the NPC have a normal item for reward?
  • Does the NPC have a monetary reward?

We can set this up in several ways Read More

Where we are


Well this is the first of hopefully many, many blog-post to come.  Basically, just want to get the ball rolling, so the speak, and provide a limited look through the keyhole.

Current Projects

  1. Escape from Dwarf Mountain - a First Person Shooter-type game where the object is to get out of a Dwarf Prison and through multiple-levels of Dwarf occupied mines.  Three levels of play provide for different time requirements and styles of play.  Easy will be a 10 level, easy to kill Dwarfs mobs only, lots of loot dungeon.  Moderate will be a 25 level, semi-tough mobs (Dwarfs + some other nasties), less loot dungeon.  Hard will be a 100 level, hard to kill mobs (a few Dwarfs, with lots of other nasties and maybe one or two Dragons), loot based on level and difficulty of mobs. This game was first started as part of The Game Creators and INTEL Atom Developers "But I Want to Explode Zombies on my Netbook" Competition.  The game was not finished in time, as a lack of good 3-D artwork prohibited us from releasing an unfinished game.  The game draws from the original ROUGE/Nethack by making LARGE RANDOMLY GENERATED 512x512 and 1024x1024 dungeon level mazes.  The game also features perma-death mode or death-restarts level with limited save (only current level is saved and you can not go back to previous levels).

    3D representation of part of the randomly generated mazeEscape From Dwarf Mountain - part of large randomly generated maze

    Dwarf Model from Escape from Dwarf MountainEscape from Dwarf Mountain - Dwarf Model

Read More