The Daily Click ::. Forums ::. Klik Coding Help ::. 3 million tiles?
 

Post Reply  Post Oekaki 
 

Posted By Message

Kris

Possibly Insane

Registered
  17/05/2002
Points
  2017
26th June, 2004 at 07:42:23 -

dave, i thought you used blitz? that should be able to handle 3m tiles easily

 
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G

Tigerworks

Klik Legend

Registered
  15/01/2002
Points
  3882
26th June, 2004 at 09:19:11 -

Even assembly would have a tough time with 3 million tiles. Even if they were small, 16x16 tiles (256 pixels), that's 768,000,000 setpixels to draw them all.
Mind you, you wouldn't draw them all at once. Assembly might be able to iterate all the tiles in a reasonable amount of time (<1ms) but something like Darkbasic is going to be way slower, a lot of speed is lost in interpretation.

Image Edited by the Author.

 
- Tigerworks

Kris

Possibly Insane

Registered
  17/05/2002
Points
  2017
26th June, 2004 at 09:51:15 -

he's not drawing them all at once. He could just code it to only deal with the tiles on the screen

 
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G

Tigerworks

Klik Legend

Registered
  15/01/2002
Points
  3882
26th June, 2004 at 14:59:50 -

As I said, you would probably still need to iterate all tiles to check which are on screen. Maybe a short wait in assembly but interpretation really kills the speediness of loops (unless you're using something like Java with compile on-the-fly)

 
- Tigerworks

Kris

Possibly Insane

Registered
  17/05/2002
Points
  2017
26th June, 2004 at 18:37:45 -

no you wouldn't

let's say there's a 640x480 screen with 20x15 tiles visible at once (32x32 pix each)


first_blockx = camerax / 32
first_blocky = cameray / 32

last_blockx = first_blockx+20 // not 19, in case there are blocks that are only just on screen
last_blocky = first_blocky+15

for x = first_blockx to last_blockx
for y = first_blocky to last_blocky
...
next
next


Edit: woo lots of edits

Image Edited by the Author.

 
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G

Kramy



Registered
  08/06/2002
Points
  1888
28th June, 2004 at 12:46:01 -

Because that would use a minimum of 183.10546875mb of ram.

 
Kramy

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
28th June, 2004 at 14:43:42 -

Wow, I'd hate to see how you allocate your memory. Anyway, I thought he wanted to do something with EVERY tile, not just the ones on screen which is easy-peasy to do?

 
n/a

Kramy



Registered
  08/06/2002
Points
  1888
29th June, 2004 at 00:08:53 -

10x10 tile. That's 100 pixels, which is roughly 400 bytes.(int for each colour value?)

Ok...you want 3 million of those loaded into memory at once? Not a good idea...

 
Kramy
   

Post Reply



 



Advertisement

Worth A Click