As much as I would love to use C++, dynamic/shared libraries are a pain, especially since the same compiler must be used if you want to use anything from the standard library.
I want to make a game with plugin support. I want the end-user experience to be as easy as picking out the plugins they want and then, depending on the language, downloading the correct versions for their OS.
That means, I am looking for a language which is suitable for making games and which is also suitable for dynamic/shared libraries compiled by different people. I don't really know how to search for programming languages; I was wondering if anyone already knew of a suitable language?
since the same compiler must be used if you ant to use anything from the standard library
Only if you want to use those across the interface. You can mix and match compilers if the interface is pure C and the things that go across it are PODs and basic types.
If performance isn't an issue, I'd go with a .NET core with .NET DLL plugins.
If it is, either a C++ core embedding a Lua interpreter for Lua plugins, or a C++ core that loads C++ plugins exposing a C interface.
A .NET core with Lua plugins is also possible of course, but unnecessary IMO.
I will be dealing with many non-POD types. I have looked into LUA but it is not what I am looking for; in fact it's quite the opposite. Ideally I want the game itself to be written in the same language as the plugins.
I have yet to look into C#/.NET but I have heard of Mono, do you think that is the right direction?
The majority of games are probably programmed in multiple languages, including tools and such
not that i have any experience in this or if using multiple languages/tools is right or wrong, to provide an example, the blizzard client and WoW uses mostly lua/c++, but apparently also uses flash and java
My experience with Minecraft has proved to me that while Java definitely has a better user experience, there are just too many issues with server stability and performance despite many independent attempts at better designs. I will, however, allow rapidcoder to explain away my misguided assumptions, but I have already decided not to use Java.
I suggested .NET because C# has much better linguistic features than Java; Java the language is probably the shittiest in its abstraction level range.
With LINQ, C# now supports many functional programming idioms. For example, lately I've been doing a lot of Windows registry traversals that look pretty much like
1 2 3 4 5 6 7
//Note: Type inference at declaration.
var list = someKey.GetSubKeyNames() //returns an IEnumerable<string>
.Select(someKey.OpenSubKey) //Select is the FP map function
.Where(x => x != null) //Where is FP filter function
.Select(x => x.GetValueNames().Select(y => x.GetValue(y) as string).Where(y => y != null)) //Note: At this point this is an IEnumerable<IEnumerable<string>>
.SelectMany(x => x.ToArray()) //Flatten the list of lists. ToArray() prevents multiple evaluation. More on that below.
.ToList(); //If I leave this out, list is a IEnumerable<string> rather than a List<string>. LINQ IEnumerables are lazy.
If you're dealing with lots of non-memory resources, C# also makes it easier (though not as easy or infallible as C++) with using. Java only has finally, which looks horrendous in a sufficiently busy scope.
Another nice feature of C# is extension methods, which is a syntactic sugar nicety that lets you extend a class without having to derive from it.
1 2 3 4 5 6 7
publicstaticclass StringExtensions
{
publicstatic string MakeSnafucated(this string s){ /*...*/ }
}
//...
var s = "hello".MakeSnafucated();