Too Long

Share your Lufia fan fiction and artwork in this board.

Moderator: Moderator Team

waveflux
Villager
Posts: 27
Joined: Fri Jul 17, 2009 11:00 pm

Postby waveflux » Sat Jul 25, 2009 8:55 pm

quick question. Why do you load sprites from png sheets instead of using individual gifs or jpegs for each orientation of the sprite?

User avatar
Anthony
Hero of the Lufians
Posts: 434
Joined: Tue Jun 21, 2005 7:20 am
Location: Netherlands

Postby Anthony » Sat Jul 25, 2009 9:24 pm

Imagine having to maintain 100 different NPC's. Each have 8 frames in the game; 4 for each orientation standing, and 4 for walking. Assume that the loading of sprites is rather costly, and that the implementation is far more sufficient if it's containing large textures in memory- those are the reasons I am loading large sheets. And suppose I want to change the color of a certain NPC; with loose gifs/jpegs I'd have to alter several files, with a sheet merely one. Finally, gif can contain too little color, and I believe PNG is far more compressed without any loss of quality; sure of the former, the latter I'm not so sure about, but hey :)

So mostly from a practical view, but it has more advantages ^.^

Tony

EDIT: I made this post after a full day of moving stuff for my sister, three stairs down on one house, three stairs up in theother, for hours on end... so please, don't mind the incoherance of the post :D
http://ti83magic.wordpress.com/
Any help, comments, suggestion or any other form of feedback is heavily appreciated :)

User avatar
Foomy
Knight
Posts: 114
Joined: Tue Mar 08, 2005 3:08 pm
Location: Las Vegas
Contact:

Postby Foomy » Sat Jul 25, 2009 10:09 pm

a little off subject, but let me guys know what you think of this youtube video. I was bored so I decided to play a little FF7 on guitar, I'd like some opinions.

http://www.youtube.com/watch?v=OvPEpGPYyi0
Don't make me cast you into the fires of oblivion.

waveflux
Villager
Posts: 27
Joined: Fri Jul 17, 2009 11:00 pm

Postby waveflux » Mon Jul 27, 2009 3:35 am

Anthony wrote:Imagine having to maintain 100 different NPC's. Each have 8 frames in the game; 4 for each orientation standing, and 4 for walking. Assume that the loading of sprites is rather costly, and that the implementation is far more sufficient if it's containing large textures in memory- those are the reasons I am loading large sheets. And suppose I want to change the color of a certain NPC; with loose gifs/jpegs I'd have to alter several files, with a sheet merely one. Finally, gif can contain too little color, and I believe PNG is far more compressed without any loss of quality; sure of the former, the latter I'm not so sure about, but hey :)

So mostly from a practical view, but it has more advantages ^.^

Tony

EDIT: I made this post after a full day of moving stuff for my sister, three stairs down on one house, three stairs up in theother, for hours on end... so please, don't mind the incoherance of the post :D



Aside from changing the color of the sprites, I don't see the difference memory wise since it will take you just as long to load the individyual sprites( as gifs/jpgs/pngs) compared to a large sheet (especially since everything is loaded before anything is drawn).

User avatar
DarkMaster2101
Arek's Apprentice
Posts: 1703
Joined: Wed Jun 04, 2008 2:14 am
Location: Wavespace (where the sinistrals were born)
Contact:

Postby DarkMaster2101 » Mon Jul 27, 2009 4:17 am

Remember, loading each and individual file costs time and resources, even for computer speed. The size of the folder holding the JPEGs may be the same if not smaller than the PNG sheet, however it would cost the program more resources and time to load each and every image compared to a preloaded array that another program has made.

In English: It is better to use a little of a lot in a whole than to use a lot of a little scattered. Simple logic.
---DarkMaster2101

"Nonsense was beginning!"

User avatar
Anthony
Hero of the Lufians
Posts: 434
Joined: Tue Jun 21, 2005 7:20 am
Location: Netherlands

Postby Anthony » Mon Jul 27, 2009 8:41 am

There's also memory allignment to take into account... From what I read, openGL performs better with few, large textures. Though I must admit, I can't remember the exact technical reasons why bigger is better- I do however know I prefer it over a (few) directory(/ies) full with several files :)

Tony
http://ti83magic.wordpress.com/

Any help, comments, suggestion or any other form of feedback is heavily appreciated :)

User avatar
DarkMaster2101
Arek's Apprentice
Posts: 1703
Joined: Wed Jun 04, 2008 2:14 am
Location: Wavespace (where the sinistrals were born)
Contact:

Postby DarkMaster2101 » Mon Jul 27, 2009 5:25 pm

Well, I can think about it like this. Take a big 2,000 piece puzzle. Sure every piece is scrambled into a big box, but the pieces are together in one box.

The other scenario, have all 2,000 pieces of the puzzle aligned in their own box. Its the same amount of pieces but it will take longer (and guarantees to piss you off even more) to open all 2,000 boxes instead of opening one big box.
---DarkMaster2101

"Nonsense was beginning!"

waveflux
Villager
Posts: 27
Joined: Fri Jul 17, 2009 11:00 pm

Postby waveflux » Mon Jul 27, 2009 5:31 pm

