
    /XXXXXXXX\                                                    /========\
   /XX/    \XX\    //////////////////////////////////////////  /\/==/    \==\
   XX/      \XX    //////////////////////////////////////////  \===/ /    \==
   | \  \  \ |/    ////۲\/۲\۲\۲\۱\/\////   \=| /  // / |
   |   /\\  \|     ////۱\\\\۰\\\\\/۰\\\\۰\\\\۲\\////     | | / \   |
   |/ /\O\\\/      ////۱\//\۲\///۰\///۰\///\۰\\/////      \ / *// \|
   |    \/\ \      ////۱\//\۰\\\///۰\///۰\////۰\//////      / /\//   |
   | __   __ \     ////۲\\۲\۲\//۰\////۰\//////      | _    _ |
   |  /\  /\_/     ////\\\\\\\/\\\\\\\\\\\\//\\\////\\\//////      |/\  _/| |
   | /X/\ |        //////////////////////////////////////////        | /\\/ |
   | \/X/\/        //////////////////////////////////////////        \/\\|  |
   | _\/       O   //                                      //  ---      \/_ |
   |  \|      -+-  //  Now it's your turn to play god...   //  \+/      |/  /
   \   /       |   //                                      //  <W>      |  /
    \_/        -   //////////////////////////////////////////   -       \_/


--------------------------------------------------------------------------------
The Deity Project
-----------------

 Version 0.01

 Stage 0 completed ... Stage 1 in progress

 By Carl Olsson
 1 Jan 2003

 WEB  http://www.geocities.com/carljolsson/deity
 MAIL carljolsson@yahoo.com (WARNING: Mail checked on a sporadic basis)



--------------------------------------------------------------------------------
About this document
-------------------
This document is more a design doc than user doc, but at the moments
performs both functions.



--------------------------------------------------------------------------------
Disclaimer
----------
I am quite an incompetent programmer, also an easily bored one, so at best
this game shall progress very slowly, at worst it will be dumped. Therefore
it will quite possibly never come to fruition, so I make no guarantees that
it will.
Even if this game ever makes it to a finished, or nearly finished state it
will most probably be missing many or most of the features listed in this
document, because as stated before my programming skills are minimal, and I
have a tendency to get carried away with game complexity, meaning many of
my ideas will be unfeasible or impossible for me to implement.
So don't expect much, probably best not to expect anything.

This is still very early in development so I make no guarantee that it
will not format your hard drive or take any other unpleasant action.



--------------------------------------------------------------------------------
License
-------
The game's design is not to be used by other parties until either, the game
is finished, or I give up on it.

The source code for this project is free for use so long as:
 * The only person who uses it for building Deity is me. You can use it in
   your own game so long as it is not designed to be, mimic or approximate,
   my official Deity project (ie. must be some other kind of game and bear a
   different name). If I give up on Deity (which is quite likely) then you
   shall be free to build it.
 * You make the source of your Deity based project freely available.
 * Credit is given where it is due.

On or near completion I intend to release Deity under the GPL or another
free-software license.



--------------------------------------------------------------------------------
Design Process
--------------
1. Write the code and hope it fits.



--------------------------------------------------------------------------------
Help
----
If you find a bug (not just something not yet implemented or only partially
implemented) please let me know.
Also if you see any code that is horrendously engineered, please abuse me
for it. I'm aiming for clean, elegant, well engineered code.



--------------------------------------------------------------------------------
Problems
--------
 * When there are large altitudes some tiles may not draw.
 * Sometimes there are sort problems and a tree will flicker in front and
   behind others.
 * Top two rows of tiles overlap lower rows by one pixel, due to rounding
   negative screen coordinates.



--------------------------------------------------------------------------------
Bugs
----
 * ???



--------------------------------------------------------------------------------
Aims
----
 * Platform independent code.
 * Well designed and elegantly implemented code.
 * Attractive Transport Tycoon style view, with nice hand-drawn graphics.
 * Good (Well, at least competent) AI.
 * Network multiplayer.
 * Rich, involving worlds.
 * Large universes (many worlds).
 * Extreme replayablility (randomly generated universes).
 * Highly customisable and extendable.
 * Recommended system P200 32 Mb, minimum system P100 16 Mb



