update/H2

Maybe that is what Michael and Karl were bitching about
Michael? Do you mean John?

recently (not that they ever volunteered specifics, ahem).
Do you mean PowerPak? It should be a high-level add-on to SDL. At least
I think that(John started the project).

The probable solution is a two-part API, much like
GL vs. GLUT - the low level SDL providing the services,
the high level SDL offering the GLUT-like toolkit.

That would be a great chance to make SDL more flexible and easier zo
use, and a can’t see any disadvantages. What about the others in this
list?

Karl

Bernd Kreimeier wrote:

  • looked at H2 CIN_ API
  • looked at SMPEG
  • felt uneasy
  • started thinking some more

I’ll try to put it this way: I have to write an MPEG
frame of choice into an LFB memory area that is then
set as a bitmap (DrawPixels) or texture for Mesa/OpenGL.
That is the way to get it through Glide to the VG/V2
passthrough output. I would allocate the LFB area,
and advance its update by H2 ticks.

SMPEG submits all control to SDL, which turns H2
(formerly using Smacker) kinda upside down. I’d rather
tread more lightly at this point.

Do we have a Glide/Mesa app using SMPEG already?

Myth2, but it only uses SMPEG when the X window is up, not during glide
rendering mode.

I think I have seen this design issue before. There
should be a clear separation between import (decoding,
conversion to requested depth/size, write to location),
context (allocate/switch surface to write to), and
control (how many milliseconds, which frame). I.e.,
SMPEG_play is actually SDL_MpegPlay.

SDL seems to aim for two different levels at the same
time: the base API providing system services in a
portable way (LFB, sound device, soon OpenGL), and
a GLUT-like toolkit (with all the familiar struggles
for control).

Lessons I learned from OpenGL:
always maintain data export/import separately
never enforce data structures at API level
use primitive types and pointers exclusively
make context current without using a handle at API level

The more convenient SDL is as a toolkit for aspiring
game coders starting from scratch, the less suitable
it will be as a toolbox to retrofit an existing
application.

Maybe that is what Michael and Karl were bitching about
recently (not that they ever volunteered specifics, ahem).
The probable solution is a two-part API, much like
GL vs. GLUT - the low level SDL providing the services,
the high level SDL offering the GLUT-like toolkit.

SDL+Mesa will find itself in direct competition with
GLUT. I think the connection is obvious.

Comments?

I think you are absolutely right. My brain is fried from looking at SDL
for two years now, so any fresh perspective is welcome. I think you
will do a good job of stepping back and seeing what needs to be done
with SDL.

I can use the existing SMPEG source for Civ, and you can fork the source
into a development tree to test out ideas.

Just grist for the mill, here are some ideas I’ve been toying with over
the past few weeks:

Separate SDL into:
video + events
-> multiple drivers, each having one or more displays, each having a
"screen" which can be set to any resolution or bit-depth, and a set of
input devices that can be enabled: joysticks, mice, keyboards, etc.
sound
-> multiple drivers, each having one or more sound cards which can be
placed into half or full duplex mode for output or recording

Obviously this would be a lot of work which I’m too tired to even
contemplate at the moment, but it would work really well in that the
multiple driver idea would allow us to eliminate the dynamic loading
cruft, and make the code much more reentrant. We could also do things
like handle multiple output windows, or multiple keyboard input sources
from the same application. There is also a good chance that an
appropriate low level framework could be written to make adding drivers
easy, and allow layering for people who want to get as close to the
native APIs as they want, while still providing the simple API for other
developers. I ramble, but anyway… just food for thought.

I’m CC’ing the SDL mailing list because there may be other people with
good insight. :)–
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Hi!

SDL seems to aim for two different levels at the same
time: the base API providing system services in a
portable way (LFB, sound device, soon OpenGL), and
a GLUT-like toolkit (with all the familiar struggles
for control).

Lessons I learned from OpenGL:
always maintain data export/import separately
never enforce data structures at API level

That’s a really good point and one of SDL’s current misconceptions:
Using data structures for exchanging information between an application
and the library may not be inherently bad, but I had quite a few
struggles with SDL because it wasn’t clear to me, whether some data
fields had to be filled in by the application or would be calculated by
the library (Sound conversion comes to mind). Furthermore, I still
don’t know if SDL_BlitSurface() changes some entries in the source or
destination rectangle. Sure, you can always look at the source and all
this could be amended by more detailed documentation, but I’d rather
have a few more entrypoints to the library than to hassle with obscure
data structures.

use primitive types and pointers exclusively
make context current without using a handle at API level

Yup, that’s probably the way to go.

The more convenient SDL is as a toolkit for aspiring
game coders starting from scratch, the less suitable
it will be as a toolbox to retrofit an existing
application.

Maybe that is what Michael and Karl were bitching about
recently (not that they ever volunteered specifics, ahem).
The probable solution is a two-part API, much like
GL vs. GLUT - the low level SDL providing the services,
the high level SDL offering the GLUT-like toolkit.

I can only second this proposal.

SDL currently consists of a solid core that provides the low level
services, and a half-heartedly implemented “high level” library,
performing such things as loading WAVs and BMPs.

I’d really prefer a rock-stable, stripped down low level SDL with a
powerful and flexible high level API built on top of the core
functionality and including things like loading sound/graphics data in
various formats, playing videos, converting between sound and video
formats etc.

It might also be a good idea to move the event queueing to the high
level library. Both Glut and SVGALIB a queue by enabling the programmer
to define event handlers that are called, say, whenever the mouse is
moved. ll SDL could poll the mouse/keyboard/… and call the
appropriate functions whenever needed. (This would also solve my
longstanding problems with X’s lagged mouse movement events… Uh, I
know, I’m getting on your nerves, but this one still bugs me :slight_smile:

I can use the existing SMPEG source for Civ, and you can fork the source
into a development tree to test out ideas.

What about a public fork? I’d gladly help out with some code and ideas.
I have some basic knowledge about X and svgalib, I’m a proficient C and
C++ coder, I’m quickly covering ground in terms of game programming AND
my semester doesn’t start before October, so I have some time for
hacking on a game library :slight_smile:

I’m CC’ing the SDL mailing list because there may be other people with
good insight. :slight_smile:

Daniel

Daniel Heck writes:

What about a public fork? I’d gladly help out with some code and ideas.

At this point, the problem is that I am in the process of
moving, and I won’t have much time until October, when
things will hopefully settle down quickly. I am also not
yet up to speed on SDL.

Given the code already available in SDL, our problem seems
to be interface, not implementation. The best way to disccus
API changes is annotated header files for public review.

Once we have hatched out a good interface, shuffling the SDL
code and making it fit the revised data flow should be
comparatively straightforward. Legacy support might prove
a more tricky part.

                                            b.

It might also be a good idea to move the event queueing to the high
level library. Both Glut and SVGALIB a queue by enabling the programmer
to define event handlers that are called, say, whenever the mouse is
moved. ll SDL could poll the mouse/keyboard/… and call the
appropriate functions whenever needed. (This would also solve my
longstanding problems with X’s lagged mouse movement events… Uh, I
know, I’m getting on your nerves, but this one still bugs me :slight_smile:

I can use the existing SMPEG source for Civ, and you can fork the source
into a development tree to test out ideas.

What about a public fork? I’d gladly help out with some code and ideas.
I have some basic knowledge about X and svgalib, I’m a proficient C and
C++ coder, I’m quickly covering ground in terms of game programming AND
my semester doesn’t start before October, so I have some time for
hacking on a game library :slight_smile:

You make some really good points. I’m more than happy to open up SDL
to you and other interested coders who want to restructure it a little
better.

I can facilitate folding your changes into the mainline when you are
are ready. Bernd is in charge of SDL architecture
here at Loki, so I’m sure he’ll be a part of the planning process.

Thanks Daniel!

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

It might also be a good idea to move the event queueing to the high
level library.

Yes please!
The compulsory built-in message loop stuff is the only thing that makes me
uneasy about SDL - I’d prefer to have the option of doing it all myself.

A High-level/Low-level library split sounds like a cool idea to me.

Ben.–
Ben Campbell (Antipodean Straggler)
Programmer, CyberLife Technology Ltd
ben.campbell at cyberlife.co.uk