Package us.asciiroth.client.agents.npc

Non-Player Characters

See:
          Description

Class Summary
Archer An archer.
Commoner Commoner.
MallocArcher  
MallocCommoner MallocCommoner.
MallocNoble A noble.
MallocRifleman Shoots bullets.
MallocWizard Wizards are talking NPCs who are also good in combat, firing paralyzing bullets as well as fireballs.
Noble A noble.
NPC See package description.
NPCSerializer<T extends NPC> Somewhat simplifies the NPC serializers, which hold the most state of any piece in the game.
Rifleman A rifleman shoots bullets when hostile.
Wizard Wizards are great in combat, shooting fireballs and paralyzing bullets.
 

Package us.asciiroth.client.agents.npc Description

Non-Player Characters

In the context of this game, NPCs are agents with particular kind of combat behavior and the ability to initiate and finish "quests" in the game. They can also just talk to the player. They are grouped into races with what amounts to simplistic profession-based differences. When presenting quests, they're easily the most complicated piece in the game to create via a map.

Combat. NPCs can be peaceful or hostile (off or on). When a peaceful NPC is attacked on the board, all other NPCs of the same race on the board will become hostile and start attacking the player. (NPCs can also be created initially as hostiles.)

Conversation. However, if the player touches a peaceful NPC without wielding a weapon, conversation will ensue. NPCs have a talk message that they will show the player, unless they have additional quest mechanics. NPCs will not approach the player just to talk.

Quests. In terms of winning or losing in Asciiroth, everything comes down to one or more "fetch/deliver quests" where the player has to move items around on the boards. Even a quest to slay a monster, for example, needs to be expressed in terms of items ("bring its head back to me.") This is because items and boards are the only state in the game. So NPC support for quests involve setting up the expectation that the player will deliver something for the NPC or bring something back to the NPC. This just provides a way to structure the goals of a scenario (the TOA scenario describes the goals using messages, as the island is devoid of people, so that's another viable approach).

An NPC can be given a questColor, a doneFlag, a doneColor and an inQuestMsg to control the presentation and acceptance of a quest for the character. When these are provided, the NPC will seek out the player within a small area and fire the questColor event when contacted. This should be used with pieces like Messenger and Equipper to present a quest to the player. If there is a doneColor for this NPC, it will also change color at this point to indicate that it is waiting to hear back on a quest. (You don't have to do this; the NPC can fire a color event but not expect to hear back from the player.)

After that, the NPC will give the inQuestMsg message until the player contacts the NPC with the right flag (basically the right item although it also tests the flags that are visible to the player). The NPC will then fire the doneColor, which again should be hooked up to pieces like Unequipper and Messenger to close out the quest. After that, like non-quest NPCs, the NPC will present the normal message. Note that for NPCs who present quests, the first time they present message is after the quest has been completed, so in this case the message can be tailored accordingly.

Attacking an NPC means you can no longer talk to the NPC, which eliminates any hope of pursuing a quest through that NPC!

Death. NPCs can fire a color event when they die. You could, for example, couple this with a PieceCreator to cause the NPC to drop something upon dying (like its head).


0.7

© 2009 Alx Dark