DarkMaster2101 wrote:Well, I can think about it like this. Take a big 2,000 piece puzzle. Sure every piece is scrambled into a big box, but the pieces are together in one box.

The other scenario, have all 2,000 pieces of the puzzle aligned in their own box. Its the same amount of pieces but it will take longer (and guarantees to piss you off even more) to open all 2,000 boxes instead of opening one big box.


very interesting analogy!

User avatar
Anthony
Hero of the Lufians
Posts: 434
Joined: Tue Jun 21, 2005 7:20 am
Location: Netherlands

Postby Anthony » Mon Jul 27, 2009 5:36 pm

Took me a while before I agreed with that analogy, but that's actually more accurate than I first thought it was- and because of it, I now figured out why bigger is better even in my own implementation :)

OpenGL can 'focus' one texture at a time. If I want to draw another texture, I first have to shift the focus to that texture, which costs seeking time. If I have a lot of stuff on a single sheet, I'll have to shift a lot less, making it faster, and therefore better in the end (if I group textures smart, of course).

Tony
http://ti83magic.wordpress.com/

Any help, comments, suggestion or any other form of feedback is heavily appreciated :)

waveflux
Villager
Posts: 27
Joined: Fri Jul 17, 2009 11:00 pm

Postby waveflux » Tue Jul 28, 2009 6:07 am

Anthony wrote:Took me a while before I agreed with that analogy, but that's actually more accurate than I first thought it was- and because of it, I now figured out why bigger is better even in my own implementation :)

OpenGL can 'focus' one texture at a time. If I want to draw another texture, I first have to shift the focus to that texture, which costs seeking time. If I have a lot of stuff on a single sheet, I'll have to shift a lot less, making it faster, and therefore better in the end (if I group textures smart, of course).

Tony


Well since i'm not using openGL (and just java), I will use the multiple files but i will switch them to .png since you say they're better. I have my game setup in which i don't need to think when loading images (it just gives me the one i need with the right orientation).

User avatar
Anthony
Hero of the Lufians
Posts: 434
Joined: Tue Jun 21, 2005 7:20 am
Location: Netherlands

Postby Anthony » Tue Jul 28, 2009 7:18 am

Never take anyone's word for something, just because they say it :) It might be better for me, in my approach... but like you said, it doesn't have to be for yours :)

PNG is a good format; lossless, while providing good compression, and supporting an alpha layer. Depending on the image, however, .gif might suffice... I'll leave that to you :)

The only thing you should be very careful about now is the data structure your images are in. You don't want linear seeking time with hundreds, if not thousands of images...

Good luck, and can't wait to see some of your work!!

Tony
http://ti83magic.wordpress.com/

Any help, comments, suggestion or any other form of feedback is heavily appreciated :)

User avatar
DarkMaster2101
Arek's Apprentice
Posts: 1703
Joined: Wed Jun 04, 2008 2:14 am
Location: Wavespace (where the sinistrals were born)
Contact:

Postby DarkMaster2101 » Tue Jul 28, 2009 7:38 am

Shoot, if possible maybe a JPEG based texture...

But I have to wait to see that happen.

Now that I think about it, JPEG really blurs bitmaps after saving them... So it would have to sacrifice quality of your sprites.

Maybe at a 1080 or 720 resolutions. For 480 resolutions, I don't think I want a nasty sprite.
---DarkMaster2101

"Nonsense was beginning!"

User avatar
teefa85
Hero of the Lufians
Posts: 307
Joined: Thu Oct 09, 2008 4:15 pm
Location: in my own little world
Contact:

Postby teefa85 » Wed Jul 29, 2009 6:03 pm

I know that my BMP files being resaved to PNG works well, like when I'm working on sprite edits and the screenshots I take to get the sprites save in BMP.
Image Click to visit my Dragons.

User avatar
Anthony
Hero of the Lufians
Posts: 434
Joined: Tue Jun 21, 2005 7:20 am
Location: Netherlands

Postby Anthony » Wed Jul 29, 2009 6:59 pm

Aye; BMP knows no compression whatsoever, it was the simplest form of imagestorage they could come up with- the pixelvalues of each seperate pixel, and then some padding to keep it 4 bytes per pixel (only three were actually used, one per R/G/B). Basocly a quarter of a bmp could be thrown away, without losing any information, without even really compressing ;p

Tony
http://ti83magic.wordpress.com/

Any help, comments, suggestion or any other form of feedback is heavily appreciated :)

waveflux
Villager
Posts: 27
Joined: Fri Jul 17, 2009 11:00 pm

Postby waveflux » Thu Jul 30, 2009 5:20 am

Anthony wrote:Never take anyone's word for something, just because they say it :) It might be better for me, in my approach... but like you said, it doesn't have to be for yours :)

PNG is a good format; lossless, while providing good compression, and supporting an alpha layer. Depending on the image, however, .gif might suffice... I'll leave that to you :)

The only thing you should be very careful about now is the data structure your images are in. You don't want linear seeking time with hundreds, if not thousands of images...

Good luck, and can't wait to see some of your work!!

Tony


I have a good data structure, linear seeking time would be dreadful!


Return to “Lufia Fan Works”

Who is online

Users browsing this forum: No registered users and 2 guests