View Single Post
Old 17 July 2004, 13:47   #9
Graham Humphrey
Graham Humphrey's Avatar
Join Date: Jul 2004
Location: Norwich, Norfolk, UK
Age: 31
Posts: 11,029
Originally Posted by Codetapper
It sounds like you are doing something majorly wrong if you are running out of memory for this task. The graphics file for the tiles should be pretty small and the map itself should just contain an index to a particular tile you want to draw on the screen.

For example, if the tiles are say 16x16 and you have 64 screens which are 320x256 pixels each then you need 20 tiles wide x 16 tiles high for each screen x 64 screens which would be 20480 tile pointers - if these are stored as words (ie. each tile is 16 bits) then you should only need 40k to store the entire map for each level.

I would check your code and make sure you aren't trying to allocate memory all in one hit for an enormous bitmap which happens to be big enough to display the entire level.
No, I have two 320x256 bitmaps (for double-buffering). I load the entire map into memory - which should be about 40k of memory - but only display 20 tiles across and 14 tiles down at one time. I can't figure out what's going on, I'm obviously doing something wrong, but I halved the map size to 32 screens and it works fine, without modifying the code.

Besides, I don't think I could handle doing 64 screens for each level. 32 is good enough in my opinion.
Graham Humphrey is offline  
Page generated in 0.07362 seconds with 10 queries