RE: [AD] Font loadin: Feature Request

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 29 Nov 2001 at 10:13, Vincent Penquerc'h wrote:

> > I am with Shawn as for load times, and as a particular 
> > example, some days
> > ago a friend lent me his copy of Blade.  Apart from being
> > ridiculously easy to rip stuff from the game (even python code), the
> > game took 20 minutes to UNINSTALL, when a single datafile would be
> > erased in less than a second. Blizzard's games (Starcraft, Diablo)
> > exploit really nicely the "all in a single file" strategy and it's
> > way more efficient.
> 
> I would like to offer another point of view on this point.
> In my case, I have a game level that uses a set of graphics, sounds,
> and so on. These are stored in datafiles, and loading the whole thing
> would take a given amount of space. I do not load that in a go, though
> it would probably be a bit faster if I did. I load only what I need,
> as this saves a great deal of memory. Sure, you'll tell me that it's
> OK to chew 10 megs more than I do need, but it's an argument I don't
> buy. Storing the data in different files can bring more ease, but it
> is often not an option, as it would mean either duplicating lots of
> resources or splitting more and more, up to the point where you get to
> datafiles holding a single item. In this case, loading only items you
> need (they're refcounted) is a big win on space, while not sacrificing
> loading speed too much. That said, I have a custom table-of-contents
> system :)
> 
> -- 
> Vincent Penquerc'h 
> 

Hum, that said, I do think that load_font() would then just be loading a 
datafile object. But imo it can't be implemented as a standard #define, 
seeing as you need to both cast the dat->dat to a FONT *, and unload 
the datafile object. Thus it can't be a define. An inline function is 
possible tho:

inline FONT *load_font(const char *file, const char *fnt)
{
	if (!file || !fnt) return NULL;
	DATAFILE *dat = load_datafile_object(file, fnt);

	if (!dat) return NULL;
	FONT *font = (FONT *)dat->dat;

	unload_datafile_object(dat);
	
	return font;
}

As for your point of the possible need to split up datafiles farther and 
farther until you have but single items stored, I agree that you need to 
make a decision on what level to split up to. But a question that I do 
have about that, it is possible to create a directory structure inside 
datafiles, isn't it? It may be off-topic in this mail, but if it's not possible, I 
would request that directory structures would become possible. For 
one thing, I disgust physical directory structures; '../../' and all, it sucks.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/