Jump to content
  • Advertisement
Sign in to follow this  
Jannes

Using DLLs in Games

This topic is 4832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, i am thinking of putting my 2D game-engine into a dll file. Would like to know some basics first: 1.) Does using a dll give me the posibility to use it in editors (map-editor etc.) and the game itself? So I dont have to update each prog when i change the engine but only the one dll. 2.) Is it possible to "patch" the dlls in some way on the user-pc, so he doesnt need to install the whole game again if new versions are released? 3.) Would you suggest putting gfx-engine, sound-engine, KI etc in seperate dlls? Pro: each file can be patched seperate?, Con: Performance loss ? 4.) I am using Visual C++ .NET. Is using COM-dlls the way to go? Thank you for any info

Share this post


Link to post
Share on other sites
Advertisement
It's all possible, but I would say COM is not for the faint hearted. For example Ogre3d is an engine that is a set of dlls... the same of which could be used in editor or game. So really it is all down to decent abstraction and design. Though if you look through recent threads, there are lots of gotchas when it comes to dll development.

Putting your engine in a dll is a cool idea though, because you could set up unit tests that link with it, but in another project have an actual game link to it.

Share this post


Link to post
Share on other sites
1) If you design it in the right way, yes. It's a sensible way to do things.

2) Yes indeed. As long as the 'contract' defining the DLL interface doesn't change, a new one should slot right in.

3) Put as much as you like in separate DLL's. There is no performance loss because DLL's are loaded into the memory space of the application, so the code will run just as fast as if it were all in one .exe.

4) COM is one way to go although not necessarily the best way to go. You can just create regular DLLs with exported classes/functions. COM will offer its own advantages and disadvantages which you have to weight up for yourself.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jannes
1.) Does using a dll give me the posibility to use it in editors (map-editor etc.) and the game itself? So I dont have to update each prog when i change the engine but only the one dll.
Yes. You could use the code in both editors and the game itself by simply adding the files to the project, but you'd have to rebuild both apps if the code changed. The DLL approach saves you having to rebuild everything.

Quote:

2.) Is it possible to "patch" the dlls in some way on the user-pc, so he doesnt need to install the whole game again if new versions are released?
If the public interface of the DLL doesn't change, then you can supply a new version with completely different internal code if you want.

Quote:

3.) Would you suggest putting gfx-engine, sound-engine, KI etc in seperate dlls?
Pro: each file can be patched seperate?, Con: Performance loss ?
Assuming that you link to them directly instead of using LoadLibrary/GetProcAddress, the performance cost should be minimal (slightly more time to load up your app, maybe). It's probably more an organisational issue than anything else.

Quote:
4.) I am using Visual C++ .NET. Is using COM-dlls the way to go?
Only if you want to use COM, which isn't really necessary unless you're trying to be compatible with COM-enabled applications. Plain Win32 DLL should be fine.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!