T R A I N S
===========

A Fenix game by Arno van Dam.
(c) 2008 by Arno van Dam, Netherlands

The game (including this file) may be copied for free as long as it is not commercially exploited. No file may be altered.

If you've paid anything for it, I'm sorry, but you shouldn't have.
If you ask payment for this game, you're very wrong.

If you'd like to use this game commercially, please contact me.


== In short ==
Trains are moving along the rails. Switch the points to guide the trains to their right sheds.

== Controls ==
joystick: move pointer over points, in menu: level
A / B (no difference): switch points
start: in menu: start game
start & select: exit current game, in menu: exit game

== Levels ==
* 1 - 4: 1 to 4 trains are running at the same time, no level-up
* 5 - 9: 1 to 5 trains are running at the same time, with level-up

== Sheds ==
If 1 shed contains 9 right trains, all sheds are emptied, points are awarded, an extra life is awarded and (for level 5-8) the next level is entered.
If a train enters a wrong shed, one life (of 9) is lost and all trains in the shed are gone (shed emptied).

== Points ==
Points are awarded when a train enters the right shed, depending on the numbers of trains in the shed and the level.
Extra points are awarded when a shed contains 9 right trains.

The hi-score is always updated, even if the game was stopped with start/select.



== Background ==
I like my GP2X, since many games are available (most with emulator). The biggest problem was that I couldn't find a nice game for my son (almost 5 years) to play. Most of them were too difficult or too violent.
What else to do but writing a game of my own...

* Problem 1: language
Even though I programmed in quite a few languages (Atari basic, 6502 machine-language, GW-basic, Borland Pascal, Access (visual basic), SQL) I could not find an easy to learn language until I found Fenix.
I even considered writing in Atari basic and using en emulator to play something on the GP2X.
Maybe you say: GLBasic. Yes, I looked at it but as I found that (unregistered) the games stop after a few minutes, I let GLBasic go.

* Problem 2: language
Most (detailed) manuals and instructions for Fenix are in Spanish. I learned a little Spanish, but not nearly enough to understand it. So I searched the internet for some example programs in Fenix and found Tetris which was rather good documented and some other test-programs.

* Problem 3: game idea
My son likes trains, so I wanted a game containing trains. Not too difficult to write and with everything from an easy beginners level up to very difficult high levels. For advanced players there should be a level-up, for beginners there should not be a level-up, because the difficult higher levels could make it unatractive for beginners.

The game should also be original: I wanted a game with a new idea. Maybe with the action, frustration and simplicity of tetris.
The idea containing 4 tracks, 12 points and 4 sheds was drawn in half an hour.

* Problem 4: writing
I used the Fenix tetris program as an example for Trains, but without an example program I think it is impossible to write something in a new language. I also used some example programs and many time the (English, incomplete) descriptions of commands and the Help (which is in Spanish).
Fenix is extremely strict with it's syntax. Put a ; here or not, use (), check all end commands. This is very annoying.

Very nice about Fenix is the multithreading: various processes seem to run at the same time. I can't explain the principle to someone who doesn't know what it means, since it is hard to understand. But I can tell: if you know how it works, it makes game programming a lot easier.

In TRAINS there are 6 processes running at the same time: control of the arrow with point switching and 5 train processes (from which some will be doing nothing if there are less than 5 trains).

* Problem 5: graphics
I am not an artist. But I didn't want to take the graphics from any other source (and I couldn't find anything useful), so I had to draw everything myself. The rails are drawn on the screen (pixel by pixel). The trains, sheds, pointer and points have been drawn in another program (also pixel by pixel) and have been put in an fpg file.

* Problem 6: sounds
This seems to be an easy problem, but if you search the internet for good and useful sounds of trains, you could still spend quite some time. I picked a few sounds from internet and some other sounds (edited) from a cd with a few hundred wav files.

* Problem 7: time
It took some time to find a useful programming language. It took quite an amount of time to find manuals about this language. It took about 3 evenings to write and test the game.

* Problem 8: next game
Of course I'd like to write another game, but at the moment I don't have an original idea...

Arno van Dam, April 5. 2008.