Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How to program with multiple languages on one project?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 nicksaiz65   Members   -  Reputation: 200

Like
0Likes
Like

Posted 14 October 2012 - 03:28 PM

I'm a beginner in programming. I am able to program fairly well in Blitz Plus, and I just started teaching myself C#. I've gotten together with a group of friends to attempt to create a Mario/Mega Man esque game. There are two programmers on the project, myself(I will be programming in Blitz Plus) and another friend(who is somewhat of a beginner in Java, and wants to program in that.) I've read that in many projects, programmers use several languages. I'd like to do this in my project, but how would this work? Also, how would our code interact with each other? For example, if I declared a variable in my program, how would the programmer using Java interact with it? How would we combine our work together once we are finished? If anyone could tell us a way to get our code to work together, it would certainly be helpful. Thanks.
I am the man who will become the pirate king!

Sponsor:

#2 Serapth   Crossbones+   -  Reputation: 5592

Like
7Likes
Like

Posted 14 October 2012 - 09:23 PM

I'm a beginner in programming. I am able to program fairly well in Blitz Plus, and I just started teaching myself C#. I've gotten together with a group of friends to attempt to create a Mario/Mega Man esque game. There are two programmers on the project, myself(I will be programming in Blitz Plus) and another friend(who is somewhat of a beginner in Java, and wants to program in that.) I've read that in many projects, programmers use several languages. I'd like to do this in my project, but how would this work? Also, how would our code interact with each other? For example, if I declared a variable in my program, how would the programmer using Java interact with it? How would we combine our work together once we are finished? If anyone could tell us a way to get our code to work together, it would certainly be helpful. Thanks.


To be honest, you are better off spending the time and effort learning a single language. Multiple languages cause so many niggling issues... maintenance problems, overhead from language translations, blackboxes in your debugging process, etc...


That said, I didn't actually answer your question.

Generally each language has a native binding interface of some form, allowing you to call native code, and often allowing yourself to expose your code in a similar manner. For example, in Java it is called JNI while using a .NET language such as VB.NET or C# it's called pInvoke. At the end of the day though, it mostly all comes back to dll's or whatever they are called on the platform in question, which means a C style calling mechanism.

Of course, compile to C libraries isn't your only option ( although it is easily the most common ). This cross language communication is a problem that people have attempted to solve in many ways. COM is one such componet alternative code sharing mechanism ( which ironically can still be compiled down to C style calling conventions ), JavaBeans is another, but it is rarely used outside of the Java world. Windows 8 is also going to feature C++/CX, which is a C++ extension for making cross language calls easier, but adoption is by no means guaranteed.

As to Blitz basic, I have absolutely no idea if it supports native code.

#3 Arthur Souza   Members   -  Reputation: 1419

Like
2Likes
Like

Posted 14 October 2012 - 11:33 PM

Just let me add something. If you guys really want to program one in java and the other in C#, I see as an option, one of you could program content creation tools, such as map editors and stuff, while the other codes the actual game. If you store your data in xml or a sqlite database, it could work. But youll most likely have to share libraries anyway, so this is not a very good idea.

If you guys are beginning, stick to one tool.

A.

Lotus - Action RPG In development http://www.gamedev.n...die-rpg-engine/ |
Personal blog In Portuguese: lotuzgames.wordpress.com |


#4 BCullis   Crossbones+   -  Reputation: 1813

Like
1Likes
Like

Posted 15 October 2012 - 10:10 AM

There are two programmers on the project, myself(I will be programming in Blitz Plus) and another friend(who is somewhat of a beginner in Java, and wants to program in that.)

No.

Let's be honest regarding your experience levels, with the fact that you describe both of you as "beginners". One of you is going to have to change their mind and use the language the other one is programming in. Especially with both of you having little experience as programmers.

Like Arthur mentions, most of the time when "multiple languages" are used on the same project, it's for things like back-end tools, scripting languages, and so on. (Ex: I've written 3 tools for myself so far on my project: a map editor, a packaging tool for resources, and a UI configuration builder). But you won't find a game where one engine programmer is using C# to write the 'Camera' class and another is using Java to write the 'GameObject' class. It's much, MUCH easier to just get all programmers on the same page where the main code is concerned: 9 times out of 10 it's C++ in the AAA world (thanks in part to legacy engines and frameworks), indie projects pick whatever they want.

Granted, you CAN marshal between languages using things Serapth mentioned, but that's well beyond both of you right now. And entirely unnecessary for the scope of your game.
Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too

#5 BrokenKingpin   Members   -  Reputation: 221

Like
1Likes
Like

Posted 15 October 2012 - 10:46 AM

Pick a language that makes the most sense for the game you are designing and learn that. Using two languages for central components is just dumb. I can see using different language for some scripting or web based components, but otherwise it will be way easier if you both use the same language.

To me it sounds like you should spend more time learning the basics of programming before working on something as complex as a game. If you really do understand the fundamentals of programming picking up Java should be fairly easy, at least for the basic stuff to get you going on your project. I would personally recommend moving to something like C# or java anyways, as they are far more popular than Blitz Plus.
Do you folks like coffee?

#6 derda4   Banned   -  Reputation: 147

Like
-1Likes
Like

Posted 15 October 2012 - 11:18 PM

Much simpler would be to use a multiplatform language alike c++.

#7 jbadams   Senior Staff   -  Reputation: 19057

Like
3Likes
Like

Posted 16 October 2012 - 03:31 AM

Much simpler would be to use a multiplatform language alike c++.

No offence intended, but that just isn't relevant advice to the topic at hand. Multi-platform development is not what is being discussed here.
//EDIT: I'm telling you this rather than voting down the post, so that you might be more careful to avoid non-relevant posts in future.

#8 6677   Members   -  Reputation: 1058

Like
0Likes
Like

Posted 16 October 2012 - 12:09 PM

I think when you see multiple languages used it tends to be more in a pattern of the engine being written in one language and featuring a script interpreter for another. One example would be civilization 5. Its written in C++ I think yes also has lua embedded into it for mods etc (infact a large amount of the vanilla game is implemented through the modding API).

Multiple languages for one engine however, not so likely. Can be done, .net for instance doesnt care very much about what language you wrote X class in, set up a VB.net class library, write some classes, make another class library project in Boo. You can use both class libraries from C#. Its the same deal with JVM languages. Theres also IKVM for some java .net compatibility although I've never looked at it. But generally unless your going the scripting route single language is the way forwards.

#9 DevAssassin   Members   -  Reputation: 89

Like
-3Likes
Like

Posted 16 October 2012 - 04:52 PM

I personally would learn a lot more about c++/c first. Then start combining languages. I personally like gluecode between c++ and lua to create games. Data driven design + OOP = Awesomeness. Java is extremely horrible with memory efficiency. I personally would never use java to create games period. Just a personal opinion though. C++ is the way to go when combining two languages.

#10 superman3275   Crossbones+   -  Reputation: 2061

Like
1Likes
Like

Posted 16 October 2012 - 04:55 PM

I personally would learn a lot more about c++/c first. Then start combining languages. I personally like gluecode between c++ and lua to create games. Data driven design + OOP = Awesomeness. Java is extremely horrible with memory efficiency. I personally would never use java to create games period. Just a personal opinion though. C++ is the way to go when combining two languages.

DevAssassin, I'm sorry but what?
Java is not horrible with Memory Efficiency, I have no idea where you heard that from.
Also, the only language you've ever programmed in is C++(Maybe LUA, but I'm assuming nothing else)
Also, how do you know C++ is the way to go?

I'm sorry, but you might have just skewed the OP's opinions by saying many things you probably heard on some random guys blog, because most of what you said isn't true.

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#11 superman3275   Crossbones+   -  Reputation: 2061

Like
1Likes
Like

Posted 16 October 2012 - 04:58 PM

I'm a beginner in programming. I am able to program fairly well in Blitz Plus, and I just started teaching myself C#. I've gotten together with a group of friends to attempt to create a Mario/Mega Man esque game. There are two programmers on the project, myself(I will be programming in Blitz Plus) and another friend(who is somewhat of a beginner in Java, and wants to program in that.) I've read that in many projects, programmers use several languages. I'd like to do this in my project, but how would this work? Also, how would our code interact with each other? For example, if I declared a variable in my program, how would the programmer using Java interact with it? How would we combine our work together once we are finished? If anyone could tell us a way to get our code to work together, it would certainly be helpful. Thanks.

Blitz plus would be good for a toolkit / level editor, and the GUI. However I don't recommend using it for actual game programming. You're friend could program the actual game in Java. You probably shouldn't start out with Mega Man / Mario for your friends sake, because if he hasn't programmed any (many) games you'll end up with a spaghetti codebase / no game.

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS