Sign in to follow this  
LifeIsGood

Unity Modern Programming Language for Game Engines

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

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

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

https://www.youtube.com/watch?v=cN_DpYBzKso

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Announcements

  • Forum Statistics

    • Total Topics
      628357
    • Total Posts
      2982227
  • Similar Content

    • By koto
      Hello,

      I'm developing a roguelike game. Currently it's in a playable state and I think it's a high time to show it and hopefully get some feedback.

      The game has following features:
      - turn based
      - procedurally generated levels
      - tons of loot
      - spells system
      - trading system
      - some quests
      - some limited crafting
      - door/key/lever mechanics
      - quite a lot of different (look/behaviour) monsters

      Trailer:
      Demo: http://kotogames.com/wp-content/uploads/2017/11/OuaD_demo.zip
      Regards,
      Tom
       
    • By Afambus
      Hello,
      I have a full experienced team that looking for a composer and another 3d designer, im expecting as much from you there are other people in this server that can help you we have a determined team, we have done many things in our game there is more information in the discord about everyone and there skills there region and about the game, if you join the discord pm asap
      https://discord.gg/b2teN3m
    • By BAG Labs
      Mobile SoS

      Platform: Android
      Genre: Board
      Link: Google Play
       
      This games sharpen memory and test your strategies to place S-O-S pattern within time limit and serve 3 difficulties as Easy, Normal, and Hard.

      Goals of the game is to put S-O-S words in patterns (Horizontal, Vertical, and Diagonal) alternately with enemy.
       
      Features:
      Single Player Multiplayer Achievements Leaderboards  
       
      Screenshot:

       

       

       
      Link: Google Play
       
      Please help us improve this game with review
    • By abarnes
      Hello!
      I am a game development student in my second year of a three year program and I would like to start building my portfolio. I was thinking of creating some games to show what I can do to potential employers since I wont have any work related experience when I graduate. But as I'm sure you all know there are tons of ways to approach developing/designing a game and I'm curious if anyone had any insight as to any "standards" that come with this? Is it okay to use game engines like Unity, Unreal, Game Maker etc? Or would it be better to make a game from scratch to better show case your skills? Any and all advice will be greatly appreciated!
    • By Hilster
      Hello 2D Artists,
      I've started making a 2D Puzzle Adventure game for mobile and I'm looking for someone who would want in on creating assets for the game. The core of the programming is pretty much complete, you can walk within the grid laid out and push boxes, when there is an object on top of a pressure pad it will activate the linked objects or if there is one object with multiple linked pressure pads it requires you to activate all points for the object to become active. 

      The level iteration for the game is quick and simple, a Photoshop file that is made of individual pixels that represents objects is put into the game and it creates the level out of those pixels with the assigned objects.
      The objects that need sprites created so far is the character, box, pressure pad, door, trap door, the walls, the stairs and the tiled background.
      I intend to add more objects so the amount I'd like to add will be extended.
      My motivations for posting here is to have something that looks nice to be able to display on my portfolio, so if you're looking for a working game that you can place your art into and improve the look of your portfolio then we're in business.
      Please reply with a few past examples of your art below and I'll be in touch!
  • Popular Now