What Programming Languages Power Genshin Impact?
Genshin Impact combines Unity's C# scripting, C++ engine cores, Go or Java for servers, Python for tooling, and even hand‑written assembly for critical paths, illustrating how a modern AAA game relies on a multi‑language stack to balance performance and development speed.
Engine and Game Logic
Genshin Impact is built on the Unity engine. Unity’s core engine is written in C++, so the rendering engine, physics engine, and audio system are implemented in C++ to obtain direct memory access and high execution efficiency required by a performance‑intensive AAA title. The game‑level logic, character control, and combat systems are written in C# and run on the .NET/Mono runtime. C# provides garbage collection, faster iteration, and safer code, which improves development speed compared with pure C++.
Server‑Side Implementation
The server side is most likely implemented with Go or Java. Both languages are suited for handling the massive concurrent requests of a networked game—login, matchmaking, and instance management. Go’s coroutine (goroutine) model naturally supports high concurrency, while Java offers a mature and stable ecosystem for large‑scale services.
Toolchain Development
Asset import/export pipelines, level editors, and automated testing tools are written in Python. Python’s concise scripting capability allows developers to solve automation problems with only a few dozen lines of code.
Assembly‑Level Optimisation
For the most performance‑critical sections, such as hot paths in the rendering pipeline, developers resort to hand‑written assembly to extract the maximum possible hardware performance.
Multi‑Language Architecture
The project combines multiple languages according to their strengths: C# for game logic, C++ for low‑level performance, Go/Java for server back‑ends, Python for tooling, and assembly for extreme optimisation. This layered language stack illustrates that large‑scale game development relies on a heterogeneous set of technologies rather than a single language.
Code example
来源丨
经授权
转自 良许Linux(ID:liangxulinux)
作者丨
良许
前几天有个粉丝问我:"良许,原神这么火的游戏,到底是用什么语言开发的?"我当时就笑了,这问题看似简单,背后的门道可不少。
你以为游戏开发就是选一门语言,然后一路写到底?
太天真了。
原神这种3A级别的开源世界游戏,用的是Unity引擎。
而Unity的核心开发语言是C#,这是微软家的亲儿子,专门为.NET平台设计的。
米哈游的程序员们,日常写的游戏逻辑、角色控制、战斗系统,基本都是用C
#实现的
。
但这只是冰山一角。
Unity引擎本身是用C++写的,底层的渲染引擎、物理引擎、音频系统,全是C++的天下。
为什么?因为性能。
C++能直接操作内存,执行效率高,这对游戏这种对性能要求极致的应用来说,是刚需。
你可能会问,那为什么不全用C++?
因为开发效率啊。C++写起来太慢了,内存管理、指针操作,一不小心就是段错误。
C
#有垃圾回收机制
,开发速度快,代码也更安全。
米哈游要在有限的时间内做出这么庞大的游戏世界,必须在性能和效率之间找平衡。
还没完。
原神的服务器端,用的是什么?大概率是Go或者Java。
这类网络游戏需要处理海量的并发请求,玩家登录、组队、副本匹配,都要靠服务器。
Go的协程模型天生适合高并发,Java的生态成熟稳定,都是服务器开发的主流选择。
更有意思的是,原神还涉及到大量的工具链开发。美术资源的导入导出、关卡编辑器、自动化测试工具,这些可能用Python写。
为什么?因为Python写脚本快啊,几十行代码就能解决一个自动化问题。
我记得之前看过一个米哈游的技术分享,他们提到为了优化移动端性能,还用了不少汇编语言。
对,就是那个最接近机器码的汇编。在一些性能瓶颈的地方,比如渲染管线的关键路径,用汇编手写能榨干硬件的每一分性能。
这就是现代游戏开发的真相:没有一门语言能包打天下。
C
#负责游戏逻辑
,C++负责底层性能,Go/Java负责服务器,Python负责工具链,汇编负责极致优化。
每门语言都在自己最擅长的领域发挥作用。
作为一个嵌入式程序员,我特别能理解这种多语言协作的必要性。
我们做汽车电子的时候,应用层用C写业务逻辑,底层驱动用汇编优化启动速度,上位机工具用Python做自动化测试。
不同的场景,就得用不同的工具。
所以下次再有人问你"某某软件是用什么语言开发的",你可以告诉他:大型项目从来不是单一语言的独角戏,而是一场多语言的交响乐。
每个乐器都有自己的音色,合在一起才能奏出动听的乐章。
原神能做到今天这个规模,技术栈的选择功不可没。
米哈游的程序员们,既要懂C
#的游戏逻辑
,又要懂C++的性能优化,还要懂服务器架构,这才是真正的全栈工程师。
这碗饭,可不好吃。
1、
Linux一口气删掉近4000行代码!活了40年的苹果协议,最终竟被AI“送走”了……
2、
Codex 会把磁盘给烧了?完整复盘来了!
3、
聊聊 1M 上下文和 GLM 5.2
4、
AI 又立一功?倒逼 Linux 内核清理历史包袱
5、
为什么90年代PC机箱前总有个加速键?Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
