TAGS :Viewed: 10 - Published at: a few seconds ago

[ Integrating python and c# ]

I've decided to try and create a game before I finish studies. Searching around the net, I decided to create the basic game logic in python (for simplicity and quicker development time), and the actual I/O engine in c# (for better performance. specifically, I'm using Mono with the SFML library). After coming to grips with both languages and IDEs, I've gotten stuck on integrating the two, which leads me to three questions (the most important one is the second):

a. which module should encapsulate the other? should the python game logic call the c# I/O for input and then update it for output, or should it be the other way around?

b. whatever the answer is, how can I do it? I haven't found any specific instructions on porting or integrating scripts or binaries in either language.

c. Will the calls between modules be significantly harmful for performance? If they will, should I just develop everything in in one language?


Answer 1

Have you considered IronPython? It's trivial to integrate and since it's working directly with .net the integration works very well.

Answer 2

Sincerely, I would say C# is today gives you a lot of goods from Python. To quote Jon Skeet:

Do you know what I really like about dynamic languages such as Python, Ruby, and Groovy? They suck away fluff from your code, leaving just the essence of it—the bits that really do something. Tedious formality gives way to features such as generators, lambda expressions, and list comprehensions. The interesting thing is that few of the features that tend to give dynamic lan- guages their lightweight feel have anything to do with being dynamic. Some do, of course—duck typing, and some of the magic used in Active Record, for example— but statically typed languages don't have to be clumsy and heavyweight.

And you can have dynamic typing too. That's a new project, I would use just C# here.