Re: game programming



   Hi!

On Mon, Aug 24, 1998 at 09:27:47PM +0200, Andreas Jellinghaus wrote:
> Still looking for hints how to implement this in gtk/gnome :
> perfect would be a multi threaded setup, where one thread will do the
> gtk stuff, and the other thread act as game engine.
> 
> passign data can be done with thread safe queue's, an easy task.
> gtk -> game engine is simple : the callbacks put their data into the queue.
> but back ? how can i inform the sleeping gtk thread to call some function ?

I had (have) the same problem when implementing KSynth:

  - the synthesizer should run in background, but
  - communicate with a gui

I solved it entierly different than you suggested. Instead of using two
threads, I use two orinary processes wich communicate over CORBA.

So you specify the interface of your gaming engine in CORBA-idl and
implement it as CORBA-objects. Then you let your GUI communicate with
your gaming engine.

Whether or not this approach is better than yours depends on things like
how complex your interface to the gaming engine is, and several other
things.

But think about it, since you get additional benefits from it, like instant
multiplayer support over network (IIOP) and easy portability to other
environments, such as KDE/Qt. And you have clean seperation between the
GUI-code and the engine, things that are bad to mix up anyways.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Freiburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-



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