python与c的集成#

2024-09-29 01:22:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我决定在我完成学业之前尝试创造一个游戏。在网上搜索,我决定用python创建基本的游戏逻辑(为了简单和更快的开发时间),并用c#创建实际的I/O引擎(为了获得更好的性能)。具体地说,我在SFML库中使用Mono)。 在掌握了两种语言和ide之后,我一直在整合这两种语言,这导致我提出了三个问题(最重要的一个是第二个):

a.哪个模块应该封装另一个?python游戏逻辑应该调用c#I/O作为输入,然后更新它以获得输出,还是应该反过来呢?在

不管答案是什么,我怎么做?我没有找到任何关于移植或集成这两种语言的脚本或二进制文件的具体说明。在

c.模块间的调用是否会对性能造成严重损害?如果他们愿意,我是否应该用一种语言开发所有东西?在

谢谢!在


Tags: 模块文件答案引擎脚本语言游戏时间
2条回答

你考虑过铁蟒吗?集成很简单,因为它直接与.net一起工作,所以集成工作得非常好。在

诚恳地说,今天C#is给了你很多来自Python的商品。引用乔恩·斯凯特的话:

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.

你也可以动态打字。这是一个新项目,我在这里只使用C。在

相关问题 更多 >