Skip to main content
gamedev.net
🔒 Locked

Texture Packs

Started by Mulligan 5 replies 650+ views
Original Post
Mulligan
Mulligan
I have a bunch of textures for a game I''m making, and want to put them all into one file in order to simplify things. How is it done?
Dreamforger
Dreamforger
1. use the windows resource system. I don''t so I''m not explaining how

2. create your own resource format
2a. You need something to convert textures into resources
2b. You need something to read resources into your game

Things to think about:
-You probably want to be able to create your textures by name so make sure your resources contain names (I do)
-Look into Hash structures, or create your own (I did)
-Encryption if you don''t want users to change your resources (I like it plugable)
-Multiple resource formats ( 1 for textures, 1 for models, 1 for maps) or 1 resource format containing all ( I did the later)

---------------------------
I may be getting older, but I refuse to grow up
I may be getting older, but I refuse to grow up
Mark Duffill
Mark Duffill
You could simply concat all the raw data for each texture together to make one file. Of course you will need a header to identify textures etc.

the following is a c style struct to show how I would lay out a simple texture block:

struct Texture Pack Header
{
u32 VersionNumber;
u32 NumberOfTextures;

ATEXTURE textures[NumberOfTextures];
};

struct ATEXTURE
{
u32 Width, Height, Bpp, DataSize;
u8 Data[DataSize];
};


You the would open the file and read the data, parsing it as you go. ie read version number, check its ok, read number of textures, then for each texture read the data....


hope this is of some help
Mulligan
Mulligan
humm, gave me some ideas, thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.