A86: Re: tile-based rpg map


[Prev][Next][Index][Thread]

A86: Re: tile-based rpg map




>Is anyone willing to give (yes, give) me the source for a simple (not
>smooth) rpg tile-based map system? Maybe one that offers over/underworld
>maps.


Please take no offense, but this is a classic example of a bad message that
lowers the quality of the mailing list, because we need to ask you more
questions and waste mail and space.... Since you didnt take the time to
detail out what exactly you want.

For example, you said simple but not smooth. Smooth what? Scrolling. Ok
simple scrolling. As opposed to hard scrolling?
Huh? What you want is something that scrolls, or doesnt scroll. Page
scrolling, smooth scrolling, or what?

Now what exactly is an over/underworld map? Is that a map of two or more 8
byte high variable width map with multiple parallel maps that interconnect
using page scrolling? You must clarify this. I do not know the terminology
of RPG's as you may do.

Now, you want the source. Ok. For what? See if I flat handed out the source,
you couldnt do anything with it. Why? Because it doesn't get easier from
there, it gets harder. Collision detection between tiles and other stuff can
be difficult. You would have to understand the source code. Would you take
the time to learn it? Hmm.. interesting point. If not, why post it? Your
request is suprisingly vague. A better question would be "Can anyone tell me
an overview of how smooth scrolling is accomplished?" I am looking at the
SQRXZ source and I cant seem to figure out exactly what is going on. What
does "such and such" do. I would be like "Wow! He is taking the time to try
to attempt to learn it himself!". And I would give you an overview.  In
fact, it is difficult to understand something unless 1.) You try to program
it yourself and succeed (i.e. reprogram it). or 2.) Look at something line
by line and figure out how it works.

Someone flat giving you the source you want is an indication that you have
not tried to learn the same technique used in multiple games although in a
slightly modified form. And since it appears you probably read my last
message, noticed that the patience was not there to wait until I well
documented tile-based games on my site

Ok, since I have been an ASS I cant be a bigger ASS by not helping you. Ok,
there are different methods of drawing a sprite depending on how your map is
stored. But since you dont seem interested in smooth scrolling, but page
scrolling right?

Basically the map is a 16 byte by 8 byte ordeal:

Map:
    .db $1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1
    .db $1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1
    .db $1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1
    .db $1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1
    .db $1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1
    .db $1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1
    .db $1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1
    .db $1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1.$2.$3, $1, $0,$1

I picked the tile numbers randomly. They can be anything you want. Each
number is a tile, which represents a bitmap (8 by 8 image typicall). The map
here is stored by a 16 by 8. But if you were righting a game you want to
have the map sideways so the map is always 8 bytes wide and never anything
different, and the height (will be drawn to appear as width) of the map will
be variable. This allows faster speed and more optimizable code.

SQRXZ also inverted the map but that was where I crossed the line ;-) I
simply worked backwards to redraw the sprites from
the missing scrolling routines.


To draw a map, you do this in PseudoCode:

Map -> start of Map

FOR Y = 0 to 7

   FOR X = 0 to 15

    A = Map tile, access by  Y * 16

   HL = SpriteDate + (A * 8) ;Multiply this by 8 and add to start of sprite
data (8x8 sprite)
                                             ; Since every sprite is 8 bytes
in height this determines the height of the sprite

  Call AlignedSpriteRoutine

  NEXT X

NEXT Y

You should get the idea. Anyway I accidentely sent my map program up on this
list, you can look at this anyway. It isnt
optimized, like sla a can be add a, a.

Were you interested in scrolling? Because if you wait patiently it will be
on my site. No one here can throughly explain scrolling without spending at
least an hour or two on it. And to write a detailed section on smooth
scrolling and tile-based techniques will take me a long long time (tens of
hours), because I must include graphics or else it is hard to visualize.

Patience and Persistence is the key to success

Later,
    Matt


Follow-Ups: