🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

The best lanugage(s) to use

Started by
4 comments, last by GameDev.net 19 years, 11 months ago
I'm writing a very object-oriented game, and I want to support plug-ins. As the engine is at the moment, it is written in Microsoft Visual C++ 6.0 and it has a complete class hierarchy, as well as the ability to load end-user DLL's written through MSVC. I want to allow users to write their own code to create or change the behavior of game objects such that: 1. Class inheritance can be used 2. The paradigm is highly scalable 3. Knowledge of any popular programming language can be used to accomplish those goals 4. Should be multiplatformable; i.e. just because I'm not writing it in Linux or for a console doesn't mean I never will. 5. All is accomplished with negligible speed sacrifice Here are the languages I have weighed thus far: C - Fails requirements 1 and 2, and I'm not going to write a hundred C functions to encapsulate C++ code for every object.......unless I somehow manage to find a way to do that! C++ - This would require people to get Microsoft Visual Studio because the output binary is different than with other compilers. COM - I can query the interfaces before the main game loop, after which I should not have a big speed hit...I'm still skeptical, though it's #1 on my list. I will find a way to hide the overhead for MSVC developers via compiler defines and helpful macros. I have no prior experience with writing game plug-ins; so maybe my way of describing it is gibberish pokemon talk for all I know :). I have not looked at Lua yet, but I will. I figure while I do more investigating in this forum and through google, I can get some helpful comments here. I'll happily share what I learned in the form of an article if everything works out.
Advertisement
How about using C#? You can use C# either compiled or as a scripting language.
Regarding C++, you can download the VC++ compiler from Microsoft for free (Think they call it VC++ Toolkit or something)
There's the express versions too, but can't remember if there's a catch there.

Anyway, that way, you could get the compiler for free, and use any IDE you like

C# could work too, but not sure on the cross-platform part.

Java *might* work. If you find a good compiler that can generate native executables, the speed isn't too bad.
Quote: Original post by DrgnDeveloper
1. Class inheritance can be used
2. The paradigm is highly scalable
3. Knowledge of any popular programming language can be used to accomplish those goals
4. Should be multiplatformable; i.e. just because I'm not writing it in Linux or for a console doesn't mean I never will.
5. All is accomplished with negligible speed sacrifice


Java is probably the closest fit for those, very slightly ahead of C# (which is not so good on the x-platform front; good, but not as good).

You'll have to simply ignore anyone who tells you java is too slow, since they are talking out of their ass. (tell them to visit http://grexengine.com/sections/externalgames and see some of the games that are written in pure java)

But I think you missed off a very important thing when talking about plugins:

6. Speed of development

Again, java is good for that (and much better than C++) - but there are plenty of languages that are "great" in this respect rather than merely "good". When doing java development, lots of people use Beanshell for their plugin language (which is interpreted-java - much quicker to develop in, but quite slow execution). Over time, beanshell should in theory get almost as fast as java (at the moment, it's about 5%-90% of the speed of java, depending upon what you do). But I wouldn't recommend waiting for beanshell to improve...

Instead, I would look more closely at Python and friends. I hate Python as a language, and it too is slow - but not as slow as beanshell, and it would fit terms 1,3,4 and 6 very well.

If speed of plugins is important, I'd go with java. If not, I'd go with Python (there are many other good alternatives, but Python is the most mainstream of these, so has better support + docs + libs)

redmilamber
If you use C++, you don't need to use visual studio. The binary outputs will be different with respect to various optimisations but the semantic value of the calculations will be the same. You can use many different compilers on windows to create dlls.

C doesn't fail requirement 2.

COM isn't a language.

DLL are not multi-platform. They are tied to the Windows Operating systems. However, you can serialize data in a platform inspecific format (xml, s-expressions, text) and read in values from there. This data can include class definitions and the like, though they may need to be compiled on the fly (in Java this would be JIT compilation. In Scheme or Lisp or Python, this would be eval).

I think Java would be an excellent choice for you and your and your requirements.
You could use CORBA or XML-RPC to expose your functionality to other "plugins" or "clients".

This topic is closed to new replies.

Advertisement