Component VS Plugin?

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


old_man_auz
Greenskin
Posts: 103
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia
x 3

Component VS Plugin?

Post by old_man_auz »

I have been tinkering with some code to generate 3d shapes for quick iteration game design and debug drawing. In some searching I came across the procedural addon for OGRE V1 so I guess it will be in a similar veil to that. I was going to turn it into an addon for OgreNext but I wasn't sure weather it should be a component or plugin?

So, what is the difference between a plugin and component?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5534
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1394

Re: Component VS Plugin?

Post by dark_sylinc »

Components are not optional and provide specific functionality. If your project depends on a Component, it must link to it and include all the source code.

Plugins on the other hand can be optionally installed; and your project can either chose to handle the case when the plugin is not present, or or refuse to launch / crash etc.

Another difference is that plugins provide "generic" functionality; thus in theory you can have two plugins offering the same generic interface but they are different implementations. Like RenderSystems providing D3D11, OpenGL, Metal & Vulkan. They are all 4 different plugins that can be used interchangeably.

Though in practice, save for cases like RenderSystems, this is rarely the case because due to Hyrum's law a plugin is likely not going to be exchangeable with another plugin. PSX and N64 Emulators in the 2000's also used Plugin systems to offer different GPU/Sound/Input implementations, but after a decade they realized emulators and plugins would often end up very tied together and thus the plugin model was abandoned (note that Ogre came out in 1999, it's not a coincidence it went the Plugin model too).

Therefore often the distinction between Plugins and Components is almost non-existent except for how they're linked together (Components are just libraries linked by C++, plugins must be registered and dynamically loaded at runtime; unless using static builds in which case plugins must only be registered).

User avatar
Zonder
Ogre Magi
Posts: 1174
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 76

Re: Component VS Plugin?

Post by Zonder »

Even the render systems don't really need to be plugins definitely conditionally compiled in though.

Reason being your targeting a platform and that platform you will only want to support certain renderers and wouldn't want a user to swap out the render system in your deployment.

There are 10 types of people in the world: Those who understand binary, and those who don't...