GLBasic forum

Main forum => GLBasic - en => Topic started by: Sokurah on 2010-Oct-27

Title: iPhone performance on clipping images.
Post by: Sokurah on 2010-Oct-27
In theory:

If I make something that is based on squares I would normally use tiles.
Let's say I was making a scrolling game and using 32x32 or 64x64 sized tiles.

But what if the playfield is 1024x1024 pixels and I use a 1024x1024 pixel scrolling image and just changed the offset at where it was drawn and do the scrolling that way?
-would there be a speed penalty for using an image that big, or would GLB clip it correctly so it doesn't matter?...would it be a good alternative to tiles (in this theoretical example) or should I just stick to tiles?
Title: Re: iPhone performance on clipping images.
Post by: Ian Price on 2010-Oct-27
You could create an image that size (use CREATESCREEN) or even load one in, but you'd probably be better off using POLYVECTOR to display the portion of the image or VIEWPORT. The iPhod really isn't very powerful and large images like that will probably hit it quite badly in terms of speed (I say probably, because I've not tried it, but experience would lead me to believe this).

Why not use a tile engine?  With 32x32pixels you're drawing around 150 tiles, which shouldn't stretch the iPhod too much.
Title: Re: iPhone performance on clipping images.
Post by: Sokurah on 2010-Oct-27
Quote from: Ian Price on 2010-Oct-27Why not use a tile engine?  With 32x32pixels you're drawing around 150 tiles, which shouldn't stretch the iPhod too much.

Well, it's not like I'm working on anything, but a tile engine wouldn't be a problem if I did.

...I was just wondering if there was any downside to trying to do it the easy way.  ;) :D
Title: Re: iPhone performance on clipping images.
Post by: Slydog on 2010-Oct-27
It also depends on if the background will be interactive, or static.
If static, then either way is good.  However, I'd still recommend using Polyvectors as Ian suggested.

But if you need game objects to interact with the background, having a tile map is the way to go.
Then you can reference the tile map array for various checks, or updating the tile map during game play, etc.

And, I've read that the larger the tiles, the better iPhone performance.  (less work each frame)
I'm not sure if it starts degrading after a certain size.
Title: Re: iPhone performance on clipping images.
Post by: Sokurah on 2010-Oct-27
Perhaps I should look into Polyvectors sometime - it might come in handy, but tiles would probably be my choice...depending on what I'd do of course. :)
Title: Re: iPhone performance on clipping images.
Post by: Kitty Hello on 2010-Oct-28
polyvector is just a way of drawing a tile.
It's easy like:

Code (glbasic) Select

STARTPOLY sprite_image_id%, 2 // 2=strips
colour=RGB(255,255,255) // usually, if no teinting
FOREACH tile to draw
POLYVECTOR topleft, colour
POLYVECTOR bottomleft, color
POLYVECTOR topright
POLYVECTOR bottomright
POLYNEWSTIP // now you can draw an independent tile anywhere
// If you draw a line like: for X=0 TO bounds(hit[], 0)-1 ...
// you can lleave that and only make a new strip when you draw the next line
NEXT

ENDPOLY