Multiplatform plugin system for C++?


david_dark_heart

Still Fresh
Joined
May 4, 2009
Messages
15
I'm trying to make a multi-platform 3D game engine in C++, but I have a little big problem... The game engine would have a plug-in system so other people could replace the default components if they wish. That way, if somebody makes a better physics engine or a better render engine, he could make a plug-in and continue using the rest of the components of my game engine.

EDIT: I think I've found what I need. Here is the link for everybody who needs something similar.
http://www.ddj.com/cpp/204202899
 
It's not a wise thing to allow external plug-ins to be written in C++, because if someone publishes a plug-in in binary-form only, it will only be available on the platform for which it was compiled. That said, look at how OGRE manages its plug-ins; might be of some help (they manage to do it cross-platform, and link their plug-in libraries dynamically)
 
You're right, somebody could write a plug-in for his custom graphic engine that only works on Windows and doesn't distributed the source code, so nobody could recompile that plug-in for other operating systems or architectures... but I'm not very worried about that because that is one of my "wanted features".

I'll try to explain myself: let's suppose that somebody writes a game using my game engine (when it is finished, of course) and he select the Bullet plug-in for Physics, the OIS plug-in for the Input System, but he creates his own binary plug-in for his AWESOME 3D GRAPHICS ENGINE (TM). Physics and Input plug-ins would be open-source and the game logic would have to be written in a Scripting language (probably LUA or Python), so if you wanted to play that game on Linux the only problem would be that there wouldn't be any plug-in replacement for that AWESOME 3D GRAPHICS ENGINE (TM) that works on Linux...

OK, that won't be a problem if everything works as I expect: you will be able to replace the AWESOME 3D GRAPHICS ENGINE (TM) Windows plug-in for an Irrlicht Linux plug-in. After that, you would only have to change a XML configuration file and the game would work flawlessly. Sure that if you change the graphics engine, the game won't look exactly the same, but at least it would work.


Anyway, I'll have a look to the Ogre3D source code.
 
The engine will be created using C++, so the plug-ins will have to be released in a binary form and will have to be created using C or C++. This means that the plug-in provider should create a different build for each architecture and each operating system or release the source code, so anybody can do the "dirty job". If the plug-in provider doesn't want to release a build for your architecture and operating system, you will be able to use another different plugin... the game won't look exactly the same, but at least you will have "something playable".

At some point in the future, I might add support for plug-ins created in other programming languages (including scripting languages such as Python or LUA), but at the beginning the only supported languages will be C and C++.
 
Back
Top