Blitting / event handling with multiple threads

Hi,

I’m trying to write a clone of an old DOS game in C++, using SDL,
and I’ve been working on that for about a year now, having tried
many different methods of event handling and drawing.

I first tried a structure where there was only one game loop that
was drawing the objects, updating them and handling input events.
Using a double-buffered video mode, the loops/sec of the whole game
were limited to approximately the refresh rate of my monitor, because
SDL_Flip waits for the vertical retrace.

The game got more and more complex (and slow), because there were
hundreds of objects that had to be updated and blitted, so I tried to use
multiple threads to speed up the game. Unfortunately, SDL doesn’t
support blitting and event handling in any other thread than the main
thread, so any speed improvement is lost because event handling and
drawing are limited by SDL_Flip() again.

Is there any possibility to call each object’s draw() method (where a lot
of blitting is done) from a separate thread, so that only this particular
thread has to run at 60-80 loops/sec. and the other ones are only
limitated by the CPU speed?

My last try was the following one:
I created three threads where game objects can register themselves,
and the thread objects call their draw() / update() / event() method
asynchronously.
The drawing thread also calls SDL_Flip() and SDL_Delay(10) to synchronize
with the vertical refresh, so it is the only one that is slowed down, but the
SDL docs say that it is not safe to call any library function outside the main
thread.

Can anyone give advice please?

-Christian

(I included a piece of code from main.cpp to show the use of the different threads).-----------------------------------------------------------------------------------------------
int runEventThread(void *ptr)
{
EventThread *threadObject = (EventThread *)ptr;

// EventThread::update() just goes through the list of
// registered objects and calls their event() method when
// an event occurs.

    while(!threadObject->quit())
            threadObject->update();

}

int runDrawThread(void *ptr)
{
DrawThread *threadObject = (DrawThread *)ptr;

// DrawThread::update() goes through the list of
// registered objects and calls their draw() method.

    while(!threadObject->quit())
            threadObject->update();

}

int runUpdateThread(void *ptr)
{
UpdateThread *threadObject = (UpdateThread *)ptr;

// UpdateThread::update() goes through the list of
// registered objects and calls their update() method.

    while(!threadObject->quit())
            threadObject->update();

}

int main(int argc, char *argv[])
{
IO *io = new IO();
EventThread *eventThread = new EventThread(io);
DrawThread *drawThread = new DrawThread(io);
UpdateThread *updateThread = new UpdateThread(io);

    // create threads for drawing and event handling
    SDL_Thread *event = SDL_CreateThread(runEventThread, (void *)eventThread);
    SDL_Thread *draw = SDL_CreateThread(runDrawThread, (void *)drawThread);
    SDL_Thread *update = SDL_CreateThread(runUpdateThread, (void *)updateThread);

    Dune *dune = new Dune(io, 0, 0, 0, 640, 480, drawThread, updateThread, eventThread);

    // the event thread quits when it receives an EVENT_QUIT event
    SDL_WaitThread(event, NULL);

    updateThread->stop();   
    drawThread->stop();
    eventThread->stop();

    SDL_WaitThread(update, NULL);
    SDL_WaitThread(draw, NULL);

    delete(dune);
    delete(updateThread);
    delete(drawThread);
    delete(eventThread);
    delete(io);

}

Christian Morgner wrote:

Is there any possibility to call each object’s draw() method (where a lot
of blitting is done) from a separate thread, so that only this particular
thread has to run at 60-80 loops/sec. and the other ones are only
limitated by the CPU speed?

What’s the point to draw an object 81+ times per second to a surface if
you know that that particular surface will be displayed only 60/80 times
per second?

I think you need to separate better the game logic from the actual
drawing to the display.

The game logic have to choose the position of an object and the frame to
display (based on collisions, events…).

The display loop should only draw the object on the screen.

This can be done in a single thread without problems, or, if you like,
also with 2 threads with a mutex to arbitrate the access to the object
datas.

Anyway a multithreaded program that keep 2 idle thread on a single
processor machine is always slower than the same program built with a
single thread approach.

Bye,
Gabry

Threading is not a magic performance booster unless you have a
multiple processor system (which I doubt your customers/target
audience have). Also, because you must synchronize computations
between e.g. drawing and physics updating, you get a lot of extra
work, only for a gain in the similarity between your program and how
you think of your program (not a bad gain but in this case the
trade-off between engineering effort and model-resemblance is really
not worth it, trust me) not to mention the problem of not being able
to call library functions in threads different from the main thread,
in general.

There is nothing that keeps you from doing several game-object updates
inbetween SDL_Flip’s, if that is a limiting factor, or not drawing all
object (for example only drawing the ones that have actually moved!).

Could you describe your game a little more specifically? What are the
rules? Is it scrolling? Etc. etc.

