使用哪种语言来编写游戏库,Go还是Rust?

huangapple go评论80阅读模式
英文:

What language use to write a gaming library, Go or Rust?

问题

你会选择哪种语言,Go还是Rust,来创建一个游戏库(不使用绑定)?

Go是一种更简单的语言,更依赖垃圾回收。Rust是一种更复杂的语言,可以完全不使用垃圾回收,非常适合低级系统编程。

英文:

What language, between Go and Rust, would you use to create a library for games (no bindings)?

Go is a simpler language that leans more heavily on garbage collection. Rust is a more complex language that can be safely used without the GC at all which is perfect for low-level systems programming.

答案1

得分: 14

我有偏见,因为我在Rust上工作了两个夏天,但如果你愿意投入必要的时间来跟上一个快速变化的语言,Rust对于游戏来说会非常好。它有一套非常好的内置并发原语,因此可以很容易地将不同的组件(如渲染引擎、人工智能等)分离开,并利用多核计算机的优势。它还可以避免对垃圾回收的需求,因此您不必担心不可预测的垃圾回收暂停。它被设计成与现有的C代码很好地集成,许多数据类型直接映射到C类型。Rust的多态方法在LLVM完成后会产生一些非常好的汇编代码。

现在许多游戏都在Web浏览器中运行,这表明Web浏览器和游戏具有类似的要求。Mozilla正在设计Rust与其新的并行浏览器引擎一起,这意味着该语言将继续以适合游戏编程的方式发展。

英文:

I'm biased since I spent two summers working on Rust, but if you're willing to invest the necessary time to keep up with a rapidly changing language, Rust would be really good for games. It has a really nice set of built in concurrency primitives, so it would be easy to separate the different components such as the rendering engine, the AI, etc. and take advantage of multicore computers. It's also possible to avoid the need for garbage collection, so you don't have to worry about unpredictable GC pauses. It's designed to integrate nicely with existing C code, and many of the data types map directly onto C types. Rust's approach to polymorphism leads to some really nice assembly once LLVM is done with it.

Many games nowadays are running in the web browser, which suggests that web browsers and games have similar requirements. Mozilla is designing Rust alongside its new parallel browser engine, which means the language will continue to evolve in ways that would work well for game programming too.

答案2

得分: 1

Rust:这是一个处于alpha级别的软件,有许多已知的错误,不完整的功能和计划中的未来更改。使用时请自行承担风险,预计会有一段时间的不稳定性,中断和源代码级别的不兼容性。
不适合商业游戏。

你无法使用Go创建游戏库。Go不支持创建库。你只能使用Go创建你将仅在Go中使用的模块(库)。

你可以在Go中使用C++库。但你无法在C++中使用Go库。

你可能会问哪种语言更适合游戏,Rust还是Go。

2015年更新
Go 1.4已经有了对Android的官方/测试版支持,Go 1.5(2015年夏季)将会有iOS支持。

目前为止,为Android构建是有技巧的。你需要安装Docker镜像。

英文:

Rust: This is alpha-level software with many known bugs, incomplete features and planned future changes. Use at your own risk, expect some instability, disruption and source-level incompatibility for a while yet.
No good for commercial game.

You can't make library with Go for games at all. There is no support to create library in Go. With Go you can create mobule(library) that you will use only with Go.

You can use C++ library in Go. But you can't use Go lib in C++.

You may ask what language is better for games Rust or Go.

UPDATE 2015 year
Go 1.4 has office/beta support for Android and Go 1.5 (2015 Summer) will have iOS support.

Right now it is tricky to build for android. You have to install docker image

huangapple
  • 本文由 发表于 2012年9月27日 21:53:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/12623026.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定