Hacker News new | ask | show | jobs
by dismalaf 535 days ago
> A significant fraction of games today is actually written in C# (Unity) and most games don't need to push the hardware at all.

??? Unity is a C++ engine, C# is just used for scripting...

2 comments

Since Burst compiler was introduced for HPC# subset, that C# is used for engine internals as well.

Unity is like doing AI with PyTorch, or CuPy, yep there is a low level C++ layer for the GPGPU code, that hardly anyone touches directly.

By the way, CAPCOM goes even further, they have their own .NET Core fork, and games like Devil May Cry for PlayStation 5 were made with it.

>Since Burst compiler was introduced for HPC# subset,

depends a lot on how far DOTS has come. I'm a few years out of date, but DOTS (and by extension, Burst) was more or less a very separate codepath you needed to opt into. Any game using it today needed to make the consious effort to grab the Burst package an integrate those optimizations themselves.

I have heard plans to try and more or less integrate DOTS into the core engine and have gameobjects powered by entries under the hood, but I have no clue how much progress was actually made.

That is already much improved on Unity 6, and Unity 7 roadmap has more unification as plan.

https://unity.com/blog/unity-6-features-announcement

https://gamefromscratch.com/unity-7-development-roadmap/

> just used for scripting...

AKA writing games. Many people writing games with Unity go far beyond what anyone reasonable would call “scripting”, writing code that consume a significant part of the performance budget.

Not sure why you have scripting in quotations or are implying that it's somehow bad. You're not modifying the engine code or writing a renderer from scratch when programming a game in Unity so yeah, it's scripting by every definition.
> or are implying that it's somehow bad.

You're actually the one implying that, you said “it's just for scripting”

> You're not modifying the engine code or writing a renderer from scratch

You're not modifying the kernel or writing a GPU driver from scratch when you're building a game engine, yet you don't consider that to be scripting, why the difference?

> You're actually the one implying that, you said “it's just for scripting”

I'm describing how the engine is actually made... It's mostly written in C++ and C# is the application scripting layer.

If the whole thing was C# top to bottom I'd call it a C# engine.

The engine is in C++, but the game itself is written in C# (and this is the actual part you'd called out earlier in this thread), and no it's not “just scripting on top of the the engine”, no more than writing a game engine in C++ is “scripting on top of the OS” your definition of what is scripting and whatnot is just off.
it's a philisophical line, I suppose. at what point is "scripting" simply programming the gameplay with a tight interface? Unity can definitely blur that line at times.
Is it really philosophical?

Scripting means telling an already built piece of software what to do. In this case, the game engine code doesn't change, the programmer uses the existing functions and interface to tell it what to do. Even Unreal programming is mostly scripting... Yes you're writing C++ but you're only telling the engine what to do, not rewriting it (well, unless you are).

It's why scripting languages are called such... The interpreter is already built and remains unchanged, and runs the code without rebuilding anything.

Python doesn't suddenly become a non-scripting language just because your program reaches a certain size or scope.

It's weird that someone would take offence to calling scripting scripting... Like, it's nice that things are prebuilt and make programming easier... I reach for Ruby first whenever I have a problem I need solved.

Maybe "philosophical" is too strong a word, but I can't think of a better fitting term.

By those same definitions, we can Call any kind of middleware an API "scripting". You're not changing the underlying code so much as sending calls to some other code base to do the heavy lifting. But there's definitely some like between that and what popular game engines are structured by.

At the end of the day, the names are bikeshedding to me, what matters more is the output and experience of the tool more than the label applied to it. But names are communication, and communication is messy by nature.

> Scripting means telling an already built piece of software what to do. In this case, the game engine code doesn't change, the programmer uses the existing functions and interface to tell it what to do.

By this lose definition pretty much all of software engineering is scripting: you're always telling the underlying layer what to do without changing it: be it a web framework or the GPU driver.

I'd argue a lot of current programming definitely is.

How much foundational technology is actually being created? How many new OSes have there been in the last 30 years? Almost everything that's currently being built is built on top of many layers.

And why is this a bad thing?

When I was in university using R to solve economics problems I wasn't thinking to myself, "This is too easy, I'm just using a scripting language, I need to rewrite everything that's in CRAN myself". No, I was happy that so much foundational tech is already there to make our lives easy.

And when someone ships a game in Unreal or Unity they're probably happier to ship than regretting not writing their own engine.

Also, being in Canada, I can't legally call programming "software engineering" lol.