which platform? which language?

Started by
13 comments, last by kop0113 10 years, 5 months ago

Of course, the sticking point in this is it doesn't work on iOS apparently (as reported by a Unity3D user), because you can't dynamically load DLLs or something, so they're still using an older version of the library which used static DLL Imports for the P/invoke. I'm digressing, but the point is interop is hard and tricky, but C# offers a lot of nice solutions where you don't go bat-crazy and want to pull your hair out just to do some simple interop.

When the developer calls a native library from C#, that is all well and good but getting that native binary to call back to the managed runtime is a nightmare (with really messy function pointer passing and datatype marshaling).

The Java JNI is pretty easy to call a native library (just tag a (admittedly long) function name as native). Where it really stands out is that the native library can then include "jni.h" (and link against libjni implicitly by the Android build system) and use a whole host of reflection functionality to call back. This is the reason why Unity cloned the JNI API (for their Android exporter) rather than rewriting it with a different API.

Honestly, on Android, I would just use Java to set up a basic rendering context and then go entirely native and use OpenGL for the rest of the game (with small platform specific calls (i.e to load an image). Better still, use NativeActivity and stick with C or C++ entirely. At least then, that same C or C++ code can be used on every platform (including HTML5 web pages with Emscripten) with minimal modification.

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.
Advertisement

HI

if i were you i shouldn't use C++, C++ is not directly crossplatform and it can take long to create a game and can be a pain in the ass.

sure why not if you want to try.

you also said that you want to create games using HTML or flash.

what i should recommend , you can create a nice responsive web game using HTML5 and PHP(store the data) and that can be played on any platform(MAC, Linux, PC, iOS, Android WP and so on)

that can be easy and fast.

actually it depends on how much time you want to spend on creating a game.

there are many Engines or crossplatform languages.

i hope i've informed you enough.

HyperV

I like C++ now, but I found Java a good language to learn with, it made things like Object Oriented principles a lot clearer than C++. The language is fairly widely used in itself, including for Android, and would also put you in a good position to learn other languages.

Learning Java for Windows/Web has the advantage that you can learn "pure" Java before delving into Android-specific parts (Android uses its own API as well as the JDK) - it might seem a steeper learning curve or more confusing to start with Android, then try to do normal Java, compared to the other way round? It also means you don't have to worry about things like application lifecycles (though then again, maybe it's better practice to learn those things from the start...)

For "standard" application programming, I like Qt which is cross-platform, including for mobile devices. Java can be used too which is cross-platform for PC platforms, though not mobile (Android uses Java, but won't be the same API when it comes to writing applications; I've no idea what J2ME uses).

http://erebusrpg.sourceforge.net/ - Erebus, Open Source RPG for Windows/Linux/Android
http://conquests.sourceforge.net/ - Conquests, Open Source Civ-like Game for Windows/Linux

Of course, the sticking point in this is it doesn't work on iOS apparently (as reported by a Unity3D user), because you can't dynamically load DLLs or something, so they're still using an older version of the library which used static DLL Imports for the P/invoke. I'm digressing, but the point is interop is hard and tricky, but C# offers a lot of nice solutions where you don't go bat-crazy and want to pull your hair out just to do some simple interop.

When the developer calls a native library from C#, that is all well and good but getting that native binary to call back to the managed runtime is a nightmare (with really messy function pointer passing and datatype marshaling).

Eh, I disagree with that statement. Getting unmanaged function pointers from your managed delegates is relatively painless and hardly messy. Marshalling data is another story, but that can get messy whether you're calling into or getting called from native depending on what data is getting passed, so I wouldn't characterize it was a symptom of calling into the managed runtime.

I just found that if I needed to access 30 C# functions from my native C++ code, I would need to pass though 30 function pointers. I thought this was quite a tedious task. I decided to use C++/clr instead but I understand this solution is not always available (i.e when using Mono).
http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.

This topic is closed to new replies.

Advertisement