I know C but am planning on using a 3d engine. Should I use C# or C++?

Started by
25 comments, last by Tom Sloper 1 year, 8 months ago

Are any substantial games programmed using “plain” C?

Advertisement

Statusphere said:
Are any substantial games programmed using “plain” C?

I guess not anymore.

Regarding engines, Unity requires C#, Unreal C++, for example.
So the answer of your title question depends mostly on your choice of engine.

Otherwise i would recommend C++, simply because it gives better performance. And i assume C++ is still standard after C# might be already forgotten in the distant future.
C# may try to keep some things easier, but personally i don't see benefit.

To implement game logic, it might not matter much. If you would ask about developing your own engine, i would clearly recommend C++.
And you can learn both as well. Extending from C is easy, as long as you do not try to learn all language features at once. There is no need for that. Just learn what you need and adopt the features you see and like.

I feel your advice is key to keeping your sanity learning c++. learn the core language and core concepts first before worrying about every single feature. Also learn to use google. if your particular book sucks at explaining something dont suffer through it. look it up elsewhere or look it up in a different book. just because someones smart that doesn't make them a good teacher. Sometimes someone else just explains it better so always have more than one source to refer too.

Joej do you really think c# will be forgotten in the coming years ? this is an interesting point of view, can you elaborate on that ? and also what do you think we can expcet from gpu(s) ? full path raytracing in 10 years ? what will engine become object positioners ?

Programmer71 said:
Joej do you really think c# will be forgotten in the coming years ? this is an interesting point of view, can you elaborate on that ?

I did not mean it so seriously! No worries! :D

But i think, it's actually a language made by Microsoft.
Which reminds me of Objective C, which was Apples major language for some years, then was replaced by something else and now it's pretty much dead.
Oracles Java is another case. In recent years there were some problems of related IDEs or libs no longer free, which made many people moving away from it.

I don't follow such things and might be wrong. But my impression is: Languages come in and out of fashion, but C++ seems stable and is here to stay.

Programmer71 said:
and also what do you think we can expcet from gpu(s) ? full path raytracing in 10 years ? what will engine become object positioners ?

I think we can have realtime GI on PS4 class hardware, coming very close to PT. I work on that for >10 years. It works, but i just can't finish the tools so it could be used in production and i could offer it to the game industry.
That's the reason why i'm strictly against increasing GPU power further and further, while increasing it's costs too. Selling data center class HW to gamers, and making games requiring such specs to run modern titles wont benefit either side on the long run.

What makes most sense to me is APUs like consoles have also for PC. I see no more future or need for dGPUs. But that's just me, and most people still look down on iGPUs. They are also just too small yet, and i can only hope AMD / Intel to make them larger for games. 5tf would be a reasonable baseline, similar Series S. AMDs Rembrandt is close - 3.5tf, but nobody sees the opportunity. You can buy this chip only in laptops which also have a dGPU as well.

On the other end, Apple turns the whole PC platform into old school legacy with their M1 chip.
So it does not good look for the PC platform at the moment i think. We need efficient low power hardware. We need game devs and gamers to change their mind. We need journalists to prepare people for necessary changes.
But we have nothing of that. Soon we'll look at benchmarks from upcoming 100tf 900W monster GPUs which nobody can afford. And we'll look at people switching to Switch, Steamdeck, or other platforms which focus on games not gfx demos.
If Apple wants to make another try to enter gaming, now would be the best opportunity. And Qualcomm / Samsung surely work hard on competing M1. So who knows - maybe we'll get a new (hopefully open) platform and new HW.

Currently it's really hard to predict the future, but path tracing is just too inefficient to be widely adopted in games.
They may use some caching technique, and still call it ‘PT’ because the term means ‘correctness and highest quality’, like Metro Exodus did. But if you use caching (they use probe grid similar to RTX GI), you'r algorithm is no longer path tracing, but much cleverer than that.

We will see. Currently, photorealism is not the goal anymore. The goal is to survive :D

Languages have always come and gone, and have always fallen in and out of fashion. Cobol spent several decades as king of the business world, and while there is still lots of it around it isn't king of the hill any more. I remember when C was king and C++ was an upstart. I remember when in business worlds Java was an outcast that would amount to anything, then transitioned to be the only thing server development was done with. Back in school I heard the same stories about other languages. For a few years C# was the most amazing thing for tools and simple applications on Windows, and in many regards it remains great for that. I've seen and heard the same thing about many languages as they've come and gone, and other rising languages like Rust or Go. Languages come and go.

The same is true of hardware, which is constantly changing. Each chipset introduces new things, changes things, shakes things up a bit. Sometimes dramatically so. While the x86 family seems an oddity at first glance, programming for it in the 80's was a matter of memorizing timings, programming in the early 90s was about the cache, programming in the late 90's was about the OOO core, then SIMD parallelization, then back to the same parallel asymmetric processing from 1970s mainframes. Architecture changes with each new processor, and optimal techniques one year become bottlenecks the next.

This is the reason for the emphasis on theory and data structures, since they never change. It is also the reason to study architectures since they change the dynamics dramatically. The languages are a tool for encoding and interacting with both.

Thanks for the replies and advice.

I graduated from UIUC with a B.S. in computer engineering in 2006.

At school we had ECE290 I think it was, course title: Computer Engineering II in which the final project was to program a game or some other kind of application in x86 assembly language. We had made a maze finding algorithm and a few other projects during that semester, leading up to the final project.

A semester or two before this I took a special offering class called ECE199. The majority of students took a different class in which they learned Java. In ECE199 were taught C, precisely because it was a low-level language that worked closely with the computer architecture - which we were taught about as well.

Back to the future (lol), in ECE290, groups of four students were formed to tackle the final project of making a game or something similar. Three of us were very fluid in our ideas about what to make, but the 4th member was adamant about making a calculus calculator… oh boy, I thought. Well, the issue worked itself out as our calculus-loving friend went to the teacher and told him that we were assholes who wouldn't listen to his ideas and demanded to be placed on a different team. “Good”, we collectively thought and immediately started thinking about ideas for games.

I was born in 1983 and was introduced to gaming, the NES, and Mario brothers by my super cool older cousin around the age of 5, I'm guessing. Ever since I've had a passion for video games. By the time I took ECE290, I had been introduced to Halo by some very close friends. That is the start of a very long story about my passion for Halo and the desire to be the best player out of my circle of friends.

Back to the future part II. My two group members were great guys who were very open. I thought and started talking about making a 2-Dimensional, single player ‘space shooting’ game. Well, that is what we did. One of my groupmates decided to focus entirely on sound, which we were told was not an easy thing to do in assembly language. My other groupmate basically started to motivate me, convincing me that I had it in me to design and develop whatever I wanted to do.

Ok I had no intention of telling this whole, detailed story, but I'm into it now and won't stop until I have finished telling it. I am going to take a break to breathe and relax for a little bit. BTW, this post was made using my Xbox Series X, my Microsoft Elite 2 controller, and an on-screen keyboard. Thanks for reading!

To be continued…

Back in 2005, nearly 20 years ago, the landscape was different.

For game consoles C was still the big language. Some C++ features were used, but optimizers were still not very good on the systems. PC games had adopted the language, but still avoided many features, so it was on the way. The then-new Nintendo DS was a great example, developers were all in the C language with a few touches of assembly.

Newer cross platform games were being built with what was called “C with classes”. Mostly it was the structure of object hierarchies but avoided nearly all other C++ features. This was often driven by compiler issues, combinatorial explosion with templates, poor object lifetime management in various libraries, and a lack of familiarity among developers.

Those days are mostly behind us. You can find older code and programmers who have not moved on, but these days game studios pick up advanced features of the language because support is far better and so is understanding. Even so, good development still peeks under the hood and reviews the generated code and disassembled results when needed. The game still must be tuned and optimized with the accompanying digging and performance investigations, which can result in defect reports to compiler creators.

frob said:
but these days game studios pick up advanced features of the language

Well, the actual reason i have ignored C++11 for much too long was: I was working on a mobile game for Symbian smart phones, which used some older GCC for the time, not yet capable of it.
So i concluded it might be good to wait some years in general, to be sure all platforms support new standards with good performance.

How is this today? Can we assume C++17 or even 20 is supported on major consoles?
Can we also assume Clang is the major compiler everywhere?

Clang is supported in most places nowadays, its still not always the major compiler. Last time I looked this was a while back PS4 SDK was still not completely onboard with C++17, MS is supporting VS16.5 or something like that so most C++17 features are there.

For C++20 features btw MS has the most complete compiler at the moment not Clang.

It will be years before we see 20 on consoles and thats not really to do with the constole makers but mostly with the standards themselves they are still not fully sure how modules should work at the implemetation level.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

This topic is closed to new replies.

Advertisement