Jump to content


Engine Design


  • You cannot reply to this topic
4 replies to this topic

#1 laslego

    New Member

  • Members
  • Pip
  • 6 posts

Posted 21 March 2005 - 04:34 PM

Hi all,

I've recently been working on an engine for a game I'm working on. I have chosen to make the layout the engine, in such a way that the engine is in an exe and the gamecode is in a DLL. The way it is now, is that the engine calls an entrypoint in the DLL. Problem is that if the entrypoint has a loop in it(Infinite or not), the engine will hang, waiting for the DLL's entrypoint to return. How can I avoid this ? I thought of creating a thread to run the DLL in, but I'm not sure if it going to work. Thanks in advance.

Btw. I'm using Delphi/Pascal
<a href='http://bnw.sf.net' target='_blank'><img src='http://bnw.sourceforge.net/gallery/images/1111426894.jpg' border='0' alt='user posted image' /></a>
- Brave New World is seeking developers

#2 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 21 March 2005 - 06:11 PM

what's the problem ? just don't run infinite loops in the dll. if you run an infinite loop anywhere in your engine it will hang
If Prolog is the answer, what is the question ?

#3 laslego

    New Member

  • Members
  • Pip
  • 6 posts

Posted 21 March 2005 - 06:20 PM

In the rest of the engine I can do Application.ProcessMessages. I can't do this in the DLL since the Application object is not the same as in the exe!

I need to run an infinite loop in the DLL, since the DLL is going to be the game code, which calls the engine, and not the other way round!

#4 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 21 March 2005 - 06:40 PM

well... the game still doesn't need to run the loop. by design the engine should run the loop when you place the game in the dll. just provide some form of update mechanism in the dll. you might even generalize this in a way that allows you to handle all the updateable things in your engine. just provide one common base class with a virtual update method and register them upon dll oading with the engine. then the engine can conveniently call all the update methods (input and whatnot) each frame.

a problem that migth arise is calling the update methods in the correct order. either you just reigster them in the correct order or you introduce some priority or dependency system.
If Prolog is the answer, what is the question ?

#5 laslego

    New Member

  • Members
  • Pip
  • 6 posts

Posted 21 March 2005 - 10:31 PM

Yeah, I see your point. Thanks for the help.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users