• Advertisement
Sign in to follow this  

Unity Modern Programming Language for Game Engines

This topic is 437 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I just found this forum so I'm pretty new here.

 

First at all, let me introduce myself real quick.

I'm not a beginner. I'm a relatively experienced game programmer.
I've started programming games around 6 years ago, spending 5 years with Unity & C#.

I just hope to get some advice from some Guru's.

 

Just to have it mentioned, I don't plan to compete with engines like Unity, Unreal or CryEngine, I just want to start writing my own engine for fun & learning purpose.

In fact, I already made a few early experiences with DirectX & some basic drawing based on WindowsForms using C#.

 

But, I'm just not sure which language I want to use.

I love C#, but I worked for 5 years with it, so learning something new seems to be a good idea to me.
 

Here are some Languages I took a few looks at:

-> C++ (of course)

    I messed around a little in C++, mostly writing Console Applications, but also trying some stuff in the CryEngine & I'm not going to argue the facts, C++ is for a reason one of the most used languages for game programming, but, coming from C# & just looking at the style of the language, C++ seems to be a little outdated to me. Just all the combinations of operators & keywords like "const" make me feel like "Do I really want to use this language ?", it doesn't seem to be that much of fun for me.

-> F# (a little surprising, I guess :D)

    Same as C++, just a few hours of tutorials, throwing basic stuff in consoles. But, I kinda like F#. It's just a completly different thing & a completly new style of programming (it's pretty difficult to understand though, for someone who has no experience in using functional programming languages) & I like the fact that F# is managed land (Though, I don't mind managing memory by myself, that C++ is native land is no real downside for me)

-> Rust

    Rust is the language I have the least experience with. I just had a little talk about it with a friend (who is also a quite experienced programmer & to mention, also more experienced than I am.) & he seems to be pretty convinced of the language. Rust looks like it is pretty close to C++, but also combines functional programming in it (reminding me a little of F#) which seems pretty cool to me.

-> Java

    I know Java a little more than the other languages listed here, because I used to help a friend who studied Informatics & had to write some simple applications in Java. But Java is no option for me, it's a kind of Half-hearted OOP Language & I just don't like it's style.

 

Based on my few experiences with these languages, is there some advice you would like to give me ?
Or even a completly new language I haven't mentioned ?

Share this post


Link to post
Share on other sites
Advertisement

One option is to use the D language. Fast compile times, modules, package system, array slices, readable templates, compile-time functions, unit testing, variables initialized by default etc. make it a good, modern language. At least one commercial game, Quantum Break, uses it.

Share this post


Link to post
Share on other sites

C++ fun is the same type of fun found in Dwarf Fortress :wink:.

 

For Engine coding i would recommend you go with C++. The jump from C# to C++ should not be to hard. Never used to other languages. Select what your focus is, it is learning a new fun language pick one of them. Is it engine coding go with C++.

Share this post


Link to post
Share on other sites

You missed Ada, Fortran 2017, OOCobol, and LISP.  All of them have better syntax than C++ and are powerful enough to write OSes in, so something like a game engine should be no problem for them to handle.

Share this post


Link to post
Share on other sites

C++ may be old but the rules are generally there for a reason. Stuff like const is in the language because it controls access to things, gives the compiler hints on things it can resolve at compile time, or gives hints to programmers as to whether values can change. There's quite a big difference between C++ and any of the GC'd languages like Java or C# if that's all you are used to.

 

Is it the language you need to use? Who knows. You can certainly write a game engine in any language, different languages just have different pros and cons. C++ lets you get very bare metal and people are very experienced in it, that's why it is king for the side of game development that needs to be super speedy.

Share this post


Link to post
Share on other sites

You missed Ada, Fortran 2017, OOCobol, and LISP.  All of them have better syntax than C++ and are powerful enough to write OSes in, so something like a game engine should be no problem for them to handle.

Fortran 2017? The newest standard I'm aware of is Fortran 2008 (released in 2010...)

Share this post


Link to post
Share on other sites

Thanks for all the answers !

 

 

One option is to use the D language

At least one commercial game, Quantum Break, uses it.

D looks indeed interesting, thanks for that.
Also, that it is being used by a quite fresh game sounds awesome.

 

 

C++ isn't outdated. It's just old

Yep, I gotta agree with you there, outdated might be the wrong word to descripe what I meant.

 

 

you handle things yourself. Despite how things going to be (bad or good), you'll have more fun doing these things

No doubts about that ! That's one of the main reasons for me to even start writing my engine, earning some more background knowledge.

 

 

Have you heard about .Net Native?

I haven't, I was aware of the "common" .Net way to compile into IL Code, however, I didn't know there was an approach to avoid this. It sounds a bit against the whole idea of .Net in the first instance to me.

 

 

The jump from C# to C++ should not be to hard.

I wouldn't bother if it was, as long as I like the language & it makes sense to me in the end. I got enough time, no deadline in the background :)

 

 

You missed Ada, Fortran 2017, OOCobol, and LISP.

All of these seem to be preeetty old, with a lot of history. But I'm definitly going to look them up, thanks !

 

 

C++ may be old but the rules are generally there for a reason.
There's quite a big difference between C++ and any of the GC'd languages like Java or C# if that's all you are used to.

Absolutely, I didn't meant to say there isn't a good reason for them to be, just that I don't like all of these combinations. Using the same keywords / operators but with quite different meanings.
To be honest, when I dived into C++ I was kinda surprised that the difference doesn't seem to be that great.
I thought you would have to manage every bit of memory, instead of "just" the things that you want to be (or even have to be) on the heap.

 

 

Every single good 3D game engine is written in C++. There is no other reasonable choice

I wouldn't say that, Xenko for example is written in C#, and I know a good friend who's also writing his own Game Engine completly in C#.
I guess that especially C++ Guru's tend to say that, but I'm not quite sure if I can agree there.

Share this post


Link to post
Share on other sites

When someone ask me what the best language is i say that i hate them all and i hate to one I'm using at the moment a little more.

LOL, this really made me laugh, but is very true. 

Share this post


Link to post
Share on other sites

Go.  The garbage collector is now fast enough (and gets faster each release) for games and it produces native binaries.  Plus the job market for Go looks to be huge in the near future.

 

It was designed for system programming and it has a large following for creating web server software.

 

IMHO, it's the next great language.  Good times ahead for Go. :)

 

And slightly off-topic, here is a very interesting talk on concurrency and parallelism in Go by one of the creators, Rob Pike.

Slides are here... https://talks.golang.org/2012/waza.slide#1

Edited by fleabay

Share this post


Link to post
Share on other sites
Keep in mind that a big part of the reason that C++ can seem old-hat is that the majority of resources are pre-C++11 -- there's just a lot of material, resources, and code out there that reflects an earlier state of the language. Things are getting much better though, and if you know where to look, you can find current-day and even forward-looking resources. C++14 made significant strides in language ergonomics, and C++17 and surrounding technical specifications are bringing some long-overdue libraries into the standard ecosystem.

I do like Rust a lot as well. I've been meaning to play with it more myself. It's got possibly the most amazing community, especially considering its modest size. The tooling is great, the error messages are awesome, there's really a lot to like. The challenge with Rust, I think, is that it demands quite a lot from people as they approach it -- more understanding and possibly more patience than a lot of other languages.

Share this post


Link to post
Share on other sites

I wouldn't deviate much from C++, it's a great and flexible language, and quite modern if you are using c++11, c++14 and such. As others said, most of the code online is usually made with c++03 including tons of boost, but those times are slowly going away. Finally. :)

 

I guess that especially C++ Guru's tend to say that, but I'm not quite sure if I can agree there.

 

 

Well, it all boils down to performance. You always want to write your core engine in a language that's precompiled, does not enforce the use of a garbage collector and gives you low-level access to data structures and their layouts. Right now there are only two languages that fit these requirements, and also have lots of 3rd party libraries, good compiler support. That's C and C++. From the two, C++ is the better choice.

 

Personally, I'm using more and more rust during my daily work and personal endeavors. It's great so far, clearer syntax than c++, no garbage collector, great compile time analysis passes and good performance. 3rd party libraries are getting there, so it's starting to become a good choice for writing an engine's core and communicate with the rest of the world through a C-like interface.

Share this post


Link to post
Share on other sites

I wouldn't deviate much from C++, it's a great and flexible language, and quite modern if you are using c++11, c++14 and such. As others said, most of the code online is usually made with c++03 including tons of boost, but those times are slowly going away. Finally. :)

 

I guess that especially C++ Guru's tend to say that, but I'm not quite sure if I can agree there.

 

 

Well, it all boils down to performance. You always want to write your core engine in a language that's precompiled, does not enforce the use of a garbage collector and gives you low-level access to data structures and their layouts. Right now there are only two languages that fit these requirements, and also have lots of 3rd party libraries, good compiler support. That's C and C++. From the two, C++ is the better choice.

 

Personally, I'm using more and more rust during my daily work and personal endeavors. It's great so far, clearer syntax than c++, no garbage collector, great compile time analysis passes and good performance. 3rd party libraries are getting there, so it's starting to become a good choice for writing an engine's core and communicate with the rest of the world through a C-like interface.

There are still plenty of reasons to use boost. multi_index containers are awesome.

 

In any case, wrt new languages I'm really liking Rust so far.

Share this post


Link to post
Share on other sites

I love F#, I have been playing with functional languages for a while and keep coming back to the ML based ones as they fit my mindset best. In the web space I can see Elm taking off big. Not sure F# would fit 3D engine that well as you could end up with a lot of object churn due to the immutable nature of data if you get your structure wrong. Immutable collections are an order of magnitude slower than mutable ones, the trade off if thread safety and object reuse that can minimize churn. 

 

If you are doing this to learn then Rust might be a good idea, it aims to compile to fast code and is pushed as a C alternative. So you get to play with a new language and code an engine. 

Share this post


Link to post
Share on other sites

Just all the combinations of operators & keywords like "const" make me feel like "Do I really want to use this language ?

 

const is as important as class, or virtual. It drastically helps to understand if an object will have its state modified or not. Whether when using a "simple" variable in a function or whether when calling to a member function to an object. It has also other important semantics.

 

I did very few C# but I'm almost sure that const also exists for this language...

Share this post


Link to post
Share on other sites
keywords like "const" make me feel like "Do I really want to use this language ?

There is entire section in a C++ FAQ devoted to const correctness: https://isocpp.org/wiki/faq/const-correctness

In five words: it is very useful feature.

 

BTW, if you want to explore Modern C++, it's better to look at entire FAQ, especially on "Overview Topics".

Edited by Happy SDE

Share this post


Link to post
Share on other sites

Go looks really promising and parallelising seems to be pretty easy. I'm a bit afraid of the lack of generics though. Definitly going to have a closer look at that one, thanks alot !

 

 

Keep in mind that a big part of the reason that C++ can seem old-hat is that the majority of resources are pre-C++11

Right, guess the tutorials I did were a few years old. Luckily I received a key for VS 2017 Enterprise yesterday, so I can get my hands on the newest standards of C++ :)

 

 

so it's [Rust] starting to become a good choice for writing an engine's core and communicate with the rest of the world through a C-like interface.

Thanks for sharing your experiences :) Rust is definitly one of my favorites so far.

 

Not sure F# would fit 3D engine that well as you could end up with a lot of object churn due to the immutable nature of data if you get your structure wrong.

Yep, I found the "Nu Game Engine" which is based on F#, so at least it is possible, but I'm not quite sure if it's a good idea either.

 

 

I did very few C# but I'm almost sure that const also exists for this language

 

There is entire section in a C++ FAQ devoted to const correctness: https://isocpp.org/wiki/faq/const-correctness

In five words: it is very useful feature

Yes, I think you got me wrong there. I'm not questioning whether it is useful or not, I know it is, but I don't like how the same keyword has quite different meanings.
Const exists in C#, but you will never see something like this:

int x;
const int * const pX = &x;

or this:

void SomeFunc(const SomeType& params){}

Which, I know, has somehow the same meaning in usage, but not really.
 

Anyways, I didn't meant this to become a discussion about C++ and / or C# keywords :D & I don't want to downplay C++ either. Just wanted to mention that I'm not sure whether I'm going to use C++ or not, because I don't like it's style so far (which might change when growing more confident with the language)

Edited by MrLeadProg

Share this post


Link to post
Share on other sites

Const there has exactly the same meaning in all 3 places. In each case it says that the object in question does not change. Your issue is really with the fact that C++ has references, pointers, and things-being-pointed-at.

 

Anyway, if you don't like C++ - which is fair enough, it's a mess - Rust seems like a fun language to try and write an engine in. If it truly is a cleaner, safer C++, it seems ideal for the task.

Share this post


Link to post
Share on other sites

I don't plan to compete with engines like Unity, Unreal or CryEngine, I just want to start writing my own engine for fun & learning purpose.

 

then you don't have to worry about performance that much and can use whatever you want.   if you do care about performance a lot, then that would dictate the language of choice (most likely c++). 

 

RUST might be interesting.   I saw the introductory videos when it first was being developed.   Sounds like its taking off a bit.

Share this post


Link to post
Share on other sites

I'm using D for a bit of a mini-engine I'm writing, and it's pretty awesome (although interfacing with C libraries and char*'s can be a bit of a pain).  Coming from a studio that wrote its (>10MLOC) engine in old C, it feels refreshing to be able to do code generation  (like registering runtime debug commands) without having to write an entire parser, and being able to write reasonably sophisticated interfaces without resorting to #DEFINE LOG_SOMETHING_PAIRS_BEGIN ((x)##(y))##((parens(#x) LOG_SOMETHING_PAIRS {

 

That was somewhat facetious of course, but C macros can really get crazy pretty quickly.

 

 

C++(11+) is pretty nice as well, though a little less elegant and the template barf can be a turn off.

 

 

Rust's memory safety stuff is amazing, but with what little work I did in it, made me extremely unproductive.  It might just be one of those "you have to get used to it" things, I ended up spending like 90% of my time trying to massage the memory model to get the right references mutable.

 

 

If you want cool features and don't care about performance, I'd also recommend python.  D is basically compile-time python, but not quite as expressive.

Edited by SeraphLance

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By Vu Chi Thien
      Hi fellow game devs,
      First, I would like to apologize for the wall of text.
      As you may notice I have been digging in vehicle simulation for some times now through my clutch question posts. And thanks to the generous help of you guys, especially @CombatWombat I have finished my clutch model (Really CombatWombat you deserve much more than a post upvote, I would buy you a drink if I could ha ha). 
      Now the final piece in my vehicle physic model is the differential. For now I have an open-differential model working quite well by just outputting torque 50-50 to left and right wheel. Now I would like to implement a Limited Slip Differential. I have very limited knowledge about LSD, and what I know about LSD is through readings on racer.nl documentation, watching Youtube videos, and playing around with games like Assetto Corsa and Project Cars. So this is what I understand so far:
      - The LSD acts like an open-diff when there is no torque from engine applied to the input shaft of the diff. However, in clutch-type LSD there is still an amount of binding between the left and right wheel due to preload spring.
      - When there is torque to the input shaft (on power and off power in 2 ways LSD), in ramp LSD, the ramp will push the clutch patch together, creating binding force. The amount of binding force depends on the amount of clutch patch and ramp angle, so the diff will not completely locked up and there is still difference in wheel speed between left and right wheel, but when the locking force is enough the diff will lock.
      - There also something I'm not sure is the amount of torque ratio based on road resistance torque (rolling resistance I guess)., but since I cannot extract rolling resistance from the tire model I'm using (Unity wheelCollider), I think I would not use this approach. Instead I'm going to use the speed difference in left and right wheel, similar to torsen diff. Below is my rough model with the clutch type LSD:
      speedDiff = leftWheelSpeed - rightWheelSpeed; //torque to differential input shaft. //first treat the diff as an open diff with equal torque to both wheels inputTorque = gearBoxTorque * 0.5f; //then modify torque to each wheel based on wheel speed difference //the difference in torque depends on speed difference, throttleInput (on/off power) //amount of locking force wanted at different amount of speed difference, //and preload force //torque to left wheel leftWheelTorque = inputTorque - (speedDiff * preLoadForce + lockingForce * throttleInput); //torque to right wheel rightWheelTorque = inputTorque + (speedDiff * preLoadForce + lockingForce * throttleInput); I'm putting throttle input in because from what I've read the amount of locking also depends on the amount of throttle input (harder throttle -> higher  torque input -> stronger locking). The model is nowhere near good, so please jump in and correct me.
      Also I have a few questions:
      - In torsen/geared LSD, is it correct that the diff actually never lock but only split torque based on bias ratio, which also based on speed difference between wheels? And does the bias only happen when the speed difference reaches the ratio (say 2:1 or 3:1) and below that it will act like an open diff, which basically like an open diff with an if statement to switch state?
      - Is it correct that the amount of locking force in clutch LSD depends on amount of input torque? If so, what is the threshold of the input torque to "activate" the diff (start splitting torque)? How can I get the amount of torque bias ratio (in wheelTorque = inputTorque * biasRatio) based on the speed difference or rolling resistance at wheel?
      - Is the speed at the input shaft of the diff always equals to the average speed of 2 wheels ie (left + right) / 2?
      Please help me out with this. I haven't found any topic about this yet on gamedev, and this is my final piece of the puzzle. Thank you guys very very much.
    • By Estra
      Memory Trees is a PC game and Life+Farming simulation game. Harvest Moon and Rune Factory , the game will be quite big. I believe that this will take a long time to finish
      Looking for
      Programmer
      1 experience using Unity/C++
      2 have a portfolio of Programmer
      3 like RPG game ( Rune rune factory / zelda series / FF series )
      4 Have responsibility + Time Management
      and friendly easy working with others Programmer willing to use Skype for communication with team please E-mail me if you're interested
      Split %: Revenue share. We can discuss. Fully Funded servers and contents
      and friendly easy working with others willing to use Skype for communication with team please E-mail me if you're interested
      we can talk more detail in Estherfanworld@gmail.com Don't comment here
      Thank you so much for reading
      More about our game
      Memory Trees : forget me not

      Thank you so much for reading
      Ps.Please make sure that you have unity skill and Have responsibility + Time Management,
      because If not it will waste time not one but both of us
       

    • By RoKabium Games
      We've now started desinging the 3rd level of "Something Ate My Alien".
      This world is a gas planet, and all sorts of mayhem will be getting in our aliens way!
      #screenshotsaturday
    • By Pacoquinha Studios
      Kepuh's Island is Multiplayer 3D Survival Game where you survive on the Kepuh's Islands, confronting challenges that are not only other players but also bosses, and even the environment itself.
      We have a lowpoly faster battle-royale idea, where about 12 players on the map fighting for survival! Also adding some more things into that style such as bosses around the map giving you abilities and much more such as vehicles, weapons, skins, etc...
      Now we are on cartase which is a crowdfunding online which purpose is to raise funds for the development of the game. Come and be part of this development.
      Link for Cartase: https://www.catarse.me/kepuhsisland?ref=project_link
      We post updates and trailers on
      Twitter: https://twitter.com/pcqnhastudios
      Facebook: https://www.facebook.com/pacoquinhastudios/
      Site: http://pacoquinhastudios.com.br
      If you could check out it would be great
      Thnks
      Some images:





  • Advertisement