If you have followed the usual tricks-of-the-trade from the SDL-faq
(SDL_DisplayFormat eg.), then continue to read.

My general advice is pick up some algorithms book and/or real time
computer graphics book to get ideas on how to improve performance. An
excellent book on the real time rendering subject is

http://www.realtimerendering.com/
(no pun intended :slight_smile:

… which covers a lot and has tons of pointers.

What you could do for starters is run a profiler tool (‘man gprof’ if
your on *nix or “Profiling/Profiler” in MSVC) and find out what is
taking time.

The questions you should ask yourself is “What is the bottleneck?”:

  1. graphics rendering (could be further subdivided…)
  2. logic/physic of the game
  3. something else? (O/S stealing your app’s time, event handling, …)

Good luck,

/OlofOn Mon, 31 Jan 2005 15:54:27 +0100, Christian Morgner <christian.morgner at postamt.cs.uni-dortmund.de> wrote:

Hi,

I’m trying to write a clone of an old DOS game in C++, using SDL,
and I’ve been working on that for about a year now, having tried
many different methods of event handling and drawing.

I first tried a structure where there was only one game loop that
was drawing the objects, updating them and handling input events.
Using a double-buffered video mode, the loops/sec of the whole game
were limited to approximately the refresh rate of my monitor, because
SDL_Flip waits for the vertical retrace.

The game got more and more complex (and slow), because there were
hundreds of objects that had to be updated and blitted, so I tried to use
multiple threads to speed up the game. Unfortunately, SDL doesn’t
support blitting and event handling in any other thread than the main
thread, so any speed improvement is lost because event handling and
drawing are limited by SDL_Flip() again.

Is there any possibility to call each object’s draw() method (where a lot
of blitting is done) from a separate thread, so that only this particular
thread has to run at 60-80 loops/sec. and the other ones are only
limitated by the CPU speed?

My last try was the following one:
I created three threads where game objects can register themselves,
and the thread objects call their draw() / update() / event() method
asynchronously.
The drawing thread also calls SDL_Flip() and SDL_Delay(10) to synchronize
with the vertical refresh, so it is the only one that is slowed down, but the
SDL docs say that it is not safe to call any library function outside the main
thread.

Can anyone give advice please?

-Christian

(I included a piece of code from main.cpp to show the use of the different threads).

int runEventThread(void *ptr)
{
EventThread *threadObject = (EventThread *)ptr;

// EventThread::update() just goes through the list of
// registered objects and calls their event() method when
// an event occurs.

    while(!threadObject->quit())
            threadObject->update();

}

int runDrawThread(void *ptr)
{
DrawThread *threadObject = (DrawThread *)ptr;

// DrawThread::update() goes through the list of
// registered objects and calls their draw() method.

    while(!threadObject->quit())
            threadObject->update();

}

int runUpdateThread(void *ptr)
{
UpdateThread *threadObject = (UpdateThread *)ptr;

// UpdateThread::update() goes through the list of
// registered objects and calls their update() method.

    while(!threadObject->quit())
            threadObject->update();

}

int main(int argc, char *argv[])
{
IO *io = new IO();
EventThread *eventThread = new EventThread(io);
DrawThread *drawThread = new DrawThread(io);
UpdateThread *updateThread = new UpdateThread(io);

    // create threads for drawing and event handling
    SDL_Thread *event = SDL_CreateThread(runEventThread, (void *)eventThread);
    SDL_Thread *draw = SDL_CreateThread(runDrawThread, (void *)drawThread);
    SDL_Thread *update = SDL_CreateThread(runUpdateThread, (void *)updateThread);

    Dune *dune = new Dune(io, 0, 0, 0, 640, 480, drawThread, updateThread, eventThread);

    // the event thread quits when it receives an EVENT_QUIT event
    SDL_WaitThread(event, NULL);

    updateThread->stop();
    drawThread->stop();
    eventThread->stop();

    SDL_WaitThread(update, NULL);
    SDL_WaitThread(draw, NULL);

    delete(dune);
    delete(updateThread);
    delete(drawThread);
    delete(eventThread);
    delete(io);

}


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Christian Morgner wrote:

Hi,

I’m trying to write a clone of an old DOS game in C++, using SDL,
and I’ve been working on that for about a year now, having tried
many different methods of event handling and drawing.

I first tried a structure where there was only one game loop that
was drawing the objects, updating them and handling input events.
Using a double-buffered video mode, the loops/sec of the whole game
were limited to approximately the refresh rate of my monitor, because
SDL_Flip waits for the vertical retrace.

The game got more and more complex (and slow), because there were
hundreds of objects that had to be updated and blitted, so I tried to use
multiple threads to speed up the game. Unfortunately, SDL doesn’t
support blitting and event handling in any other thread than the main
thread, so any speed improvement is lost because event handling and
drawing are limited by SDL_Flip() again.

Is there any possibility to call each object’s draw() method (where a lot
of blitting is done) from a separate thread, so that only this particular
thread has to run at 60-80 loops/sec. and the other ones are only
limitated by the CPU speed?

I’ll tell you a secret : even if you have 100 threads, you still have 1
video card. Which means, basically, that it will be serializing graphics
access at some point.
So there’s no point in multiple threads rendering to only one graphics
card. Thus the following limitation usually exists in the graphics world
and isn’t really bothering : only the thread that created the graphics
context should draw to it. That’s also true for SDL : the thread that
initialized SDL (main thread) should do the drawing. Lots of APIs have
that limitation btw.

My last try was the following one:
I created three threads where game objects can register themselves,
and the thread objects call their draw() / update() / event() method
asynchronously.
The drawing thread also calls SDL_Flip() and SDL_Delay(10) to synchronize
with the vertical refresh, so it is the only one that is slowed down, but the
SDL docs say that it is not safe to call any library function outside the main
thread.

That’s true and false depending on the library. If you’re not sure what
your library can handle, you have to go with the pessimistic asumption.
That said, lots of libraries have been becoming reentrant recently so
the situation is clearly improving. These libraries usually advertise
themselves as such (because it sometimes takes them a big code cleanup
to become so :).

Stephane

Hi,

Threading is not a magic performance booster unless you have a
multiple processor system (which I doubt your customers/target
audience have). Also, because you must synchronize computations
between e.g. drawing and physics updating, you get a lot of extra
work, only for a gain in the similarity between your program and how
you think of your program (not a bad gain but in this case the
trade-off between engineering effort and model-resemblance is really
not worth it, trust me) not to mention the problem of not being able
to call library functions in threads different from the main thread,
in general.

There is nothing that keeps you from doing several game-object updates
inbetween SDL_Flip’s, if that is a limiting factor, or not drawing all
object (for example only drawing the ones that have actually moved!).

Ok, then the best is to call each object’s draw() method in the main thread
along with the event handling, and create a separate thread for the actual
game logic?

I already have a working beta version with about 60% of the functionality of
the original game, but it was just too slow, running in a single thread with
60 updates / seconds.

Could you describe your game a little more specifically? What are the
rules? Is it scrolling? Etc. etc.

Its a real-time strategy game called “Dune II”, and I’m writing a clone of it
from scratch. I already decoded all the graphics, animation and font formats
from the original game and can convert it to SDL_Surfaces on loading, but the
drawing of 100+ surfaces plus the game logic was too slow.
There are different types of objects: sprites like vehicles, soliders,
bullets, rockets and sandworms :), and map objects like structures (that have
an animation, too), sand, concrete, rock. In the game, object AI is
controlled by an object-internal script language, each object needs a
path-finding algorithm to avoid collisions with other objects. Objects scan
the area around them. There is a map that has 64x64 tiles and the player’s
view is 15x10. The method of updating and drawing everything in one thread is
just too slow.

