The FPC ModeX docs...

--------------------------------------------------------------------
NOTICE:

The ported games (see below) were found on a site that claims to only have
PD stuff, and the webmaster said that everything he published was sent to
him with that purpose. We tried finding the persons mentioned in the mail
over internet, but that failed.

If there is somebody that claims authorship of these programs, please mail
marco@freepascal.org, and the sources will be removed from our websites.

SameGame can also use the API for mousecontrol. This because the RTL mouseunit
MsMouse only exists under Go32V2. The API mouse routines work with Linux, but
have (right now) a problem with GPM version 1.17. Use a different version if
you can 1.15 works according to the developpers.

The source code of FPCTRIS and SAMEGAME) are written by Marco van de Voort
and are donated to the FPC project. The FPC project distributes all sources
under a modified GNU license (much like the so called LGPL) see copying.fpc.
--------------------------------------------------------------------
REQUEST:

As a developper team, we don't want spend 90% of our time in creating demoes.
If you have something nice, which explains not yet demonstrated features or
technicques, mail contact us via marco@freepascal.org, or add it to the
contrib page.
The readers are also encouraged to explore FPC's excellent documentation
with many examples!!!!!

------------------------------------------------------------------------------
What are the FPC games?

The FPC-games are a series of simple, small games written or ported by
Marco van de Voort (marco@freepascal.org) as demos for the
Free Pascal compiler (FPC) and its Run Time Libraries (RTL).
The "ported" games were first used to test the compability of the GRAPH
unit. Since we had them, and they were very likely PD or GPL, we decided
to use them when we couldn't contact the authors

Currently the games are

  (Games written by Marco van de Voort)
- FPCTris (v0.08)                       Tetr'ish game.
- Samegame (v0.03)                      As found on e.g. GNOME.

 Other games:
- Gravwars (Sohrab Ismail-Beigi?)       Simple angle and shoot game
                                        (like TANK distributed with QBasic)
- Maze (Randy Ding)                     Maze generator and "game"
- Quad (Justin and Whitney Pierce)      Memory game but with 4 cards each.
                                        move.

All "other games" games are simpler than my ones, though Quad has overall
the most sophisticated graphics, and Maze a reasonably complicated algoritm
(compared to the other ones)

Most of these games use Gameunit.pp which contains some very simple
generic routines:
- textual and graphics mode safe input dialogue (replacement for readkey)
- highscores (show, helper routines for entering scores etc)
- wrappers for mouse via msmouse or API on other targets
- Some routines needed for BP compability. (Go32 and cursor routines in Crt)

To compile the games on non dos targets you have to change DEFINE the
MouseAPI conditional in gameunit.pp (automatical for Linux).

To get the graphics versions of fpctris and samegame, compile using
-dUsegraphics, the makefile should automatically build both.

Future
--------

- Some cards games (BlackJack, Poker, and two Dutch games called "Rikken" and
   "Toepen") are in preparation
- A server for Linux, so that Linux clients can connect to it for multiplayer
   services. One server for all games, otherwise small games like this clog up
   the number of free ports ;-)
   This is also important because most of the cardsgames (except BlackJack)
   can't be played against the computer, the AI is to difficult. (Poker is maybe
   also possible)
- More games
- A fortune clone (far more sophisticated than everything here) to complete
  the BSD games analogy

---------
FPCTRIS

Fpctris is a tetris class game, originally designed

- to be distributed with FPC as Crt demo,
- Keeping possible integration in the IDE in mind (would add 15k or so)
- Svgalib version etc etc. Anyway, the engine is quite platform independant,
   and can be ported to different platforms (also TUI,GUI) if needed.
   (this has now be done. Graph seems fast enough)

The current versions are still under development, but already playable even
under telnet.

TODO list:

- (difficult, also interesting for Crt and IDE), get more terminals supported
  under Linux. Specially I don't want to issue the escape sequence that rapes
  your console to an IBM compat charset. Linux users don't like that.
  (temporarily solved by doing this only on user request)

- (Linux) Sockets multiplayer client system :-). Have actually started on it,
   but are getting nowhere. The server will be separate and support more than
   one game. So you get one port for several games.

- Setup screen ((create) alternate blocks etc)

- Commandline options/config file. (.rctetris per user :-))

KNOWN BUGS:

 - Upperrow not used with some chars. (Requires shifting up). Possibly related
   that very rarely "game over" appears when there's still one or two rows to
   go. (Since the 5x5 version some of this has been removed. If you get a
   L-shaped character and immediately rotate, the upper line is used)
 - Biggest problem at the moment is the delay procedure and its init on machines
    under heavy load. Can't change that though. Only under heavy load, so a
    less big problem on heavy machines.
 - Selection of colors don't take screen attribs into account. So figures can
    seem to disappear on weird TTY's or 4Dos people using strange ANSI prompts.

History:

v0.00    First version with working gameplay, created during the Brussels
          meeting. published on tflily.
v0.01    Some work done, first version on my page. Most improvements done in
         Brussels, too many to name here.