--------------------------------------------------------------------------------
Stages
------
Stage 0: Not one thing yet done.
Stage 1: Fully functioning and optimised graphical engine.
Stage 2: Fully functioning scripting engine.
Stage 3: Fully playable one player, one world game.
Stage 4: Fully playable multi player, one world game.
Stage 5: Fully playable multi player, multi world game.
Stage 6: Feature complete debugged and optimised release version 1.00.
Stage 7: Further debugged re-release with third-party campaigns, scenarios
   and tilesets.



--------------------------------------------------------------------------------
Compiling
---------
To compile the sources you will need the following packages:
Djgpp Build
   DJGPP 2.03
   GCC 2.95.2
   GPP 2.95.2
   Bin Utils 2.95.1
   Allegro 4 WIP

Mingw32 Build
   Mingw32 1.0.1
   Allegro 4 WIP

MSVC Build
   MSVC is evil, don't use it. But if you must, then Deity may build with
   MSVC, as I formerly coded it to do so, but as MSVC dosn't conform to any
   known standards, then like as not it won't.

Earlier versions of any many be fine, but the ones listed are what I am
using.

Rhide and Dev-C++ project files are also included. I've really got to do a
proper makefile.



--------------------------------------------------------------------------------
Credits
-------
 * Temporary video mode selection modified from Allegro.



--------------------------------------------------------------------------------
Test Platforms
--------------
Pentium 133, 48 MB, Windows 95
   Speed: ??? FPS at 640*480*8

Celeron 400, 64 MB, Windows 98 SE
   Speed: ??? FPS at 640*480*8

Pentium III 500, 128 MB, Windows 2000 Workstation
   Speed: ??? FPS at 640*480*8

Athlon XP 2000+, 512 MB, Windows 98 SE
   Speed: ??? FPS at 640*480*8



--------------------------------------------------------------------------------
To do
----
 * Convert between screen pixel coordinates and world square coordinates,
   taking into account square z. May require more iteration. Partly Done.
 * Limited world drawing, don't iterate through entire map, only what needs
   to be drawn. Will reduce slowdown from large world sizes.
   May be difficult because it will need the z values of squares, which
   will need iteration which means more slowness. Perhaps limits on z range.
   Could solve this by drawing world Populous style, just draw a world
   square of squares, which would be easy as piss, and fast, but not look
   so nice as the Trans Tycoon style I'm going for, it would also enforce a
   limit on z range (not good if cliffs), and have chunky (square-by-square)
   scrolling.
 * Draw objects properly, stop their feet being cut off. Possibly draw all
   terrain down first, then draw objects over top, but this would not work
   with cliffs.
   Perhaps have all squares and objects in one huge sorted list. Easy but
   probably lots of processing.
   All objects in one list, add all that appear on screen to a new list, and
   sort that new list. Sounds good.
 * Z position objects properly on multi-slope squares, two triangles, rather
   than the current warped quadrangle.
 * Sort objects so objects at SE of square overlap objects at NW of square
   to east. Possibly split squares into top (NW) and bottom (SE) parts, and
   draw in screen width bands of the bottom of one row and top of the next
   row, sorting objects in this band.
 * Draw object parts above and below water so it looks ok.
 * Speed. It's what I need, yeah! Argh, it's majorly slow. This is a major
   issue, 1 FPS on a P133, not good.
 * Terrain transition tiles, lets slow it down even more.
 * Cliffs, proper, not lame C&C/AOE style pseudo-cliffs.
 * Speed up map drawing, very slow.
 * Better object encapsulation.
 * Separate input timing from game timing.
 * Use a 3d style rendering pipeline, since this game does use 3d graphics,
   albeit, pre-rasterised, hand-drawn, without perspective. Add each
   component to a render list then Z-sort and render. This will mean I can
   render all graphics in correct order, rather than all terrain then all
   object as I am doing at the moment. Which will allow the rendering of
   cliffs.
 * Make view focus world value not camera value.
 * Make pixel to square conversion step in the likely shortest direction.
 * Major clean up of View and Map classes.
 * Perhaps convergence of View and Map like in LOW.
 * Everything else.
 * Make Input and View classes access the World class through an Interface
   class.
 * Make a proper pixelInSquare test, current one will not work with much
   steeper slopes, make pixelInPoint test.
 * To isolate world info and drawing info, no draw info in world or object,
   but all draw info generated from seperate draw function.
 * Z-buffered rendering of rasters with a depth-map layer.



--------------------------------------------------------------------------------
The Beings
----------
General
 * A spiritual being's substance is composed of Energy.
 * A mundane being's substance is composed of Matter.

Deity
 * A newborn Deity is small enough to survive off the ambient Energy
   surrounding a World.
 * As a Deity's Energy supplies increase, it grows to use the extra Energy.
 * If a Deity's Energy supply falls below what is needed for it's size,
   then it will need to scavenge Energy from it's own ethereal form,
   causing it harm and reducing it's size.

Worshiper
 * Although a Worshipper focuses it's Energy on a Deity, it's mere act of
   living emits Energy into the World, adding to that World's ambient
   Energy.



--------------------------------------------------------------------------------
The Powers
----------
Possession
   Take control of a being. Cheap to possess one of your satisfied
   followers, expensive to possess the satisfied follower of an enemy Deity.
Drought
   Reduces crop yield.
Aggression
Flood
   Damages crops and structures, and sweeps away followers.
Health
Vigour
Vitality
Shield
Volcano
Rain of Fire
Bless
Plague
Madness
Curse
Disease
Earthquake
Hasten
Cure
Summon Angels
Bless Crops
   Increases crop yield.
Battlelust
Armageddon
Freeze
Rain
Firestorm
Blizzard
Raise dead
Miracle
   Increases satisfaction.
Embodiment
   Appear to your followers. Increases satisfaction.
Vision
   Followers see a vision of the Deity. Increaseing morale of that Deity's
   followers, decreasing the morale of followers of other Deities.
Confusion
Summon Demons
Seeds of Dissent
   Causes dissatisfaction and unrest amongst followers.
Divine Intervention
Smite
   Kill a being or beings.
Avatar
   Create a corporeal form for a Deity's corporeal embodiment. Expensive to
   create matter.
Materialise
   Convert ethereal form into corporeal. Cheap but dangerous, when in
   corporeal form vulnerable to corporeal damage.
Breeding Frenzy
   Speeds rate of reproduction of followers.
Blight
   Causes crops to fail.



--------------------------------------------------------------------------------
Deities to Draw
---------------
Goddess of War (modelled on Buffy perhaps?)
Goddess of Life/Nature (dryad?)
Aviatrix
Tri-eyed Poo
God of Pestilence (starved, trailing entrails, swarming with flies)
God of Death (classic Grim Reaper?)
The Devourer (big fat turd with mouth, maybe a giant maggot?)
The Darkness (a shadow shrouded skeletal figure)
The Light (shining angel type thing)
The Machine/Iron Man (a gargantuan mechanical humanoid)
Embryo (evil looking wizened foetus)
Wizard
Shelob
Robot (a cybernetic monstrosity)
God of Pain
Goddess of Pleasure
Goddess of Love
Kraken
Lord of Storms



--------------------------------------------------------------------------------
Worshipers to Draw
------------------
Standard Humans
Depraved Humans
Goodly Humans
Tri-eyed Poos
Aviatrices
Merfolk
Whale-kind
Imps
Mechanicals
Cyborgs
Drakes
Arachnids
Insectoids
Reptiloids
Beastmen
Avians
Von Neumann Devices
Molluscs
Elves
Dwarves
Orcs
Centaurs



--------------------------------------------------------------------------------
Terrain/Vegetation Sets to Draw
-------------------------------
Glacial
Volcanic
Rain-forest
Civilisation-wasted (nothing but ruined megalopolises)
Sand Desert (Arrakis-style)
Swamp
Bushland
Alpine-forest
Martian
Subterrainean
Medieval European Countryside
Magewar-twisted
Glacial


--------------------------------------------------------------------------------
Desired World Specs
-------------------
 * 256 x 256 square size.
 * Vertical planes, ie. cliffs.



