Jump to content

  • Log In with Google      Sign In   
  • Create Account

Parsing the Graphic Assets


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 kintantee   Members   -  Reputation: 101

Like
0Likes
Like

Posted 17 April 2012 - 02:00 PM

Hi,
I want to develop an isometric game and I'm planning to use the art collection of flare. However, I couldn't figure how to parse the tileset of flare into my game. Here is an example of their tilesets. As far as I know grouping the tiles into one file is good, however, I couldn't figure out how I'm going to parse them as I mentioned earlier and, again, as far as I know there is no pixel marks indicatingthe starting and ending point of a particular tile or it's ancohor points etc. So how I'm going to handle this? Any particular solutions?

I hope I explained myself clearly.

Thank you in advance.

Sponsor:

#2 turch   Members   -  Reputation: 590

Like
0Likes
Like

Posted 17 April 2012 - 03:57 PM

Unless they give you additional information, you pretty much have to do it by hand :-\

Some tilesets on that site mention sprite sizes (this one says each sprite is 128x128), In the image you posted, the sprites are fairly regular in size, so it wouldn't be terribly tedious to figure out each individual sprite's size and offsets.

#3 doeme   Members   -  Reputation: 718

Like
0Likes
Like

Posted 18 April 2012 - 01:42 AM

Unless they give you additional information, you pretty much have to do it by hand :-\


If you download flare, you will find this information in the form of text-files in the tilesetdefs-folder in the engine. It looks like this:
img=tileset_grassland.png
alpha_background=1
# grass tiles (use in a 4x4 repeating grid for best results)
tile=16,0,0,64,32,32,16
I have not fully figured out what all the numbers mean, but as I see it the first one is an ID while the 2nd & 3rd are the offsets in the image-file.

#4 Rld_   Members   -  Reputation: 1527

Like
0Likes
Like

Posted 18 April 2012 - 02:43 AM

Depending on what you are going to use as your graphics lib you will want to save the individual tiles so you can access them one by one.

You can do this by loading the entire image and "stepping through it". You can probably guess/find out the individual tile size and use that to parse it. In semi pseudo code you would do something like:

for(int y = 0; y <= imgheight; y+= tileheight)
{
   for(int x = 0; x <= imgwidth; x+= tilewidth)
   {
	  // process the pixels of the current given dimensions
   }
}

There are more (probably better) ways to do this and you can optimize it by not saving but just using tiles where needed, but you can probably figure that out once you got the basics working.

#5 kintantee   Members   -  Reputation: 101

Like
0Likes
Like

Posted 18 April 2012 - 03:36 PM

Thank you for help guys. I managed to split those sheets into frames but do you think this is a good idea in terms of efficiency? Here is what I'm doing:

I'm using a special editor for creating resource files it lets me create folder hierarchy for resource files. for example:

ROOT/GRAPHICS/HERO/PLATE_ARMORED_HERO

under this path I'll have each frame of those sheets. For example a hero sheet got 8 directions and 32 frames which gives me 256 frame for hero animations. I'm going to embed those files into my resource file. If I don't use the editor I'm sure that loading 256(actually many many more) frames into game will take more time than loading just a big sheet but with editor I'm creating only one file which contains tons of frames inside it. In the end the resource file will act like just one file but do you think this will decrease the efficiency? Structuring the frame hierarchy will help me a lot while organizing the frames and coding the animation manager so I would like to use it as I mentioned but I have concerns.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS