Diablo II on linux and SDL stuff

The thought of being able to play D2 on linux almost makes me drool… but
it raises some interesting questions in my mind (and it somewhat relates to
the recent msg about opengl and the 3d rts).

(NOTE: most of this is based on complete conjecture… it could be
irrelevant.)

I believe Blizzard has prerendered backgrounds (perhaps some sort of
elevation data is supported, perhaps not) that are just blitted to the
screen. OpenGL acceleration provides:

“5.2.4 - What benefits does 3D acceleration offer?
A 3D card for Diablo II will help frame rate on lower end systems, as well
as boosting the graphics substantially. All of the spell effects have
bright glowing colors, and there are other things such as fog, transparent
flames, colored smoke, and much more that will look amazing with 3D
acceleration. There is also a parallax effect which has to be seen to be
fully appreciated.”

Since using the pre-rendererd background as a texture for one large
polygon is probably laughably unfeasible, can someone give me and idea of
how you might do this? Esp. with SDL? This general idea seems to be
gaining prevalence… look at TA:Kingdoms. They use D3D (and perhaps opengl
now?) for just fx, not rendering the terrain or models.

Furthermore, why does opengl help with these fx? The only obvious benefit
might be some sort of accelerated alpha-blending for transparency, etc…

Thoughts anyone?

Bret

Since using the pre-rendererd background as a texture for one large
polygon is probably laughably unfeasible, can someone give me and idea of
how you might do this? Esp. with SDL? This general idea seems to be
gaining prevalence… look at TA:Kingdoms. They use D3D (and perhaps
opengl
now?) for just fx, not rendering the terrain or models.

I am guessing that Blizzard, if it is using pre-rendered backgrounds, has
taken them, subdivided them into a series of smaller triangles, and has
rendered those. They might have dumped out some height data which they could
then use for lighting… that’d be cool, actually. I may need to try that.

Furthermore, why does opengl help with these fx? The only obvious benefit
might be some sort of accelerated alpha-blending for transparency, etc…

It’s 3D, it’s faster. Alpha-blending can get accelerated, and if you
compose the particle system out of small, textured quads/triangles with
alpha values, you can blend 'em in hardware.

Bret

Nicholas–
Nicholas Vining “While you’re out there struggling
vining at pacificcoast.net with your computer, I’m naked,
icq: 20872003 clueless, and feeling good!”
- Ratbert

hi`

Bret McMillan wrote:

Furthermore, why does opengl help with these fx? The only obvious benefit
might be some sort of accelerated alpha-blending for transparency, etc…

alpha blending without a performance hit is the only reason for using
OpenGL (on Linux) for a 2d game. Using OpenGL for simple sprite blitting
is usually slower than blitting in software (mail me directly for more
detail) - my experience with the TNT drivers are that using X11 without
DGA is about 3/2 times faster than using GL (many texture changes) to
simply blit stuff (if you blit more than one sprite ;)).–
Daniel Vogel My opinions may have changed,
666 @ http://grafzahl.de but not the fact that I am right

I am guessing that Blizzard, if it is using pre-rendered backgrounds, has
taken them, subdivided them into a series of smaller triangles, and has
rendered those. They might have dumped out some height data which they could
then use for lighting… that’d be cool, actually. I may need to try that.

I would think that wouldn’t give either good performance or the kind of
quality images people are reporting.

It’s 3D, it’s faster.

This is precisely the kind of notion I don’t support. You can run OpenGL
in software mode, and it’s not fast. Put it this way: if they’re not
using it for truly 3d data (which is what I’m guessing), does OpenGL
really accelerate anything? Blending, and they could do a little voodoo
to use some built in opengl fog, but other than that, would it be useful
for anything else?

Alpha-blending can get accelerated, and if you
compose the particle system out of small, textured quads/triangles with
alpha values, you can blend 'em in hardware.

Yeah, 'though making a particle system for things that small (keep in
mind the size of things on screen) might be overkill

So, we’ve covered a little of “why”. Now how about “how”?
Bret

I would think that wouldn’t give either good performance or the kind of
quality images people are reporting.

Linear textures, use gluOrtho2D as your projection matrix… sure! That’d
work fine. You could go a few steps further and hork up a little bump
mapping… I dunno, that might be the best bet. Sam, if you get Diablo II’s
source, please fill us in on the mystery! :slight_smile:

This is precisely the kind of notion I don’t support. You can run OpenGL
in software mode, and it’s not fast. Put it this way: if they’re not
using it for truly 3d data (which is what I’m guessing), does OpenGL
really accelerate anything? Blending, and they could do a little voodoo
to use some built in opengl fog, but other than that, would it be useful
for anything else?

I’m guessing that they’re encapsulating their GL code so you have a GL based
version and a non-GL based version. And you could use GL to do blending,
fog, lighting I suppose, bump-mapping, shadows… The 3Dfx features list is,
as follows, “improved transparency effects, colored lighting, smoother
shadowing and transitions between various areas, atmospheric effects, and a
faster frame rate…”

To tell you the truth, I was semi under the impression that Diablo II was
3D, or that at least chunks of it were (actors/objects). I’m just gonna take
a quick gander at the Diablo II screenshot of the week… nah, that’s 2D
alright. I’m sure there must be SOME advantage…

HAH! Hang on! What if you were to build two copies of each world… one 2D
raytraced image, and one 3D version, simplified? Use the 3D version for
light/shadow calculations, and map those results on top of the 2D version!
That might be interesting to see in practice. Now, if you were to do things
the Q3A/Carmack way, where you built in lightmap, bumpmap, and specular
texturing on top of the world, if you slashed your world down to maybe
150-200 polygons/screen, you could do it quickly! (Relatively speaking) This
might explain some of the features… atmospheric effects, colored lighting,
et cetera.

Now, let’s assume that the software mode doesn’t do this. We just take the
2D version, and light things the old boring way. Hence, if you have
hardware, you get a world that has beauty and grace, and if you don’t have
the hardware, you get old style quality.

So, we’ve covered a little of “why”. Now how about “how”?

I suspect maybe I’m on the right track, although it’d take some fearsome
software. If nobody’s done this, it’d sure as hell be worth a shot.

Cheers,

Nicholas

Nicholas Vining “While you’re out there struggling
vining at pacificcoast.net with your computer, I’m naked,
icq: 20872003 clueless, and feeling good!”
- Ratbert

----- Original Message -----
From: brm@duke.edu (Bret McMillan)
To: sdl at lokigames.com
Date: Thursday, February 03, 2000 5:50 PM
Subject: Re: [SDL] Diablo II on linux and SDL stuff…

Daniel Vogel wrote:

Furthermore, why does opengl help with these fx? The only obvious benefit
might be some sort of accelerated alpha-blending for transparency, etc…

alpha blending without a performance hit is the only reason for using
OpenGL (on Linux) for a 2d game. Using OpenGL for simple sprite blitting
is usually slower than blitting in software (mail me directly for more
detail) - my experience with the TNT drivers are that using X11 without
DGA is about 3/2 times faster than using GL (many texture changes) to
simply blit stuff (if you blit more than one sprite ;)).

Even if the sprite data doesn’t change much? Say you have to fill the
screen with tiles, with a choice of 8 tiles, you could put those 8 tiles
in a texture, upload it, then texture it on a large quad (or multiple
quads, I don’t remember).

Of course, since 2D work would be pretty texture-heavy stuff, you’d be
better to make sure you’re using everything that can enhance texture
performance, like texture sorting and using texture objects.

What did you do exactly?

OpenGL might be useful for alpha blending, as you mentioned, maybe for
doing a “fog of war”, maybe even for tesselating the tiles a bit.–
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/

hi`

Pierre Phaneuf wrote:

OpenGL might be useful for alpha blending, as you mentioned, maybe for
doing a “fog of war”, maybe even for tesselating the tiles a bit.

another advantage of OpenGL is that rotation comes without a speed
penalty too. I guess this is getting really off topic so I will mail you
directly.–
Daniel Vogel My opinions may have changed,
666 @ http://grafzahl.de but not the fact that I am right