delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/28/07:10:49

From: Moo-Juice <Ben AT flag DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro: Tile base scrolling in 640x480 with 256 colors
Date: Tue, 28 Jan 1997 08:38:19 +0000
Organization: Honest Ron's Car Emporium
Distribution: world
Message-ID: <230xX3A7rb7yEw8Y@flag.demon.co.uk>
References: <32E87F30 DOT 1C74 AT ix DOT netcom DOT com>
NNTP-Posting-Host: flag.demon.co.uk
MIME-Version: 1.0
Lines: 44
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <32E87F30 DOT 1C74 AT ix DOT netcom DOT com>, Terence Ramos <de-
bug AT ix DOT netcom DOT com> writes
>I think the subject tells it all.  I have been trying to work on a tile
>based scrolling type of rpg game for three days now and right now I am
>stuck on a particular part.  One of which is speed!  What I have done is
>loaded all the tiles into a two dimensional array (ie. BITMAP
>*Map[100][75] ) and I later declare Map[x][y] = create_bitmap(40,40) ...
>well thats a lot of memory used but I thought it would save on speed
>later, BUT I still have slow downs!! If anybody can help on this, I
>WOULD REALLY REALLY REALLY BE GRATEFUL!!!!!

A much better way would be to create a tile bank, holding all the tiles
your map is going to use, like this : 

BITMAP *Tiles[50];

Or you could even place them in an allegro data file.


One this has been done, simply make your map array an array of pointers
or indexes to the tiles.


Another method would be to wait a week or so, when I will be releasing
the CMap class for allegro which will do this:

* Allows creation of any map, of any size limited only by memory
* Maps can be dynamically re-sized at runtime
* Tilebank load/save functions 
* Tilebanks can be grabbed from a PCX file
* Map animations allow you to animate parts of your map
* Any tile width/tile height can be defined
* User-definable viewport
* Map Cut(), Copy() & Paste() functions
* Tiles in the tilebank can share other tile images
* Each tile has an individual tile value
* Map can be moved any amount, not just multiples of the tile width
  / height etc...


Plus a bog-standard map editor... hoping to improve this in the future.

-- 
Moo-Juice

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019