--------------------------------------------------------------------------------
Aimless Musings
---------------
WARNING: any/all of these notes may contradict/supersede others/themselves.
 * Water. When a point of terrain is lowered test if it will breach a water
   catchment (if any srounding squares are under water) then flood out water
   if breached. Each square would have a water value, being how much water
   it has above it.
 * Cliffs. Along square borders will be no worries, but to have cliffs
   diagonal accross the square, will require a two altitudes per square
   point, and division of square graphics into four triangles to allow
   differing terrains at the to part of the cliff and the bottom part of the
   cliff.
 * Monuments. Structures which a Deity's Followers build to praise it.
 * The more followers that bear withness to the use of powers the greater
   the effect on the morale of the followers as a whole.
 * Though more technologically advanced followers can use their technology
   in the fight against enemy followers, their technology also makes them
   less reliant on their Deity(s), and there is the risk that they may lose
   their religion.
 * Feeders: beings which feed on a specific feeling of worshipers. Each
   deity defines their own feeder(s) at start up. eg. angels feed on morale,
   demons feed on fear.
 * Heroes/Champions.
 * Items? Left by the old gods perhaps? Religious relics?
 * Deitic or theitic faith? constant attention, vs. occasional.
 * Wizard gets power directly, priest gets power mediated through the
   temple.
 * Thrall Deities: If a Deity is powerfull enough it may take other Deities
   into thrall, if these Deities prefer serfdom to destruction. If a thall
   Deity gets strong enough it may choose to break thrall from it's master
   Deity,so it is in the master Deity's best interest to keep it's thralls
   significantly, less powerful than itself. Thrall Deities may also band
   together to overthrow a master Deity.
 * Holy places: Spend energy on a square to mark it as a holy place. This
   will attract your Followers. The more energy you invest into a holy place
   the more powerfully it shall attract your Followers. Perhaps enhance the
   defensive capabilities of Followers defending a holy place. Temples get
   built over holy places.
 * Though Deities do not battle each other directly, perhaps some powers
   such as steal energy and such.
 * Adjustable energy expenditure: Be able to change how much energy you are
   spending on thing such as senses (more/less range, more/less accuracy),
   stealth (how easily your POP and followers can be percieved by other
   Deities), and more.

 * You are one of a number of Deities in the universe, each with its own
   individual powers and intentions.
 * You begin with complete control of one world, where your followers give
   you energy.
 * Once you have enough energy you can travel to another nearby world to
   gain new followers. This new
   world may have no faiths, worship a false faith or follow one or more
   other Deities. If the people of this world all ready follow Deities you
   may want to find another world to prevvent conflict with another Deity
   until you are more powerful.
 * When you first convert a follower you send a vision for them to become
   yours. You may then encourage the follower to convert, turn other people
   who aren't your followers to your cause; populate, settle and breed more
   followers; or battle, hunt out enemy followers and try to kill them.
 * When you have developed a good following, you can guide your people
   toward advancement, by which they may eventualy be able to travel to
   other planets to further your cause.
 * When you meet another Deity you may choose to join forces with them
   against other Deities who pose a greater threat. If an allied Deity is
   having troubles you may strengthen the alliance by giving them a gift of
   energy to help them.
 * Ususaly, however, you will want to oppose other Deities, because the
   more worship they take, the less there is for you.
 * Each Deity is individual, having their own powers, and tactics, and own
   personal traits.
 * The worlds are small isometric, with topography, like populous, worlds
   are at diferent technological stages and have different population
   densities. There are many worlds (as many as possible). Worlds have
   varying terrains and environments.
 * People who follow a Deity, give that Deity energy by their worship, they
   are not usualy under direct control of the Deity but can be guided by the
   Deity.
   When a Deity helps a people and has been followed by the Deity for a long
   time their faith will grow stronger and they will be less likeley to be
   converted to another Deity. If a Deity ignores its people they will lose
   faith and be easily converted away. If they completely lose faith they
   will stop following the Deity all together.
 * The energy that a Deity gains from the worship of its followers is
   necesary for the survival of the Deity, and if the Deity loses all of its
   followers and stored energy it will cease to exist. This energy is also
   used for travelling between worlds and and for the Deity's own powers.
 * The powers of the Deities vary greatly between Deities and each Deity has
   a large range of powers at its disposal.
 * Deities build reputaions. A Deity that has been extending its power
   passively is more likely to gain followers by conversion, whereas a Deity
   who has been slaughtering to extend its grip on the universe will be less
   likely to win follower by conversion, and will thereby by be more reliant
   on battle.
 * World populations have individual traits. These traits can aid a Deity
   with similar traits and hinder a Deity with opposing traits.
 * Energy can also be gained by sacrafices, but these will effect a Deity's
   reputation.
 * The terrains and climates of worlds vary greatly as well as the species
   populating it.
 * A Deity has an idol on each world where it has followers, which can be
   moved around, and the followers can be ordered to travel toward the
   idol.
 * Magic functions, diferent on diferent worlds based on what elemental
   components work in that world.
 * Divine powers are element based, each one comprised of one or more of
   the following: earth, air, fire, water, good, evil, spirit, body, life,
   death, strong, weak, nature, artifice, masculine, femenine,
   health/growth, decay/disease, light, dark.
 * The powers a Deity can access is based on that Deity's traits in relation
   with the power elements. eg: an evil Deity can't use a power with a good
   element.
 * Special followers: preacher - much more effective at conversion, warrior
   - mighty fighter hunts, wizard - given a portion of energy can use
   powers, pioneer - better at settleing, priest - enhances energy
   harvesting efficiency.
 * Special structures: temple - atracts followers to settle nearby and
   increase energy collection, act as a store for energy when the Deity is
   off-world.
 * Deities "see" souls and see though the eyes of their followers. So worlds
   look like points where souls are and terain where followers can see.
 * If you have a very good reputation (or a very fearsome one) followers on
   other worlds may spontaneously change to your faith.
 * Traveling between worlds is very expensive, so you must save up a lot of
   energy before attempting travel. If a Deity runs out of energy between
   worlds he/she will cease to exist.
 * A Deity's point of presense (POP) is where the Deity presently is in a
   world.
   To move the POP requires energy. When a power is used it works at the
   POP or as a field emenating from the POP.



