Sign in to follow this  
Luna Wu

Is it good practice for game development to learn multiple languages?

Recommended Posts

I've been learning C++ for a while now, and I used SFML at first for game development and made a pong and a breakout game, , but due to problems with displaying images that I found no solution for, I switched to Allegro5, and I'm finding it quite hard to use, I only made a pong game in about 10 days (and it was very hard for me), and it's also kinda sloppy , I am now learning python and pygame besides c++ and allegro5, I've finished 4 games in python and pygame in the time I could have finished only 1 game in allegro/C++ that's also sloppy and badly made, I know the FAQ on this site advises using python first and not c++, but, I was wondering if that could teach me bad practices and not make me 'get used to' making somewhat more complex (to me) stuff in C++ that I think I will definitely need in the future. Could anyone please help/advise me ? Thank you so much :)

Edited by Luna Wu

Share this post


Link to post
Share on other sites

Learning how to make a game is going to be largely the same across languages. The specifics of how many of the parts work, or access memory, or what-have-you might be very different, but something like a finite-state-machine or a straightforward game-loop. Learning a language can be an endeavor all on its own, and adding learning a language to that amount of work can definitely affect the outcome of both efforts.

 

That said, people have implemented pong and breakout games using SFML before, and I'm sure with Allegro5, too. I think it's important to understand what about those were difficult for you.

Share this post


Link to post
Share on other sites

The SFML one wasn't difficult at all, the problem I'm having is with allegro (the movement and physics of games is harder for me to implement with allegro5)

Edited by Luna Wu

Share this post


Link to post
Share on other sites
Learning a new language can be fun; occasionally you will find something neat that gives you a new idea of how you can solve a problem in other languages you already know.

As far as good/bad practices go, it's hard to know at first. Eventually you'll start to get some insight about what's good and what's bad after using different things yourself, and participating in discussions about particular ways of doing things. For now I suggest to just keep doing whatever works, and if you start running into headaches, try to find out if you're doing something wrong at that point. Usually it's not too hard to go back and fix mistakes. Most of our programming time is spent trying to decide how to do something in the first place. It's pretty easy to take a solved problem and implement it differently.

Sometimes when something feels hard to use, it's because the way it is meant to be used is different from how you're trying to use it (if you see people say "idiomatic", that basically means "the way we usually do it in this language/library"). I usually try looking for complex samples that demonstrate how things are supposed to be used. This kind of thing bit me hard when moving from WinForms to WPF.

I haven't used SFML. Last time I used allegro was during the DOS era, so I'm not sure what it's up to lately. Edited by Nypyren

Share this post


Link to post
Share on other sites

As other have said, learning other languages give you more tools than just a hammer.

 

That said, I would argue that it is pointless just learning languages that are almost the same, Just C style for example, as you will not learn new techniques. It is definitely worth stepping out of the imperative world and learning something like Lisp, F#/ocaml, Haskell or the like. Haskell is a beautiful mind blowing language with real purity of thought. These will transform your thinking in so many ways.as they are more focused on what and not how. Even C# Linq which borrows from the functional world.

 

I started my journey into functional a couple of years ago and it has effected my day to day C#, my code is cleaner and easier to compose because of it :)

Share this post


Link to post
Share on other sites

 

Is it good practice for game development to learn multiple languages?


It is important for ALL programmers to learn multiple languages. They each have different idioms, strengths, and weaknesses. Even if you never _actually_ use a language, learning about that language and how it solves certain problems makes you an all-around _better programmer_. e.g. I never use Ruby myself, for instance, but having spent some time learning it I've learned some new tricks about DSL design and library design in C++ for improving DSLs, as well as having been able to speak competently and authoritatively to external Ruby developers.

Modern games are often also typically written in a variety of languages. Our project's engine, tools, and backend services are written with a combination of _at least_ C++, C#, Python, Lua, ActionScript, Java, Perl, Ruby, and Erlang, and that doesn't even include our build system which uses a mixture including _at least_ CMake, POSIX shell, PowerShell, Python 3, cmd.exe batch, PHP, and SQL.