If you have followed the usual tricks-of-the-trade from the SDL-faq
(SDL_DisplayFormat eg.), then continue to read.

My general advice is pick up some algorithms book and/or real time
computer graphics book to get ideas on how to improve performance. An
excellent book on the real time rendering subject is

There is no need for real-time rendering, just blitting the right part of the
surface of the sprite, or blitting a fire animation / smoke animation, do
some palette animation and things like that, but about 100 objects that need
to be drawn, interact with each other, find a path on the map and so on is
just too slow with 60 fps, so I think separating the update() methods from
drawing and event handling should be working.

Thank you,
-Christian

Hi Christian,

You say it updated 60 times a second? IE your framerate was 60 times a
second?

If so id say the “issue” is that you have vsync enabled, where it
synchronizes the actual drawing with the verticle resync interupt of your
monitor to reduce tearing.

my appologies if you already know about vsync but if you dont, vsync doesnt
actualy “slow down” your game at all. it limits your FPS to 60, but is no
indication of the speed of your code, you could do twice as much logic lets
say and still be at the 60 fps.

PS Dune II rocked so hard, be sure and anounce here when you have a playable
version please!!

::makes a wall of sonic tanks:: muhaha! (:> ----- Original Message -----

From: christian.morgner@postamt.cs.uni-dortmund.de (Christian Morgner)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Monday, January 31, 2005 1:14 PM
Subject: Re: [SDL] Blitting / event handling with multiple threads

Hi,

Threading is not a magic performance booster unless you have a
multiple processor system (which I doubt your customers/target
audience have). Also, because you must synchronize computations
between e.g. drawing and physics updating, you get a lot of extra
work, only for a gain in the similarity between your program and how
you think of your program (not a bad gain but in this case the
trade-off between engineering effort and model-resemblance is really
not worth it, trust me) not to mention the problem of not being able
to call library functions in threads different from the main thread,
in general.

There is nothing that keeps you from doing several game-object updates
inbetween SDL_Flip’s, if that is a limiting factor, or not drawing all
object (for example only drawing the ones that have actually moved!).

Ok, then the best is to call each object’s draw() method in the main
thread
along with the event handling, and create a separate thread for the actual
game logic?

I already have a working beta version with about 60% of the functionality
of
the original game, but it was just too slow, running in a single thread
with
60 updates / seconds.

Could you describe your game a little more specifically? What are the
rules? Is it scrolling? Etc. etc.

Its a real-time strategy game called “Dune II”, and I’m writing a clone of
it
from scratch. I already decoded all the graphics, animation and font
formats
from the original game and can convert it to SDL_Surfaces on loading, but
the
drawing of 100+ surfaces plus the game logic was too slow.
There are different types of objects: sprites like vehicles, soliders,
bullets, rockets and sandworms :), and map objects like structures (that
have
an animation, too), sand, concrete, rock. In the game, object AI is
controlled by an object-internal script language, each object needs a
path-finding algorithm to avoid collisions with other objects. Objects
scan
the area around them. There is a map that has 64x64 tiles and the player’s
view is 15x10. The method of updating and drawing everything in one thread
is
just too slow.

If you have followed the usual tricks-of-the-trade from the SDL-faq
(SDL_DisplayFormat eg.), then continue to read.

My general advice is pick up some algorithms book and/or real time
computer graphics book to get ideas on how to improve performance. An
excellent book on the real time rendering subject is

There is no need for real-time rendering, just blitting the right part of
the
surface of the sprite, or blitting a fire animation / smoke animation, do
some palette animation and things like that, but about 100 objects that
need
to be drawn, interact with each other, find a path on the map and so on is
just too slow with 60 fps, so I think separating the update() methods from
drawing and event handling should be working.

Thank you,
-Christian


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi Christian,

You say it updated 60 times a second? IE your framerate was 60 times a
second?

If so id say the “issue” is that you have vsync enabled, where it
synchronizes the actual drawing with the verticle resync interupt of your
monitor to reduce tearing.

my appologies if you already know about vsync but if you dont, vsync doesnt
actualy “slow down” your game at all. it limits your FPS to 60, but is no
indication of the speed of your code, you could do twice as much logic lets
say and still be at the 60 fps.

PS Dune II rocked so hard, be sure and anounce here when you have a playable
version please!!

You just asked him to do something that is illegal in most countries.
Illegal to distribute it, and illegal to receive it. And you did it in
public. Why?

	Bob PendletonOn Mon, 2005-01-31 at 13:27 -0800, Alan Wolfe wrote:

::makes a wall of sonic tanks:: muhaha! (:

----- Original Message -----
From: “Christian Morgner” <christian.morgner at postamt.cs.uni-dortmund.de>
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Monday, January 31, 2005 1:14 PM
Subject: Re: [SDL] Blitting / event handling with multiple threads

Hi,

Threading is not a magic performance booster unless you have a
multiple processor system (which I doubt your customers/target
audience have). Also, because you must synchronize computations
between e.g. drawing and physics updating, you get a lot of extra
work, only for a gain in the similarity between your program and how
you think of your program (not a bad gain but in this case the
trade-off between engineering effort and model-resemblance is really
not worth it, trust me) not to mention the problem of not being able
to call library functions in threads different from the main thread,
in general.

There is nothing that keeps you from doing several game-object updates
inbetween SDL_Flip’s, if that is a limiting factor, or not drawing all
object (for example only drawing the ones that have actually moved!).

Ok, then the best is to call each object’s draw() method in the main
thread
along with the event handling, and create a separate thread for the actual
game logic?

I already have a working beta version with about 60% of the functionality
of
the original game, but it was just too slow, running in a single thread
with
60 updates / seconds.

Could you describe your game a little more specifically? What are the
rules? Is it scrolling? Etc. etc.

Its a real-time strategy game called “Dune II”, and I’m writing a clone of
it
from scratch. I already decoded all the graphics, animation and font
formats
from the original game and can convert it to SDL_Surfaces on loading, but
the
drawing of 100+ surfaces plus the game logic was too slow.
There are different types of objects: sprites like vehicles, soliders,
bullets, rockets and sandworms :), and map objects like structures (that
have
an animation, too), sand, concrete, rock. In the game, object AI is
controlled by an object-internal script language, each object needs a
path-finding algorithm to avoid collisions with other objects. Objects
scan
the area around them. There is a map that has 64x64 tiles and the player’s
view is 15x10. The method of updating and drawing everything in one thread
is
just too slow.

If you have followed the usual tricks-of-the-trade from the SDL-faq
(SDL_DisplayFormat eg.), then continue to read.

My general advice is pick up some algorithms book and/or real time
computer graphics book to get ideas on how to improve performance. An
excellent book on the real time rendering subject is

There is no need for real-time rendering, just blitting the right part of
the
surface of the sprite, or blitting a fire animation / smoke animation, do
some palette animation and things like that, but about 100 objects that
need
to be drawn, interact with each other, find a path on the map and so on is
just too slow with 60 fps, so I think separating the update() methods from
drawing and event handling should be working.

Thank you,
-Christian


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

|>PS Dune II rocked so hard, be sure and anounce here when you have a
playable
|>version please!!
| You just asked him to do something that is illegal in most countries.
| Illegal to distribute it, and illegal to receive it. And you did it in
| public. Why?
|
| Bob Pendleton

Which part is illegal? Unless I’m mistaken, the software itself is
legal, having been written from scratch. If all he distributes is his
own code, it should be perfectly fine.

|>>Its a real-time strategy game called “Dune II”, and I’m writing a
clone of
|>
|>it
|>
|>>from scratch. I already decoded all the graphics, animation and font
|>
|>formats
|>
|>>from the original game and can convert it to SDL_Surfaces on loading, but

Pete Elmore
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFB/ql9v24lB609Ih8RApGcAJ9pzbr4MIJ1EOSFU33edQ76474KngCfU9qC
m110QFCPyp4Dm63DE2leGEw=
=DAKS
-----END PGP SIGNATURE-----

Hi,

You just asked him to do something that is illegal in most countries.
Illegal to distribute it, and illegal to receive it. And you did it in
public. Why?

To my knowlegde - and I did some research before I started the project - the
game Dune II doesn’t belong to any company any more. I asked this question in
several mailing lists, and everyone told me the same.

The next thing is that I do not distribute the game itself, but only my
project without the .pak files. That’s why I needed to decode the format of
all resources. You need to own the original game in order to use my clone,
just copy the dune.pak file into the directory where the executable is.
Without it, you can’t play the game.

As far as I know the programmers of some other clones did the same,
so where is the problem?

-Christian

Why would it have to be illegal? The way I see it, Christian could
have his clone read the original game’s resource files (that are
provided by the end-user himself, from a copy of the game he already
legally owns). There’s really no need to distribute copyrighted
material.On Mon, 31 Jan 2005 15:45:40 -0600, Bob Pendleton wrote:

You just asked him to do something that is illegal in most countries.
Illegal to distribute it, and illegal to receive it. And you did it in
public. Why?

Hi,

You say it updated 60 times a second? IE your framerate was 60 times a
second?

If so id say the “issue” is that you have vsync enabled, where it
synchronizes the actual drawing with the verticle resync interupt of your
monitor to reduce tearing.

my appologies if you already know about vsync but if you dont, vsync doesnt
actualy “slow down” your game at all. it limits your FPS to 60, but is no
indication of the speed of your code, you could do twice as much logic lets
say and still be at the 60 fps.

Ok, let me explain the structure of my game engine, maybe I can’t find the
right words for my problem:

There is only one thread that does everything. The main program loop checks
for input and object-generated events, calls each object’s draw() method (the objects
that want to be drawn are in a linked list), calls SDL_Flip() and calls each object’s
update() method that does the game logic. Everything in one while() loop!

Now the docs say that SDL_Flip() waits for vertical retrace, thus delaying the execution
of everything within the while() loop?

Maybe the problem exists because of the structure of my game loop, but that’s why
I try to find a solution. :slight_smile:

PS Dune II rocked so hard, be sure and anounce here when you have a playable
version please!!

