Path: chuka.playstation.co.uk!news From: Phil Gooch Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Different approaches to scrolling a tiled background Date: Wed, 09 Sep 1998 09:51:36 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 39 Message-ID: <35F64198.80CBC038@easynet.co.uk> References: <35F3DCA5.3D5ADA21@easynet.co.uk> <35F5CCAA.169BA921@shell.jps.net> NNTP-Posting-Host: 193.131.140.246 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.05 [en] (Win95; I) Elliott Lee wrote: > Your approach may be memory-efficient, but it may just turn out to > be slow. I'm working on something where I've calculated that the > "world" will probably be a bunch of 2D tiles spanning maybe 128x64. > If each cell takes a byte, then I only need 8K of RAM to hold the > data. And, 256 sprites are probably more than enough to describe > the world. ^_^ Plus, it's very easy to calculate which tiles should > be on-screen and which aren't. > > While you may save quite a bit of memory with your approach, remember > that each of your pointers are probably 4 bytes each and that will > afford you about 1K worth of world tiling if you stick to the same 8K > space. Then again, if your world is changing---e.g. you drive offroad > and leave tire tracks in the dirt---you're going to be dealing with > tiles being added/removed. That could mean the source of nasty pointer > bugs plus slower calculations to resolve memory addrs. > > My biggest concern is that if your array gets corrupted somehow that > you will end up generating memory faults. With an array, it's pretty > hard to generate faults if you check your array bounds consistently. > Plus, it's easier (for humans) to visualize and that may translate into > easier debugging. > > Just some thoughts, > - e! You're probably right Elliott. I think I've dug myself into a hole with this approach. It does have it's advantages though (not least being able to make the game different each time you play it - just rearrange the pointers), but it's making the rest of the coding a bit messy. Oh, well you live and learn. Thought my approach was quite clever but I guess it's not! Phil