ADOM Central

JADE Central

Background

Design

Source Code

External Code

Documentation

Download

Bug Reports

Links

Jade

Java-based Ancient Domains Engine
© Copyright 1998-2010 by Thomas Biskup. All Rights Reserved.

JADE Events - lots of stuff is happening!

JADE will be completely event-driven. After the initial startup has been finished (and this includes just setting some options and parsing the command line), an event-driven action system will take over and completely control game flow. This seems to provide a very powerful mechanic for an extremely detailed game without having to care for a bazillion special cases... here is how it is going to work:

Event Types

JADE will know two general event classes: standard events and meta events. Standard events are used for in-game actions like weather changes, the next player action, a monster attack, spell learning and so on. Meta events will be used for game control (e.g. events to repaint the screen, to save the game, to abort with an error and so on). Events will be queued in two event queues:
  1. a region-specific (local) event queue with local events (actions of the local populace, effects of the local environment like floating logs, moving walls, recharging traps and so on)
  2. a world-specific (global) event queue that holds all world-spanning events (messages being exchanged between cities, spreading reputation, global quest timers and so son)
There will be many event types, each of them related to one specific event. Thus there might be a RedrawScreenEvent, a RechargeItemEvent, a MoveWallEvent and a RegainHitpointEvent.

Event Ordering

Events will be ordered in the event queue according to the point of time at which they are going to happen. Each event will posses a scheduled turn on which it is going to occur. Standard events use the game turn counter (starting at 0 and going up to 263-1). Meta events use a negative turn counter (starting at -263+1 and going up to -1). 200 game turns will make up one second of actual time, so that the counter (long variables are your friend) will be sufficient for 1.5 billion game years (!). Each game action (and thus each standard event) will take a certain amount of energy to complete (from 0 for 1000 for a standard action to a lot more). The current term plus the amount of energy required yields the turn at which the event is going to happen. Events are inserted into the queue in a sorted order. The event with the lowest turn number is executed next. This continues until a FinalEvent instance is retrieved from the event queue(s) and executed successfully.

Long Events

Some events take longer to be completed than others. Quaffing down a potion is a pretty fast action but reading and learning a spell from a spellbook takes quite a bit of time - and you can be easily interrupted while doing so. Thus JADE will know short JadeEvents and long and interruptable LongEvents. Long events require a total amount of passed time to be complete but will get a chance to be completed partially after every predefined fraction of the total time that passes. Thus you can easily simulate eating (where a part of the food is devoured every fraction of the event) and you also can easily simulate interruptable actions like learning spells.

Event Uses

Events can be used for many things in the game and allow the trivial implementation of many features that are pretty hard to add in standard procedural roguelike games (like ADOM). Here are just a few examples:
  • Logs can float down a river. They are moved regularly be FloatingLogEvent instances.
  • Items recharge easily (RechargeItemEvent).
  • The player can have a reputation in each town. Depending on his actions in other towns his deeds might influence his reputation in other towns after some time has passed. For example you might still be very respected in LittleVillage in the deep dark mountains although you already have murdered half the population of BigCity. But after some months have passed his reputation spreads and suddenly the folks in LittleVillage will be very wary if the player decides to visit that part of the country once more. On the other hand if the player travels fast enough, he might have some time to enjoy the peace in LittleVillage until his reputation catches up with him (SpreadingReputationEvent).
  • Items can effect the player in a multitude of way (e.g. the Glowing Crown of Havoc might create a nasty and fiery explosion around its location every minute).
  • Shops can recharge easily, quests might time out, weapons in a humid environment slowly corrode, etc.
  • Traps become more versatile: rolling boulders are trivial to implement (RollingBoulderEvent), moving walls will allow for tricky labyrinth puzzles (MovingWallEvent), traps might be reset after some time has passed (ResetTrapEvent).



The Design of Everyday Things Thomas Biskup recommends: The Design of Everyday Things
"I really believe that most software engineers think too little about the usability of their products. This book provides indepth thoughts on how to design usable items (not necessarily software) and how not to design usable tools. Many issues are adressed and the author shows a profound knowledge of the topics at hand (which is to be expected since he is teaching design for... many years). His writing is concise, yet humourous, which is a definite plus in my opinion. Every software engineer worth his money should be required to read this book! "

More details about this item can be found here: United States, United Kingdom, Canada, Germany.

In Association with Amazon Please support this website by going to Amazon through one of the links on this website (if you want to shop at Amazon at all that is ;-). It doesn't cost you any surcharge, but provides me with ADOM-related income. Thanks!

A complete list of my reading recommendations is available here.


| Suggestions? EMail me.