There already is a semi-playable version of the game (http://www.morgner.de/linuxdune),
but a whole lot of work has to be done to complete the unfinished engine.

If anyone wants to join the project, please let me know!

-Christian

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

|>PS Dune II rocked so hard, be sure and anounce here when you have a
playable
|>version please!!
| You just asked him to do something that is illegal in most countries.
| Illegal to distribute it, and illegal to receive it. And you did it in
| public. Why?
|
| Bob Pendleton

Which part is illegal? Unless I’m mistaken, the software itself is
legal, having been written from scratch. If all he distributes is his
own code, it should be perfectly fine.

He said his game uses all the graphics, sounds, and fonts from the
original game. Redistributing those is illegal in most countries. That
is what I was talking about.

Distributing his own code is probably legal, I don’t have enough
information to know and I wasn’t talking about that at all. The
contracts that most techies work under in the US grant ownership of
everything they write to their employer even if they do it on their own
time on their own equipment. Of course, that depends on the state you
live in and some times even which federal court district you live in. I,
personally, do not have legal ownership of 95% of the code I wrote on my
own time on my own machines.

In the US and any other country that has a version of the DMCA,
distributing code that accesses the graphics from the original program
may be illegal. It is illegal if graphics are “protected” in any way. If
he had to do anything more than open a .jpg file, if he had to decode
them at all, then the claim can be made that he broke a security system
and has committed an illegal action. Figure on needing $100,000 to
$500,000 to defend against a charge like that.

Of course, if he has permission from the copyright holder then
everything is fine.

I was not at all clear about what I was talking about and I apologize
for that. And, I will admit that I am hyper sensitive to this sort of
thing: This April will mark the 10th anniversary of when I registered my
last name as a domain name “pendleton.com” and the start of 10 years of
legal harassment by the so called Pendleton Woolen Mills (no relation,
they named it after a city in Oregon). You spend 10 years losing money
and sleep dealing with a $250,000,000 a year company that will stoop to
almost any kind of pressure they can legally exert trying to take over
your name and may be you would want to warn people about the dangers of
doing illegal things in public. What I am doing is perfectly legal, and
what they are doing stays just barely inside the lines of the legal. But
it is still killing me. Costing me money and time and sleep. Wait until
you see what it costs to defend a lawsuit where you are clearly in the
wrong. Why do you think people just roll over and pay the RIAA? It is
cheaper to just pay them than to hire a lawyer to take the case.

Damn it, you can be bankrupted just defending your legal actions. Why
take the risk of broadcasting the fact you are doing things that may be
illegal? That is like having unprotected sex and then being surprised
that you have AIDS.

	Bob PendletonOn Mon, 2005-01-31 at 13:56 -0800, Pete Elmore wrote:

|>>Its a real-time strategy game called “Dune II”, and I’m writing a
clone of
|>
|>it
|>
|>>from scratch. I already decoded all the graphics, animation and font
|>
|>formats
|>
|>>from the original game and can convert it to SDL_Surfaces on loading, but

Pete Elmore
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFB/ql9v24lB609Ih8RApGcAJ9pzbr4MIJ1EOSFU33edQ76474KngCfU9qC
m110QFCPyp4Dm63DE2leGEw=
=DAKS
-----END PGP SIGNATURE-----


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,

You just asked him to do something that is illegal in most countries.
Illegal to distribute it, and illegal to receive it. And you did it in
public. Why?

To my knowlegde - and I did some research before I started the project - the
game Dune II doesn’t belong to any company any more. I asked this question in
several mailing lists, and everyone told me the same.

Unless they explicitly placed the material in the public domain
someone owns the copyright. Frank Herbert’s estate is still actively
licensing DUNE related material. They most likely either own or have a
significant interest in the material. For that matter you may get in
trouble for using the Dune name and setting even if the material is in
the public domain.

Asking in mailing lists does not give you the right to use the material
from the game. Most likely the company that produced the game never had
any ownership of the material. I’ve worked on a several commercial games
where the company that did the work had no, 0, zero, ownership. The fact
that the company no longer exists doesn’t mean that no one owns the
copyright.

The next thing is that I do not distribute the game itself, but only my
project without the .pak files. That’s why I needed to decode the format of
all resources. You need to own the original game in order to use my clone,
just copy the dune.pak file into the directory where the executable is.
Without it, you can’t play the game.

Like I said in my last message, the DMCA makes it a crime to break any
kind of protection scheme. Decoding a .pak file may or may not be legal.
I am not a lawyer. Just a buy who has paid to much money to lawyers. I
wouldn’t even think of doing what you are doing.

As far as I know the programmers of some other clones did the same,
so where is the problem?

The fact that one person got away with it, or even a dozen people got
away with it, doesn’t mean you will. Thousands of people get away with
shop lifting and cheating on their taxes. But, some get caught and they
pay for it. Ask a lawyer about what you are doing. Most places have a
legal referral system that allows you to talk to a lawyer for half an
hour or an hour for less than $50. Use it.

-Christian

Like I said; I am not a lawyer. I have just spent too much time dealing
with them for the last 10 years. If you have a legal question, ask a
lawyer.

	Bob PendletonOn Mon, 2005-01-31 at 22:58 +0100, Christian Morgner wrote:

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

if he doesnt sell this game, just gives it away, that changes the
restrictions doesn’t it?> ----- Original Message -----

From: bob@pendleton.com (Bob Pendleton)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Tuesday, February 01, 2005 8:30 AM
Subject: Re: [SDL] Blitting / event handling with multiple threads

On Mon, 2005-01-31 at 22:58 +0100, Christian Morgner wrote:

Hi,

You just asked him to do something that is illegal in most countries.
Illegal to distribute it, and illegal to receive it. And you did it in
public. Why?

To my knowlegde - and I did some research before I started the project -
the

game Dune II doesn’t belong to any company any more. I asked this
question in

several mailing lists, and everyone told me the same.

Unless they explicitly placed the material in the public domain
someone owns the copyright. Frank Herbert’s estate is still actively
licensing DUNE related material. They most likely either own or have a
significant interest in the material. For that matter you may get in
trouble for using the Dune name and setting even if the material is in
the public domain.

Asking in mailing lists does not give you the right to use the material
from the game. Most likely the company that produced the game never had
any ownership of the material. I’ve worked on a several commercial games
where the company that did the work had no, 0, zero, ownership. The fact
that the company no longer exists doesn’t mean that no one owns the
copyright.

The next thing is that I do not distribute the game itself, but only my
project without the .pak files. That’s why I needed to decode the format
of

all resources. You need to own the original game in order to use my
clone,

just copy the dune.pak file into the directory where the executable is.
Without it, you can’t play the game.

Like I said in my last message, the DMCA makes it a crime to break any
kind of protection scheme. Decoding a .pak file may or may not be legal.
I am not a lawyer. Just a buy who has paid to much money to lawyers. I
wouldn’t even think of doing what you are doing.

As far as I know the programmers of some other clones did the same,
so where is the problem?

The fact that one person got away with it, or even a dozen people got
away with it, doesn’t mean you will. Thousands of people get away with
shop lifting and cheating on their taxes. But, some get caught and they
pay for it. Ask a lawyer about what you are doing. Most places have a
legal referral system that allows you to talk to a lawyer for half an
hour or an hour for less than $50. Use it.

-Christian

Like I said; I am not a lawyer. I have just spent too much time dealing
with them for the last 10 years. If you have a legal question, ask a
lawyer.

Bob Pendleton


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

So by your logic, undocumented file formats count as protection
schemes? Does that mean OpenOffice breaks the DMCA whenever it opens
Word documents?

C’mon now, the guy only wants to code a free clone of an old game,
which requires the original game files to work anyway. That’s a far
cry from any illegal activity. ;)On Tue, 01 Feb 2005 10:30:36 -0600, Bob Pendleton wrote:

On Mon, 2005-01-31 at 22:58 +0100, Christian Morgner wrote:

The next thing is that I do not distribute the game itself, but only my
project without the .pak files. That’s why I needed to decode the format of
all resources. You need to own the original game in order to use my clone,
just copy the dune.pak file into the directory where the executable is.
Without it, you can’t play the game.

Like I said in my last message, the DMCA makes it a crime to break any
kind of protection scheme. Decoding a .pak file may or may not be legal.
I am not a lawyer. Just a buy who has paid to much money to lawyers. I
wouldn’t even think of doing what you are doing.

if he doesnt sell this game, just gives it away, that changes the
restrictions doesn’t it?

IANAL: to the best of my knowledge it has no effect on the restrictions
at all. Ask a lawyer.

Believe me, I can tell you from personal experience (and not just the
experience with Pendleton.com) that paying a lawyer a few thousand for a
contract review or a legal review of a business plan can save you many
times more than that in the long run.

If you aren’t paranoid you don’t know enough about the law.

	Bob PendletonOn Tue, 2005-02-01 at 08:41 -0800, Alan Wolfe wrote:

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

If you steal things, you’re a criminal.

If you sell the things you steal, you’re still a criminal.

Of course, the latter is worse, but if you don’t have permission to
use the material at all, it doesn’t matter what you do with it; you
can still get sued.

If you get sued, you’re in serious trouble regardless of what for -
even if you’ve done nothing wrong - especially in certain countries
where $$,$$$ tends to decide who’s right.

If in any doubt whatsoever, talk to a lawyer! If you don’t, you may
regret it for the rest of your life.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Tuesday 01 February 2005 17.41, Alan Wolfe wrote:

if he doesnt sell this game, just gives it away, that changes the
restrictions doesn’t it?

So by your logic, undocumented file formats count as protection
schemes? Does that mean OpenOffice breaks the DMCA whenever it opens
Word documents?

yes, MS was (is still?) going after OpenOffice because of this feature.

hope this isnt getting too off topic (if it is someone speak up and i’ll be
quiet hehe) but there’s a shirt you see around the cons that says in pig
latin “if you can read this you are in violation of the DMCA” w/ a copyright
symbol next to it. The joke is that w/ the DMCA you can use the WEAKEST
encryption imaginable (such as pig latin, or even something as dumb as using
l33ts34k) and that if you decipher it, you are in violation for breaking a
propriatary encryption scheme.