v0.02  - Got rid of binary encoding, and calculating shapes etc when a new
         figure is created. All is done on startup now. Adding characters
         is simpler now.
      - A lot of parameters are variables instead of constants.
      - Experienced tetrissers press "e" once.
      - Colors! Linux has the color default off (press "C")
v0.03  (Only used at Stack, not on web)
      - Keep on pushing arrow down no longer freezes FPCTris.
      - Basic level system implemented.
      - High ascii background in color mode.
v0.04  (Only used at Stack, not on web)
      - The push-down arrow fix removed the possibility to move the character
         after arrow-down, which I liked much. Fixed. # of possible moves after
         arrow-down also adjustable.
      - Tried compiling with W32 compiler. RTE 216 (which is gpf I believe)
         Is Crt unit. Hello World "Use crt" also gpf's.
      - Removed the first, forgotten bugfix for the hickup problem. Now the
         "feel" of the game is ok. When you push down, it goes down, but you
         have the change to do one more move.
v0.05  (Never used anywere, backup version before movement to 5x5 figures)
      - More Score info
      - Help possiblity
      - Highscores. (also saved to file, and searched in the path)
      - Entering highscores uses inputstr. Size boosts to 1200 lines. Yuck.
      - Most functionality now implemented.
v0.06 (To Peter)
      - 5x5 figures including "The Cross". Worked almost rightaway, but figures
         rotate a bit weird.
      - Better rotation 5x5 system. Only smallest square around figure is
         rotated.
      - Better scores. Incl quadratic (progressive is a better word) scores for
         multiple lines. Now it does matter if you remove 2 x 1 line or 2
         lines at once.
      - Some small other fixes.
      - 'q' is also exit.

v0.07  - Highscore table routines moved to gameunit. Gameunit.pp now required.

v0.08 - FileMode in GameUnit fixed.
      - Small error that never popped up fixed. Pierre found it by compiling with
         checks on.
      - Graph mode implemented. Hopefully it also works under Linux (read the
        Graph unit is platform independant enough) Compile with -dUseGraphics.
v0.09 - Fixes for Win32 GUI mode.

----------
SameGame.

Principle copied from KDE/GNOME.

The principle: The playfield is a grid consisting out of 3 colors.
You can mark a certain spot on the playfield, and all adjacent grid-cubes
(horizontally or vertically) will also get marked by the computer.
When you press the left button, and two or more cubes are marked, the marked
cubes will disappear, and the playfield will colapse to the bottom left.
This can be repeated until there are no more agregates. If the field is empty
then, you receive a bonus.

The trick is that the score for each disappearing aggregate of cubes is more
than linear (0.25* quadratic right now) dependant on the number of cubes it
contains.

This means that removing 5 times an aggregate of 2 cubes will result in a far
smaller score than one aggregate of 10 cubes. ( 5*2^2 < 10^2)

TODO:

[none]

BUGS:

- Maybe better algoritm for initial filling of playfield.
- Runtime sizable playfield.

HISTORY:

v0.01 :
       - Initial version.
       - Slightly improved initial algoritm.

v0.02  - Using gameunit. GPM support via API, but whole thing GPF's under Linux,
          but works under Go32V2.
       - Highscores,helpscreen, all small things that come with a decent finishing
         of the concept
v0.03  - Fix to game unit that upset configuration files under 0.99.13
       - q,x and Escape now exit.
       - Weirdly enough, mouse cursor disappears when moving over a black spot.
          Playing with delays was unsuccesfull.
       - Graphical support. Compile with -dUseGraphics
v0.04 - Fixes for Win32 GUI mode.

----------
Gravwars (author:Sohrab Ismail-Beigi)

Specify angle and speed, and try to hit the other spaceship. Some planetoids
exist that can bend the curve of the bullet/ray.
The game uses is designed for TP4.0 and uses Turtle'ish drawing. So we
use it as a test for TP4.0 Graph compability.

TODO:
- Use InputStr for input.

BUGS/FLAWS : None, except that it is very basic (and not worth extending)

HISTORY:

v0.01 :
       - Initial FPC port.
----------
MAZE    (Author Randy Ding)

Nothing special, but from all FPC-games the one with a real algoritm.
(some form of shortest path through a maze I guess) The others are much
simpler as far as algoritms are concerned.

The programs asks some simple parameters, and creates a more or less complex
MAZE. The task for the player is to go from one side to the other:

Use I,J,K,M or arrow keys to walk through the maze
Hit X when you give up!

TODO:
- Use InputStr for input.
- Help on screen if there is enough room?
- Big mazes/very high resolutions?
   (bigger than the current max 200x200 is unreadable on 1024/768)

HISTORY
 v0.01 :
       - Initial FPC port.

------------
QUAD

My favorite of the other games, and by far the most work to port/clean up.

The program deals some cards blind. It flips over maximal 4 cards, and if
the 4 turned are the same, it removes them. (the game exists as a card game
called MEMORY too, but only with two cards at the same time)
You have to remove all the cards to win, and the highscore record
the time. QUAD loads some pictures from quaddata.dat.

TODO:
- Use graphical versions of highscore.

HISTORY
 v0.01 :
       - Initial FPC port.
