Applications Graphics & Sound Computer Graphics Effects Scrolling  

How to scroll tile-based RPG world - mode 13h (asm/Pascal)

download download home home  
important code information
minimum requirements:
How to scroll tile-based RPG world - mode 13h (asm/Pascal) description

A sample of how to scroll in the fashion of tile-based Role Playing Games. 256 color pixel-by-pixel scrolling. Source in Pascal 6.0 and assembler.

Generic Scrolling Tile Based Demo

What Is This?
This is some sample code in Pascal 6.0 to show how to do some scrolling
like the Ultima-type games do it. This demo is in 256-color mode 13h
and is non-interactive. Source is included with some documentation
for easy modification.

How Do I Use It?
Just type test. This file will need several .til files (the pictures)
so make sure they're there (everything you need should be present
in this archive). The file will show a man walking along a river
side, moving forward 4 pixels at a time. If you want to change this,
you can type test <step size> and he will walk that number of
pixels per step (ie., test 1 will have the hero walk 1 pixel for
each step).

If the demo is too slow or too fast, well, I haven't done
anything to control that yet. The delay between steps is stored
in the walk procedure (bottom of the file) and is currently set
to 400ms between steps. That's great for 486, but I have to change
that to 100ms and recompile for my 386.

Press <ESC> to quit - the hero has to finish his 32 pixel journey so
there may be some delay. Really, I promise, I didn't disable the
keyboard or anything like that.

This code will show you how to 1)Use a virtual buffer (which is
good for flicker-free animation), 2)Use animated tiles (like a
man who moves his arms when he walks and water that waves),
3)Scroll a tiled screen pixel by pixel and 4)Learn a little

With a decent understanding of the few assembler routines (which
are documented in the programr.txt file), you should be able to
rip out and modify the assembler animation/drawing routines
to use in your own applications. Hopefully you know enough about
programming to handle the other little things (like declaring a
datatype/object/record holding a hero's name and hitpoints or
whatever) to make something useful with this.

Well, for starters, the hero only walks straight up. Why? Because
if he walked sideways or down, I'd have to draw more pictures.
Second, it doesn't respond to the keyboard (outside of quitting).
This is because I didn't want to fool around pressing keys while
debugging this. It should be easy to add keyboard input
ie., while not Done do
if keypressed
if ch=Up_Arrow then Walk(Up)
else if ch=Down_Arrow then etc...
Animate Icons
The next limitation is the map size - for this demo it's really small
(you can make your own map by just modifying the array size). It might
seem endless because of a cheating little trick I put in (which is
nice for people writing background scrollers like Galaga) - when the
hero walks forward 3 steps, he is looped back 3 steps (which looks
exactly like his previous location so you can't tell he jumped).
You'll notice the map is a pointer - that's because if you use too
many non-pointer variables you get out of variable space errors
or data segment overflow errors (the data portion of pascal .exe
files can only hold 64k of variable declarations, about a map
size of 256x256).

One real big limitation is that I'm not the world's hottest
programmer (or speller) so not everything here is neccesarily
accurate, but I figure it comes close.

Legal Matters
I reserve my rights to this, which my lawyer tells me is unecessary
as I automatically keep my rights unless I explicitly give them away.
I don't care if you use this code (there's not enough here to write
a game - you still have to be creative and invest some time) but
I would really hate it if you stole my code word-for-word and claim
it's yours or try and sell it (I've seen this happen).

Also, it works on my machine. It didn't format my harddrive or
blow up my monitor or anything like that. But you never know
how other people's computers are, so I won't claim that this
software won't damage your system - it could very well blow a hole
through your monitor, although if it did I'd like to know how
it happened.

Everyone adds this legal stuff at the end of their file as if
they had the money to enforce it or the constant need to use
it. I figure we, like lemmings, just do it because everyone else
did it. Be cool about things and I figure no one will care.

Oh yeah, I work in a computer department at my company. I also
signed some papers or another saying anything I do work related
on the side is their property (greedy bastards, aren't they?). So
I'll just mention that my job does not involve programming, and
I've been doing this game programming bit long before I ever
worked here and signed silly papers. I did not use their machines,
their compilers or their time (hell, they owe me overtime I figure).
I didn't recieve any education from this for them, and when I
volunteer my spare time at home to write for them it's normally
visual basic and powerbuilder. So I doubt this simple source
code violates any agreement I signed. If so, I'm off to jail :)

If you have any comments, I can be reached at
Some people have problem emailing me - I haven't a clue
why except that maybe my company is new to this stuff. I'll
answer basic questions and flames and such if you have them,
although with a new baby I can be slow to respond sometimes.

File List:

Similar code
Fast Scrolling in Mode X (Popularity: ) : This article describes a fast and efficient method of scrolling a tiled world, using 320x200 Mode X. It will scroll an infinite distance vertically, horizontally and diagonally.
User reviews

Write a review:
1 2 3 4 5 6 7 8 9 10
1=poor 10=excellent
Write review*
Your name*
  (Comments are moderated, and will not appear on this site until the editor has approved them)
Rate me
supported os
downloads 62
size in Kb 25
popularity   3640/7916593
user rating 5/10

New Code
Popular Code