if you want more info about DMCA (also recomend checking out info on TCPA
and Paladium if you want to see some real crazy stuff), go to eff.org and
scope it out. if you ever find yourself in legal trouble over such things,
the EFF is kind of like an electronic world’s version of the ACLU and you
might qualify for free legal representation (but that doesn’t mean be super
reckless and count on them bailing you out, they have limited resources and
have to pick their fights etc)

ok, I think that’s far enough off topic gonna zip my lips now :P> ----- Original Message -----

From: simon.roby@gmail.com (Simon Roby)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Tuesday, February 01, 2005 8:49 AM
Subject: Re: [SDL] Blitting / event handling with multiple threads

On Tue, 01 Feb 2005 10:30:36 -0600, Bob Pendleton wrote:

On Mon, 2005-01-31 at 22:58 +0100, Christian Morgner wrote:

The next thing is that I do not distribute the game itself, but only
my

project without the .pak files. That’s why I needed to decode the
format of

all resources. You need to own the original game in order to use my
clone,

just copy the dune.pak file into the directory where the executable
is.

Without it, you can’t play the game.

Like I said in my last message, the DMCA makes it a crime to break any
kind of protection scheme. Decoding a .pak file may or may not be legal.
I am not a lawyer. Just a buy who has paid to much money to lawyers. I
wouldn’t even think of doing what you are doing.

So by your logic, undocumented file formats count as protection
schemes? Does that mean OpenOffice breaks the DMCA whenever it opens
Word documents?

C’mon now, the guy only wants to code a free clone of an old game,
which requires the original game files to work anyway. That’s a far
cry from any illegal activity. :wink:


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

[…]

So by your logic, undocumented file formats count as protection
schemes? Does that mean OpenOffice breaks the DMCA whenever it opens
Word documents?

C’mon now, the guy only wants to code a free clone of an old game,
which requires the original game files to work anyway.

You should read some EULAs and keep in mind that some of that
jibberish may actually be solid enough to cost you helluva’ lot of
money in court if some CEO is in a bad mood at the wrong time…

Do you want to take your chances, or would you rather make sure you’re
safe first?

Feel like gambling? Why not russian roulette, while you’re at it?

That’s a far cry from any illegal activity. :wink:

Anything that even remotey resembles “illegal activity” is more than
enough to get you into serious trouble. In the real world, it’s not
really about who’s right.

Anyway, IANAL either - so I’d rather talk to one and/or get written
permission from all copyright holders before doing something like
this, unless the game is rereleased under a license that explicitly
allows this kind of stuff. It would probably be a good idea to talk
to a lawyer either way, just in case.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Tuesday 01 February 2005 17.49, Simon Roby wrote:

The next thing is that I do not distribute the game itself, but only my
project without the .pak files. That’s why I needed to decode the format of
all resources. You need to own the original game in order to use my clone,
just copy the dune.pak file into the directory where the executable is.
Without it, you can’t play the game.

Like I said in my last message, the DMCA makes it a crime to break any
kind of protection scheme. Decoding a .pak file may or may not be legal.
I am not a lawyer. Just a buy who has paid to much money to lawyers. I
wouldn’t even think of doing what you are doing.

So by your logic, undocumented file formats count as protection
schemes? Does that mean OpenOffice breaks the DMCA whenever it opens
Word documents?

Please read what I said. I said it “may or may not be legal”. I said
that because I don’t know. Do you know that opening a .doc file with OOo
is legal? Are you a lawyer? Do you think that maybe it would be a good
idea to ask a real lawyer before he does something that is potentially
illegal?

BTW, a major difference between the two is that MS would get serious bad
publicity for shutting down OOo while the copyright for DUNE II would
not suffer any negative results from going after the poor guy who is
writing the DUNE clone.

C’mon now, the guy only wants to code a free clone of an old game,
which requires the original game files to work anyway. That’s a far
cry from any illegal activity. :wink:

I will happily admit that he is not doing what I thought he was doing.
Distributing the .pak files would be (to the best of my knowledge)
illegal. What he is actually doing may or may not be legal. I am not a
lawyer.

BTW, I went to www.uspto.gov and looked up DUNE in the trademark
database. The Herbert estate has a trademark on DUNE for use with video
games. So, at the very least, he is violating their trademark.

You all seem to think that simple analogical thinking works here. It
doesn’t. Talk to a lawyer, or at least read a book before you decide I
am completely full of shit. OK? You don’t want to be on the wrong end of
a suit. It is much better to pay a few bucks up front than to spend
thousands after you are facing a court order.

	Bob PendletonOn Tue, 2005-02-01 at 11:49 -0500, Simon Roby wrote:

On Tue, 01 Feb 2005 10:30:36 -0600, Bob Pendleton <@Bob_Pendleton> wrote:

On Mon, 2005-01-31 at 22:58 +0100, Christian Morgner wrote:


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl