[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Progress Update



Christian Reiniger wrote:

> > I'm not saying that you shouldn't use your HashTable for directories.
> > I'm just saying that putting so much effort into something so easily
> > fixable later on (I'm assuming good modularity here) is *not* helping
> > PenguinPlay as a project. It isn't the first time that PenguinPlay "dies
> > out", maybe this is a reason.
> 
> Well, now you stumbled and kicked an excellent counter-argument directly
> into my hands ;)
> 
> The *real* work, the one that *really* took a long time was making the
> basic internal PFile structure versatile enough to adapt to later changes,
> making it fixable. The algorithm switch was simple and fast. IIRC we
> started thinking about it perhaps two weeks ago, and now it's almost done.
> And consider that PenguinPlay goes through major changes now. There were -
> are - many things sucking up our time besides PFile coding.

Well, you said it yourself, those are *internal* structures. For Quadra,
we have a resource file class, similar to the PFile system. We made
ourself a nice interface and we implemented it afterward.

A resource file signature (4 bytes), then the resources themselves. Each
resources is a zero-terminated string being the identifier, then an
unsigned int being the size, then the data. After exactly the number of
bytes in the "size", there is another resource, or end of file.

We mmap this file and build a linked list of all the resources in it
when we "load" it. Yes, a *linked list*. :-)

And you know what? It doesn't even show up on the profiler, with
hundreds of files varying between 300 and 300,000 bytes in size,
"opened" during the course of the game.

What did show up on the profile was the drawing routines and by tweaking
the dirty rectangle system an afternoon, I more than doubled the
framerate on some specific troublesome parts of the game. A few hours,
at most.

Maybe that if we had more *thousands* of files, I'd go and change the
linked list to a hash table. A "regular" hash table, nothing very
specifically optimized.

How much time did you spend total on PenguinFile? At Ludus, one person
had to work about a grand total of two days on this, including
debugging.

And it isn't completely lacking, the game can "load" multiple resource
files, with resources loaded later on replacing those with the same
identifiers loaded previously, and so on. The game simply load the main
"quadra.res", then looks for "quadra110.res", then "quadra111.res" (for
the 1.1.1 version). We only look for resource files of versions
differing only by the patch level, we do not look for "quadra101.res"
for example.

It is *fixable*. Maybe we'll have to trash the file format one day, but
it doesn't matter that much, we can have conversion tools and other
things like that. Hmm, thinking of it, maybe there's even a version
number after the signature in the file (or maybe in the signature
itself, I'd have to check)... :-)

-- 
Pierre Phaneuf
http://ludusdesign.com/