--------------------------------------------------------------------------------
Details
-------
 * You are one of a number of Deities in the game universe, each with it's
   own individual characteristics.
 * You begin with complete control of a world, where all Worshipers are
   yours.
 * Once a Deity has enough energy, it may travel between worlds. A Deity
   will travel to a new world to extend it's Faith, by converting more
   Worshipers.
 * The Worshipers of a world may be Faithless, of one Faith, or of many.
 * For a Deity to first gain a Worshiper it must send a vision to the
   Worshiper which will convert it to the Deity's Faith.
 * A Follower may be encouraged to: convert other Followers, convince
   Followers not of it's faith to join; populate it's world, settle and
   breed to increase the faith with it's children; battle Follower's not of
   it's faith, to clean it's world of those who would hinder the growth of
   it's faith; or study toward the technological advancement of it's faith.
 * The state of diplomacy between Deities may be: neutral; at war with each
   other; at peace with each other; of allied faiths; or of unified faith,
   in the form of a pantheon. Gifts of energy, of Followers, or even of
   worlds, may be traded between Deities to incur favor.
 * Worshipers are not usually under the direct control of their Deity but
   are guided by the Deity.
 * When a Deity pays attention to the Worshipers of a world those
   Worshipers will grow in faith of the Deity. But when a Deity ignores a
   world, its Worshipers may turn from it.



--------------------------------------------------------------------------------
Hierarchy of Elements
---------------------
    Spirit

Fire
        Air
Water
        Earth


--------------------------------------------------------------------------------
Glossary
--------
Being
   Any of a number of classes of complex probabilistic forms, indicating

Deity
   A divine spiritual being, whose Powers and existence is dependent on the
   Energy provided by the worship of it's Worshipers. Composed of the
   element Spirit.

Energy
   A spiritual substance emanated by Worshipers, which is utilized by
   Deities as the basis for their Powers. Composed of the element Spirit
   or Quintessence.

Faith
   The sum of a Deity's Worshipers. It's Empire, if you will.

Matter
   All mundane substances in a Universe. Composed of the elements Earth,
   Air, Fire and Water.

Powers
   A spiritual force allowing a Deity to interact with the mundane universe
   and mundane beings, which is based on Energy.

World
   A mundane physical body composed of Matter upon which Worshipers live.

Worship
   The focus of one being's Energy onto another. Usually that of a
   Worshiper onto a Deity.

Worshiper
   A mundane being, who worships a Deity/Deities, supplying it/them with
   Energy. Composed dominantly of the elements Earth, Air, Fire, also
   partially composed of Spirit.

Universe
   A volume of stable probability containing Matter and Energy in the form
   of Worlds and Beings.



--------------------------------------------------------------------------------
Concepts
--------
 * Followers are (usually) guided, not controlled.



Scripting
---------
Components:
 * Preprocessor
 * Tokeniser
 * Lexical Analyser
 * Parser
