What Language is Skyrim Written In? Primarily C++

As an avid gamer and programmer specializing in game development, I am often asked, "what language is Skyrim written in?" After digging into the latest updates from Bethesda for the 2023 Skyrim Anniversary edition, I can definitively say the primary language is C++. In this deep dive, I‘ll analyze why C++ was chosen, how it achieves high performance 3D graphics, and how Skyrim combines it with the custom Papyrus scripting language to enable incredible modability.

Why C++ is the Backbone of Game Engines

C++ has become the standard language used across almost all AAA game studios and engines, including Epic‘s Unreal Engine, Unity, and Bethesda‘s Creation Engine that powers Skyrim. Why has C++ dominated the gaming industry?

  • Native performance: C++ compiles directly to machine code without intermediaries, enabling the highest possible execution speed. This allows handling demanding tasks like advanced physics simulations or rendering complex 3D scenes at high frame rates.

  • Direct hardware access: With C++, developers can interface directly with graphics APIs like DirectX or Vulkan, as well as leverage GPU parallelism via languages like HLSL. This tight hardware integration isn‘t possible with managed languages.

  • Memory control: Manually managing memory allocation/deallocation allows optimizing how data is arranged and accessed in RAM for maximum throughput. This is crucial for real-time 3D workloads.

  • Portability: C++ code can be compiled to run across Windows, Linux, Mac, iOS, Android, and game consoles with relatively high code reuse across platforms.

For these reasons and more, C++ remains the undisputed backbone of AAA game engine technology in 2023. An analysis across 100 top games showed C++ made up 71% of total code, dwarfing all other languages.

However, using only C++ for the entirety of game logic in a vast open world like Skyrim would be needlessly difficult. This led Bethesda to develop an additional scripting language perfect for implementing quests and gameplay features…

Papyrus – Bethesda‘s Secret Scripting Weapon

While C++ handles the graphics, physics, AI, and other core engine capabilities, Bethesda knew they needed a more agile scripting solution for authoring quests, NPC behaviors, item properties, and gameplay logic in Skyrim. This led to the creation of Papyrus.

Papyrus resembles a simplified mix of BASIC and Pascal syntax. It‘s an object-oriented language allowing abstraction through classes, inheritance, properties, methods and more. Here are some key decisions Bethesda made when designing Papyrus specifically for their Creation Engine:

  • Easy integration with C++ runtime: Papyrus scripts interface cleanly with the low-level C++ backend
  • Rapid iteration: Changes can be tested instantly in-engine without compilation
  • Approachable syntax: Prioritizes ease-of-use over complex syntax to better support modders
  • live editing: Scripts can be reloaded and updated at runtime for faster development
  • Safety: Sandboxed execution prevents crashes or instability when running user scripts

By leveraging Papyrus alongside C++, Bethesda empowered mod authors to build expansive quests, game modes, NPCs and fundamentally extend Skyrim in ways C++ alone could never allow. While C++ does the heavy lifting under the hood, Papyrus delivers creative freedom.

Programming Patterns – C++ vs Papyrus

The table below summarizes some key differences in programming styles used for game logic in C++ vs game scripting languages like Papyrus:

FeatureNative C++Scripting Language
ParadigmPrimarily object-orientedmix of object-oriented and procedural
ExecutionCompiled to native machine codeInterpreted at runtime
SpeedVery fastModerate
SafetyManual memory management more prone to bugs/crashesSandboxed execution protects runtime stability
Iteration TimeSlower compile-run-debug cycleRapid prototyping with instant runtime updates
Code ComplexityComplex syntax, hard constraintsStreamlined syntax emphasizing ease of use

By combining native C++ and scripting, game studios take advantage of unique strengths across both programming models to produce incredible experiences like Skyrim.

Now that we‘ve covered the languages powering Skyrim at a high level, let‘s crunch some numbers…

Lines of Code Comparison – Games vs Operating Systems

The table below compares estimated lines of code (LOC) across game engines, custom engines like Creation, and full operating systems. This gives perspective on the massive software engineering efforts required for modern games:

CodebaseEstimated LOC
Game Engines
Unreal Engine 5Over 1 million
UnityOver 2 million
Custom Game Engines
Rockstar RAGE (GTA V)Over 1 million
Frostbite (Battlefield)Over 1.5 million
Creation Engine (Skyrim)Around 57 million
Operating Systems
Windows 10Around 50 million
Linux kernel25+ million
macOSOver 85 million

With an estimated 57 million lines of code, Skyrim has 5x more code than even advanced commercial engines like Unreal. This underscores why Bethesda chose to build a custom engine tailored specifically for massive open world RPGs.

The Creation engine powers everything from seamless first-person experiences to intricate AI behaviors across hundreds of fully voiced NPCs in sprawling worlds. All endlessly customizable thanks to Papyrus scripting exposed to modders.

My Journey Building Skyrim Mods with Papyrus

As both a programmer and passionate gamer who has spent thousands of hours exploring Skyrim since launch, I‘ve had the pleasure of using Papyrus firsthand to develop mods that bring my ideas to life.

Early on this was simple quality-of-life improvements, like tweaking item durability values so weapons degraded slightly slower. Eventually I became more ambitious, using inheritance to create new spell types with custom effects. My proudest creation was reverse engineering and expanding the vampire disease progression system into an intricate web of symptoms, risk factors and consequences.

With each new mod I felt more empowered to transform Skyrim from a game I merely played into a sandbox truly my own. The simplicity yet depth of Papyrus combined with incredible documentation from modding communities like Dark Elf Guy made this lifelong learning journey possible.

My dream is to one day contribute core gameplay features or narrative elements to Elder Scrolls 6 using my programming skills when the Creation 2 engine eventually empowers a new era of modding on next-gen hardware.

Programming Languages Used at Major Game Studios

To wrap up, the table below provides a comparison across major game studios on primary languages used for development on flagship titles:

StudioGame SeriesLanguages Used
BethesdaElder Scrolls, FalloutC++, Papyrus (custom)
RockstarGrand Theft Auto, Red Dead RedemptionC++, C#, RAGE (custom)
CD Projekt RedThe Witcher, CyberpunkC++, .NET (C# etc)
Naughty DogUncharted, The Last of UsC++, Lua
Santa MonicaGod of WarC++
FromSoftwareDark Souls, Elden RingC++, Lua

While C++ is universally used for low-level engine capabilities at all AAA studios, scripting language choices vary depending on technical and workflow priorities.

Rockstar uses C# in conjunction with its proprietary RAGE engine while CDPR relies heavily on C++ and other .NET languages for cyberpunk 2077. Naughty Dog and FromSoftware chose Lua for its simplicity and flexibility. Each option comes with unique tradeoffs to balance productivity vs. runtime performance.

Under the hood, every vast 3D open world or cinematic narrative experience remains powered by C++ code designed to push graphics hardware to the limits. C++ delivers both industry-leading performance and cross-platform portability that simply isn‘t achievable with other languages. It will continue dominating game development for decades to come thanks to relentless dedication from graphics pioneers.

So in summary – nearly every blockbuster game relies on C++, but scripting languages like Papyrus bring creative visions to life!

Similar Posts