Game Devlopment with Multiple Lanuages [COM]?

Started by
1 comment, last by Xai 14 years, 6 months ago
Hi, clarification is the main point of this thread, not problem here. I recently had a weeks Work Experience, and was talking to someone about COM, and how they use it to branch some C# into there mainly C++ Project. and this got me thinking. From a gameDev PoV, 1/ Is it possible to use COM to run, lets say Java Apps in a C++ or C# Project 2/ Are there Any Advantages/Disadvantages? 3/ Why would you want to? 4/ Is it useful? When I started Learning DirectX9 in C++ the book i was learning from breifly touched on COM development. But i was unaware it could be so useful. So i guess, any of you Devs out there that can answer these q's. and fill me in. Also, does anyone use COM when Developing? why do you?
Advertisement
I am not sure if its possible, but there are definite advantages to mixing languages, but I can't imagine why you'd go C++ to C# but that could be my inexperience. I know there are plenty of cases where languages embed C.

Anyway, I think using a scripting language that is interpreted is MUCH more common for games because it allows for a lot of flexibility. For instance, I recently started using Lua in my game and it is very fun to have a game running, run a script, keep the game running, change the script, run the script, and have it do different things AT RUN TIME!

so to sum it up:
1. I am sure it's possible, but I have no idea, but definitely for other languages (like Python or Lua)
2. I mentioned it earlier: gives you more flexibility
3. The advantages
4. The advantages
I haven't looked into bridging the Java and non-Java worlds so I can't answer your first question, but ...

I have developed multi-language solutions before using COM and found it useful. My most recent specific uses of this we're writing a USB device controller in C++ (using the HID device API from the Windows DDK) and a low level buffered audio mixer (also in C++ using DirectSound and DirectMusic). I wrote the actual workhorse DLLs in pure native C++, then I wrote 2 additional DLLs in C++/CLI (creating a .NET wrapper for these class, and also marking them for COM export), then I wrote the remainder of the application (3 other DLLs and 2 programs) in C# as it was primarily GUI and scheduling logic - and I find C# / .NET is faster and easier for me when building GUIs and business logic than C++ (usually) - and I'm saying that as a person with over 5 years professional C++ including gambling games and embedded systems.

Funny thing though, it is easier to write or expose COM components in .NET than pure C++ (you just add an attribute, no major work or fuss) ... so it can let other people consume certain of your .NET classes / interfaces much easier ... but just be sure you have an actual reason they might want to do so before bothering to support it (marking every .NET class as a COM class just slows things down for no reason).

This topic is closed to new replies.

Advertisement