This is basically just another version of the adage, "if all you have is a hammer then every problem looks like a nail." Languages are just tools. Learn how to use as many of them as you can, and then select the appropriate tools for the correct jobs. A good rule of thumb is to try to competently learn at least one new language every year (you don't need to master them, just become comfortable reading and maintaining small projects written with them).

So learn Python for making your game. Also make a C++ game. Use Unity and C#. Make a Java game. Put together a website for your games in PHP/SQL/HTML/CSS/JavaScript. Learn as much as you can, and never ever stop.

 

I was going to reply with a long rant about how it is absolutely a great thing to learn multiple languages, but then read Sean's post and felt he stated my rant in fewer words. 

Share this post


Link to post
Share on other sites
When you first start out the important thing is to get your feet under you. If you can do small projects comfortably in SFML then you're on the right track. The danger is in using alternatives as a means of running away from things you don't understand. Ideally you want to reach a point where you feel good about the language you're using and then take up another language just to see what it is and what you can do with it. If you fall into the habit of running away any time you find a difficult problem then you're only going to become incompetent in many different languages. Beat the problems to get stronger and branch out from that position of strength.

Incidentally, there are a lot of people who can't do what you've done so far, so keep going.

Share this post


Link to post
Share on other sites

Beat the problems to get stronger and branch out from that position of strength.
QFE

 

It's normal that you run into seemingly impossible problems. If that happens, figure out how to beat them. Find out what exactly is blocking your path. See if there is another way in (maybe you started at the wrong end). Try to find examples that do what you fail to do. Study them. Understand why they work. Read discussions about the same problem at the Internet. Make a small example demonstrating the problem, and post it.

 

Switching to Python + pygame is good for learning a new language, but every language, including Python, has its own set of impossible problems that you eventually will run into.

Share this post


Link to post
Share on other sites

As Sean says, as a programmer, its good to learn new languages for the reasons mentioned in previous posts.

 

for day to day game development you only really need to know the languages and libraries you're using at the moment.

 

you seem to be off to a good start, and seem to be getting a handle on python and pygames. i'd continue with that until you felt confident enough to start checking into the next level of development, whatever that is for you (C++, unity, etc).

 

in school i learned all kinds of languages (perhaps as many as 10-20 by now). for games, all i really needed was C++ and directx.  and some PHP for a shopping cart software CGI script.

 

as others have said, if you find a library is not working for you, figure out why. either you'r not using it in the intended manner, or it can't do what you want, or the docs suck so bad its practically useless.  only in the latter two cases do you need to switch to a different library.

 

 

when you feel confident, you might want to take another stab a SFML. i don't use either, but SFML seems to be more popular than Allegro.

 

and if you get stuck, that's what gamdev.net is for!

 

there's a fair number of SFML users here i believe.  at least i see it mentioned pretty often in the threads.

Share this post


Link to post
Share on other sites

My recommendation is that programmers learn one new language every year to a passable level. You don't need to master the language, just learn how to use it.

 

A big part of this is keeping your skills current.  If your only knowledge is C++, you are letting yourself get out of date.  It is akin to doctors reading medical journals, lawyers staying current on new laws and major court decision, stylists looking over new fashion trends, or musicians listening to up-and-coming music.

 

Game programmers should learn the core languages currently used through the industry. In no particular order, C++, C#, Java, JavaScript+HTML, SQL, and Python should be on your "must learn" list. But they shouldn't be the only languages you learn.

 

After you know the core languages, do something to stay current. Learn languages like Go, OCaml, Scala, Dart, Haskell, Php, Swift, Rust, or some fancy new tool or technology.  At least one per year.  

 

You never know when it will happen, but eventually your boss will say "We need people who know X".  Those who know X are part of the next team. Those who don't know it are laid off.

Share this post


Link to post
Share on other sites

I know three programming languages well: C#, C++, and C.

I didn't touch C# until I'd been programming for over 5 years. I didn't program in plain C until a couple years after that. Sometimes I write tiny pieces of code in assembly, to squeeze a little bit more performance out of some function, but it's not something I'd say is required learning these days (usually I'm doing something way out of the ordinary to begin with if I'm resorting to assembly for performance)

Of course I've used probably a dozen other programming languages for this or that. C++ isn't even the first programming language I learned, Java was, and I learned Quick BASIC before C++ too. I learned all three by taking electives in high school. I avoid Java like the plague nowadays. I don't think anybody's actually used Quick BASIC for anything serious since long before I learned it in school. C++ is still my preferred language, probably just because I know it the best.

So yes, learn other programming languages. Maybe you'll try C# or Java and be like "why did I ever think it was a good idea to use C++?". But programming skills acquired in one language usually transfer over to other languages pretty easily. So it might be worth it to stick with C++ for awhile, just because you've already been using it, and learn other languages when you're a more experienced programmer.

I'm just a hobbyist though. If you want to get into the industry, frob's advice sounds solid.

Edited by nfries88

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