Monday, July 4, 2011

Everyone loves quests.

You deal 6 damage to Charred Skeleton.
You have defeated your foe! DEBUG: inside combat manager
You have been awarded 18 experience.
You have completed a quest objective!
You have completed the quest: Tutorial Slaughter!
You have gained a level of experience! You are now level 2
You have been awarded 50 gold.

The past week has had me designing the questing system for Avaloria. This has been an interesting problem to solve, the problem being how do I let everything know I am on a quest, and how do I make it care? The easy part, funny enough was designing the manager object and the quest object that the manager manages. Every Character will start out with a non-droppable item in their inventory called the 'Adventurer's Journal'. This in game object represent the backend quest manager. All that is pretty straight forward, just save the quest manager object to the character model and the character has full access to what is there via the @questlog command.

The tricky part is making the in game mobiles/items 'quest-aware', if you will. I am solving this in two ways really. One way is by utilizing evennia's alias system, the other is by setting quest flags on the character model. One approach is for kill, pickup x object etc type of quests, the other (quest flags on the character model) are for more interactive things. Say you have to talk to someone, this is how they would know you are in fact on said quest and needing to complete/advance it. I am hoping this will also allow for more dynamic questing then your typical assortment of quest types. The alias system is going to be utilized for kill quests and item pick up quests. If an item is a quest item it will have an alias for said quest item. The Character model will have its at_object_receive() hook modified to check against the current quests and do appropriate actions. When a mob is killed, logic is triggered to check through mob aliases and quest objectives to figure out if we just killed something that is important to us.

At the moment I am not requiring any sort of physical quest turn in. No running all the way back to the npc who gave the quest to you (unless the lore behind the quest demands it). For simply quests though the rewards will be instant, right after the game figures out you actually completed the quest.

Currently the system is only able to handle kill quests, specifically kill any creature at all quests. However, the system is easily extensible and soon all types of quests will be littering the landscape of Avaloria for all to enjoy.