===============================================================================
================Pixel by pixel scrolling engine by R. Eric Lope================
===============================**FreeBASIC PORT**==============================
==============================Edition #1, June 2005.===========================
=====================Last update on Edition #1(31.01.2005)!====================
===============================================================================

Engine code: Richard Eric Lope
Tiles and sprites: Ingmar v.d. Steen and Lachie Dazdarian
Custom font: Lachie Dazdarian
Additional code and packing: Lachie Dazdarian
Modules: pp256_image.bi and rel_collide.bi by Richard Eric Lope
                              

I. What is this?
================
This is Richard Eric Lope's pixel by pixel scrolling engine ported to FreeBASIC. The original engine was made in QBasic with RelLib by R.E.Lope in order to show the powers of the mentioned library. At that time(around 2002) I got quite interested in that engine and released couple of advance versions of it, with more stuff in it and more comments. This FreeBASIC port is also heavily commented and the goal of it is to help people to create ZELDA style movement games in FreeBASIC of any genre(from action to RPG) by using GFXLib 2 graphic routines. The engine works in any GFXLib 2 screen mode you desire. It may also be helpful to people who code in Allegro or SDL but they have to solve the problem of video routines compatibility and sprite/tile loading themselves(at this point).

II. Why this engine in FreeBASIC?
=================================
After the arrival of FreeBASIC I've noticed quite few people(including me) having problems switching to FreeBASIC and finding a substitute for the code and coding techniques they've used in QBasic. I've realized that R.E.Lope's scrolling engine would be perfect for porting to FreeBASIC and the commented version of it very useful to the mentioned group of people. I was not able to do the porting myself so I had to wait for Eric to create some of the routines that were crucial for porting, like PP256's PUT file loading. This engine also features his pixel perfect collision and some C.Chadwick's routines(author of Pixel Plus 256) ported to FreeBASIC(custom font printing routines).

III. What this archive includes?
================================
This archive includes:
Very well commented source code of the pixel by pixel scrolling engine.
Two compiled versions of the engine(one in screen mode 13 and one in 18).
Engine packed in a nice example demo(player can walk around the small map and 
collide with tiles and couple of moving characters).
Map tiles(at this point, only 20*20 pixels large) and sprites for character animation.

The engine features:
* pixel by pixel screen scrolling
* PUT file loading routines(8-bit graphics)
* pixel perfect collision with moving NPCs
* tile collision
* custom font printing routines
* all you need to know about using GFXLib 2 in game design

What might be added:
* sprite translucency
* different type of sprite/tile loading
* different custom font printing routines
* larger tiles and sprites suitable for screen modes like mode 18(40*40 pixels large tiles)
* more features in the engine demo, game design related(to help newbies)
* support for 24-bit or higher graphics


IV. How can I use this engine for my projects?
==============================================
Unfortunately, this is up to you. If you don't have any experience in game design this engine won't help you in that department. It's not a game making learning tool. It will help you start but you'll get stuck very soon. I advise to those people to seek help in www.qbasicnews.com or www.freebasic.net forums with that sort of problems after getting familiar with the engine mechanics. The object of this engine is not to help people learn game design, at this point. It's mainly meant to help people start in GFXLib 2 and create games with scrolling.

To change the screen mode simply change ScrnXmax and ScrnYmax constants to the size of the desired screen and change the very screen mode statement to the one you want. ScrnXmax and ScrnYmax should be EQUAL or LESS than the screen height and width of the screen mode you have set. You can use the extra space(if you leave any) for stuff like menus and inventories.
Try the screen mode 14 on scrollingEngine13.bas source code to see what I'm talking about.

To edit PUT files download Pixel Plus 256. You can find a link to it somewhere in the community. Try piptol.cjb.net.

V. Known bugs
=============
Pixel perfect collision with moving NPCs is not perfect but I doubt it can be improved much. Anyway, the collision routine is meant to work with a different type of collision(like with projectiles or similar). 

VI. Updates
===========

31.01.2006 - Edition #1 fix. Some stuff with subtraction of two pointer operands was changed in FreeBASIC version 0.15 so I had to fix the GetWidth function(it's consisted only of one line). I kept the old line REMed so you can unREM it and REM the new one if you are working in FreeBASIC versions prior to 0.15. The error caused for the custom font characters not to print with right spacing between them. Deallocation of memory allocated for PUT file graphics was added before the END statement since I've learned that deallocation memory allocated for pointers before ending a program is RECOMMENDED.

04.10.2005 - Edition #1 fixes. Fixed the problem with GetWidth statement. Changed the method
of pixel perfect collison collision a bit(it's better know). Recompiled the source codes in FreeBASIC ver.0.14. Added a millisecond delay in the game loops to prevent the 100% CPU usage problem. I apologize for all the problems that the previous version may have caused.

VII. Feedback
=============
Please, send me feedback related to this engine of any sort. Comments, critics, additions, anything. I'm mostly interested in making the engine more flexible, like adding more ways of sprite/tile loading and support for 24-bit+ graphics.


***Lachie Dazdarian(lachie13@yahoo.com; kentauri.digitalblackie.com)

