How to use a atlas texture?

Hello…

I want to make an isometric game.

I have many “tiles” I read that I have to put them all in one “sheet”

big .png image file.

my tiles are 128X64 each.

so if I have a lot of those in 1 .png file

the size of that files is 1280X640


QUESTION


How do I place tile No. 17?

go to third column and the 4th row

and it’s the tile no. 4… something like that.

local aTile = display.newImageRect(sceneGroup, “images/grass1.png”, 128, 64 )

instead of  …  “images/grass1.png”, 128, 64

"images/ here is the problem … atlas? what?, 128, 64 or 1280, 640

or

"images/  table[3] …


please I need your help, thanks for your time

victor

You can use texture packer to pack the sheets and the code it exports to display sprites or images:

https://docs.coronalabs.com/daily/api/library/display/newImageRect.html#image-sheet-usage

Thanks…

Texture packer might time sometime to learn…

I download it, but let’s see if I can make it to work

looks hard…

As far as the little “fishies.png” it looks like the

frames are all the same size (70, 41)

but if I have many sizes, then what do I do?

Read the instructions, follow the examples, watch the videos.  It really is very straight forward.  Just be patient.

There are no easy answers in Game Dev and if there are, they don’t help you in the long run.

Also, don’t make assumptions.  Just because the one example you’ve seen has same sized images, doesn’t mean you’re limited to that.  The tool is very flexible and handles varied sizes just fine.

Thanks roaminggamer…

I will put some time on that…

just one question

even if I have 100 images little ones and medium (100X100 and 534X435)

and the final imageSheet might be like 6500X760 ( just an idea )

for me that is a hugh .png file, might be like 3 MB or so

even that 1 BIG .png is better than 100 little ones ?

because 100 little ones will be like less than 1 MB…

So what’s better?

I suggest not making sprite sheets larger than 2048 x 2048.  This will ensure your app can run on most devices.  Some devices like the iPad can handle much larger textures (8192 x 8192 I think), but in general 2K x 2K is the best size (IMHO).

Also be aware, the size of your texture sheet may be smaller than you expect.  The tool is smart and will pack them in quite well, especially if they have transparent borders.

Oh, and you’re not as concerned with the size of the file in MB as much as its dimensions.  Sizes can vary greatly based on the complexity of the image, but dimensions are the killer.  Try to use a 4K x 4K texture on an old device which only supports 2K x 2K and you will be out of luck, even if the device has enough ‘memory’ to load it.

-Ed

PS - The benefit of packaging up textures into a sheet like this is that you pay for a single load and get relatively instant subsequent access to the textures after that versus a bunch of costly accesses to persistent storage (slow slow slow).  Of course, if you don’t use most of the textures in the sheet before unloading it and loading a new sheet, this gives no benefit, so images should be loaded into sheets based on whether they are used together or near to each other in time.

One more thing.  This may seem counter-intuitive, but unless you’ve got a rock solid plan and know exactly what assets will be in your game (i.e. no experimenting and changing art), I would start off with individual images initially.  Then, when you’ve got an idea of what kinds of assets you’re going to use and how they’ll be used consider putting them in sheets.  

If you jump to sheets right away, you may spend more time figuring this out than getting your game going.  Don’t shoot yourself in the foot with an extra burden of learning and complexity till you really have the game plan settled and know whether using sheets will be beneficial at all.

Thanks, this tips helped me a lot… There should be an app, or a web site to teach game logic

how to make games, is not only Programming(code) and graphics

it has to do a lot with how to do certain things better…

because in 2 years of doing this… I discover that you can have the same result

with many different ways of coding… but always one will be much better than others…

Maybe when I learn enough I will make that app myself… to help other people like me :slight_smile:

Sharing your knowledge is good. You can get free licenses for texture packer or physics editor for sharing https://www.codeandweb.com/request-free-license

You can use texture packer to pack the sheets and the code it exports to display sprites or images:

https://docs.coronalabs.com/daily/api/library/display/newImageRect.html#image-sheet-usage

Thanks…

Texture packer might time sometime to learn…

I download it, but let’s see if I can make it to work

looks hard…

As far as the little “fishies.png” it looks like the

frames are all the same size (70, 41)

but if I have many sizes, then what do I do?

Read the instructions, follow the examples, watch the videos.  It really is very straight forward.  Just be patient.

There are no easy answers in Game Dev and if there are, they don’t help you in the long run.

Also, don’t make assumptions.  Just because the one example you’ve seen has same sized images, doesn’t mean you’re limited to that.  The tool is very flexible and handles varied sizes just fine.

Thanks roaminggamer…

I will put some time on that…

just one question

even if I have 100 images little ones and medium (100X100 and 534X435)

and the final imageSheet might be like 6500X760 ( just an idea )

for me that is a hugh .png file, might be like 3 MB or so

even that 1 BIG .png is better than 100 little ones ?

because 100 little ones will be like less than 1 MB…

So what’s better?

I suggest not making sprite sheets larger than 2048 x 2048.  This will ensure your app can run on most devices.  Some devices like the iPad can handle much larger textures (8192 x 8192 I think), but in general 2K x 2K is the best size (IMHO).

Also be aware, the size of your texture sheet may be smaller than you expect.  The tool is smart and will pack them in quite well, especially if they have transparent borders.

Oh, and you’re not as concerned with the size of the file in MB as much as its dimensions.  Sizes can vary greatly based on the complexity of the image, but dimensions are the killer.  Try to use a 4K x 4K texture on an old device which only supports 2K x 2K and you will be out of luck, even if the device has enough ‘memory’ to load it.

-Ed

PS - The benefit of packaging up textures into a sheet like this is that you pay for a single load and get relatively instant subsequent access to the textures after that versus a bunch of costly accesses to persistent storage (slow slow slow).  Of course, if you don’t use most of the textures in the sheet before unloading it and loading a new sheet, this gives no benefit, so images should be loaded into sheets based on whether they are used together or near to each other in time.

One more thing.  This may seem counter-intuitive, but unless you’ve got a rock solid plan and know exactly what assets will be in your game (i.e. no experimenting and changing art), I would start off with individual images initially.  Then, when you’ve got an idea of what kinds of assets you’re going to use and how they’ll be used consider putting them in sheets.  

If you jump to sheets right away, you may spend more time figuring this out than getting your game going.  Don’t shoot yourself in the foot with an extra burden of learning and complexity till you really have the game plan settled and know whether using sheets will be beneficial at all.

Thanks, this tips helped me a lot… There should be an app, or a web site to teach game logic

how to make games, is not only Programming(code) and graphics

it has to do a lot with how to do certain things better…

because in 2 years of doing this… I discover that you can have the same result

with many different ways of coding… but always one will be much better than others…

Maybe when I learn enough I will make that app myself… to help other people like me :slight_smile:

Sharing your knowledge is good. You can get free licenses for texture packer or physics editor for sharing https://www.codeandweb.com/request-free-license