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

Re: Best API?

Gareth Noyce wrote:

> > > I'd also like some color layering (transluscent sprite overlays)
> > I haven't done this, but I think it could be added fairly easily.
> Not sure of the most optimised method, but a bit of jigging with palette
> values based on the sprite to overlay would probably do something close...

Doing alpha blits (translucency) with PseudoColor (palette-based) visual
is extremely hard, due to the low number of color cells.

> > I've implemented run length encoded (RLE) sprites.
> With masking?

RLE is an optimized technique to do color keyed sprites in software. It
consist of converting the sprite into a data structure that says one of
two things: 1- the following X pixels are normal or 2- the following X
pixels are transparent. So instead of checking every pixels for the
magic masking value, you "know" in advance whether they are transparent
or not and can blit them in larger blocks.

> > Me neither.  Well, I would like to release for all versions of Linux (e.g.
> > alpha)
> Potentially I would agree, but my primary concern is something for a few
> friends. I'm not interested in mass distribution (although I'll happily post
> it somewhere). This is purely for my own satisfaction and for something to
> play in the living room when we get back from the pub on a friday night! ;-)

Big things sometimes starts this way, you know! Quadra is in the direct
lineage of Remtris 1 and 2, which were for the sole fun of the computer
club at my college! :-)

Remtris 2 was a rewrite in C++ that Rem did to learn C++, and added the
networking feature (IPX at the time, both versions were DOS).

> >> <console only>
> > Same here.  You'll probably get a lot of flack for this though.
> Don't see why. Is everyone /really/ that desperate for X games?! I would
> have thought a performance hit would be incurred by running on top of X and
> considering the potential for badly optimised code in any of my efforts I'm
> gonna need all the spare cycles I can get! ;-)

Back in the time where things were all done in software, people used low
resolutions like 320x200 in 256 colors and were happy. Then, SVGA became
popular and now people wouldn't settle for less than 640x480, and also
became color-hungry.

The truth is that X would have to be MUCH less efficient than it
currently is to outweight the fact that it uses many acceleration
features of video cards and supports a great number of them (tried
640x480 in 16 bits per pixel with Svgalib recently? have a nice day!).

The performance hit isn't that much if your game is well written, you'll
win more than you'll lose. If you only want framebuffer access, you
could use DGA, but this requires root privileges tho. But just a few
XImages with XShmPutImage are plenty fast for most applications.
XCopyArea is your friend also (sometimes highly accelerated, depending
on the cases and on the video drivers).

> > Heh, good luck with this :)  Personally, I prefer having no external
> > library.  But I'm sure I'm going to get flamed for this.
> Why the preference? For speed?

I'd bet on masochism, but I'll shut my mouth, ok? :-)

The fact is some guy in the world probably already made a library to do
what you want to do that is both more general and much faster/optimized
than you'll ever be able to make it. Unless you really are an expert.
Are you an *expert*?

Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi