Hi,
where can I find some stuffs about how to make my games more ‘speddy’
in SDL?
I’m interested in video and input stuffs.
(like, converting from xx bpp to surface bpp will increase blitsurface
speed)
Someone should dedicate a web site to this… heh
We’re discussing this sort of stuff on the list every now and then, and
indeed, there are some important SDL related things to keep in mind, but
the most important stuff isn’t really SDL related.
To get real speed, regardless of API, you need to figure out how your
particular problem is best solved from a hardware POV, and then figure
out how to do it with whatever API you decide to use.
Because of the complexity (and occasionally braindead design) of PC
hardware, there isn’t a single “best way” to do things. Many games will
appear to work best with two or more methods at once, which usually means
that you’ll end up with some sort of compromize.
For example, on most targets, opaque and colorkeyed blits are best done
with everything in VRAM, using h/w acceleration - but as soon as you
start doing software rendering, or alpha blending, VRAM is the worst
place to work in! Where the surfaces are best placed depends on the
balance between normal and alpha blits, and which platform you’re on. In
some cases, you might have to support two or three different methods of
rendering to get maximum performance on all targets.
Another question: I see that SDL keyboard input is ‘message’ based, but
this I think is too slow in comparation with DirectInput (for example).
“message” here does not mean “message, as implemented by Microsoft on top
of a kernel with serious task switching problems”.
We are talking about a thread safe message queue, but it has nothing to
do with whatever a “message” might be on whatever platform you’re using.
AFAIK, the SDL message queue is implemented on top of the fastest and
lowest level synchronization objects provided by each platform, and as
such, it should be pretty much as fast as it gets on each platform.
BTW, the new audio engine of Kobo Deluxe is using “messages” (events)
internally, all the way into the voice mixers. Sending an event means
that you grab a fixed size struct from a preallocated pool and add it to
a linked list. There are no system calls involved, and sending/receiving
these “messages” costs very little. In fact, switching to an “event based
design” has made it possible to make the engine a lot more flexible and
accurate, without adding significant overhead. Some things are actually a
lot more effecient this way, since a lot of “explicit context switches”
can be avoided.
In short, if a “message” based system is slow, it’s either because of a
bad implementation, or because of the synchronization constructs (needed
for thread safe implementations) of the OS are slow.
Any improvement in the future?
Any ideas…? Dropping the thread safe queue?
//David Olofson — Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
-------------------------------------> http://olofson.net -'On Tuesday 21 May 2002 09:31, user at domain.invalid wrote: