Official RPG Codex Discord Server

  1. Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.
    Dismiss Notice

Which programming language did you choose and why?

Discussion in 'Codex Workshop' started by Destroid, May 1, 2012.

  1. VaxxedDeadman Arcane Patron

    VaxxedDeadman
    Joined:
    Nov 15, 2010
    Messages:
    4,725
    Location:
    Philippines
    Pathfinder: Kingmaker
    I apologize if I misinterpreted some of the posts here, haven't really been following this exchange too close.
     
    • Brofist Brofist x 3
    ^ Top  
  2. d1nolore Learned

    d1nolore
    Joined:
    May 31, 2017
    Messages:
    382
    So if one was to start learning C what editor/IDE or whatever would be recommended?

    and does anyone know any good online courses?
     
    ^ Top  
  3. Monk Arcane

    Monk
    Joined:
    Feb 8, 2010
    Messages:
    2,992
    Location:
    The Jungle
    I read that for non-computer science students, what was used in the past to introduce them to programming was a language like Pascal, and for non-tertiary students, it was usually some version of Basic. But the purpose is to make programs that immediately work on automating processes, like a simple traffic queuing program.

    For com sci undergrads, the starting language taught was C, and very likely because they had eventually learn to understand, for example, how compilers are made.
     
    ^ Top  
  4. Rincewind Learned

    Rincewind
    Joined:
    Feb 8, 2020
    Messages:
    190
    Location:
    down under
    ^ Top  
  5. Rincewind Learned

    Rincewind
    Joined:
    Feb 8, 2020
    Messages:
    190
    Location:
    down under
    Yeah that was in the very old times, even I started with Pascal first at uni. Nowadays they just start with Java or something like Python at most places. Maybe even JavaScript.
     
    ^ Top  
  6. Absinthe Arcane

    Absinthe
    Joined:
    Jan 6, 2012
    Messages:
    3,397
    I'm not a "real men only use C" kind of guy. There is such a thing as the right tool for a job and I'm not interested in a dick-waving contest with randos on the internet. I just think it makes a better starting point because it teaches you things you otherwise wouldn't bother to learn and understand, and those things can be important even when you move to higher-level languages with their conveniences because you've learned to keep into account the kinds of things that happen under the hood will write better software for it. I also think C is especially a better pick to learn if you want to write videogame engines. As you have reluctantly noted, C++ is in fact a highly popular pick for writing videogame engines.

    And I think that many of your complaints are basically rooted in whining about the absence of high-level abstractions and conveniences, which is really missing the point of using C (learning how to do without them and be more directly responsible for the performance of your code, which can teach you good awareness and good habits even when you move on to other languages and learn how to do things that way).

    I do not recall opining on the merits of other languages, except to say that learning to rely on conveniences and abstractions teaches you bad habits. I agree with you on languages being just tools, and that learning a broad toolkit is a good idea, but that's far off. When a person wants to start programming, you can recommend one or two languages to start off with, but you don't recommend twelve.

    Again, I just think C is a better starting point, especially if you're interested in writing videogame engines, where C and (especially) C++ are very much the preferred tools of choice. Even Unity with its C# fetish (btw C# is more related to Java than C, hurray marketing gimmicks) is itself written in C++.

    What are you, a Born Again Christian? No wonder you sounded like you had some kind of thing against C going on. "At first I used to love C but now I have Seen The Light and C is dark and vile and primitive, better avoided, and one day you too will realize this as I have, Brother." The grass isn't greener on the other side, dude. They're just tools, and they have their advantages and disadvantages. Just because you changed your perspective and preference doesn't mean you've been enlightened.

    Yeah, both of them are worth learning, but they are suited for different purposes.

    Frankly, the world is full of people who manage to be clever and yet idiots at the same time. Turns out competence in one aspect is not competence in others, who knew. Also, what you're doing here is definitely a "programmer's dick measuring contest".

    Peace.

    Yeah, that's the K&R book, and it's highly recommended.

    Yeah. In the interest of being a little more convenient for a Windows user and first-time programmer I'll recommend the Dev-C++ IDE (which also compiles C and uses GCC): https://www.bloodshed.net/

    If you're a Windows user opting for text editor + compiler, you may as well use Notepad++ as your text editor: https://notepad-plus-plus.org/
     
    Last edited: May 12, 2021
    ^ Top  
  7. Krice Arcane Developer

    Krice
    Joined:
    May 29, 2010
    Messages:
    178
    These "fundamentals" (whatever they are) are not limited to low level languages. Most concepts you need to learn are in both low and high level languages, but you don't need to implement (only understand) some stuff in high level languages which saves time and allocates it into the actual game development. Just think about C and strings, then compare it to the ease of std::string.
     
    • Agree Agree x 1
    ^ Top  
  8. Catacombs Magister Patron

    Catacombs
    Joined:
    Aug 10, 2017
    Messages:
    3,952
    Make the Codex Great Again! Insert Title Here RPG Wokedex Strap Yourselves In Pathfinder: Kingmaker
    The actual book is pricey, even on eBay. One is better off reading a PDF, which is free on z-library.

    I'd also recommend Modern C. It goes at a slower pace than K&R, but it's thorough and readable.
     
    ^ Top  
  9. Azdul Augur

    Azdul
    Joined:
    Nov 3, 2011
    Messages:
    384
    In games industry, you start with high level, sane, portable code. If it too slow on target platform, you need to make it faster, using excessive force if necessary - preferably in next 2 weeks, or the whole project is scrapped.

    After rolling your own containers, threads management, scheduler and memory allocators, and squeezing last few bits of the structure to fit into cache line - the source code barely resembles the language that you've started with.

    There are games written in C# that use arena allocators instead of dynamic memory allocation, where garbage collector thread is disabled, and parts of VM are rewritten to be less portable and 5% faster. Or games written in Java - that are restricted to 2% of Java API. Or games where most of the logic is written in highly customized version of LISP, and then compiled. So you don't have to use C++ for professional game development - you just need to be brave (and slightly insane).
     
    • Brofist Brofist x 1
    ^ Top  
  10. ChaDargo Learned

    ChaDargo
    Joined:
    Feb 19, 2018
    Messages:
    227
    Location:
    Texas

    So would you suggest I start learning with C or (my preference) with Racket, particularly How to Design Programs. I've already done a good amount of work studying Racket's first chapters, and a good amount of work finishing Python Crash Course. I like Python because it seems very easy to jump in and start making things, but I feel like I don't learn as much about the fundamentals as I have with Racket and HTDP. I also see the appeal of C for being closer to the hardware level and how influential it has been. I'm not really concerned with the idea that this or that language is better: I want the most efficient and helpful path to learn to start making games that aren't buggy pieces of shit.
     
    ^ Top  
  11. Rincewind Learned

    Rincewind
    Joined:
    Feb 8, 2020
    Messages:
    190
    Location:
    down under
    I suggested to people to learn some high level language and C, remember? :) Those were not complaints, but statement of facts: having to do things less conveniently is one part of the issue, the other is the limited capacity of the human mind. THe mind has X amount of energy to deal with complexity; you can either spend that on getting bogged down on lots of low-level details, or you can work with higher levels of abstraction, that effectively gets "more mileage" out of your fixed amount of mental energy.

    Yes, won't disagree with that, but I don't think this discussion was just about game programming (which is a very narrow niche of general programming), or game engine programming (which is an even narrower niche of game programming). Like I won't disagree that probably the best practical way to go about writing a video codec is C, but again, that's an extremely narrow niche.

    Again, no disagreements there, I still think knowing C and understanding how the machine works at a low-level is important. But read back what you wrote, your initial reaction was a lot less balanced :)

    Yeah, that's a pretty accurate representation of the sequence of events, actually. :cool:

    Well, you'll only know if you go and walk the same path :P
     
    ^ Top  
  12. ChaDargo Learned

    ChaDargo
    Joined:
    Feb 19, 2018
    Messages:
    227
    Location:
    Texas
    So learn C and Racket. The problem I've had with that thought is exactly what you said, my limited amount of mental energy/time lol

    Seems like the best thing to do for me would be to focus on Racket, while learning bits of C. Thanks for the advice, everyone
     
    • Brofist Brofist x 1
    ^ Top  
  13. ChaDargo Learned

    ChaDargo
    Joined:
    Feb 19, 2018
    Messages:
    227
    Location:
    Texas
    Just curious, Rincewind: why do you suggest Racket or LISP over Python? I think I have a good idea as to why, but it would be interesting to hear a more expert opinion.
     
    ^ Top  
  14. Absinthe Arcane

    Absinthe
    Joined:
    Jan 6, 2012
    Messages:
    3,397
    You said you want to learn how to make your own game engine, so that's why I told you to just learn C, and I stand by that. Videogame engines are overwhelmingly written in C. Even the C++ engines tend to be written C-style with C++ features on top.

    Learning Racket can do you good, but that's usually not a good pick for game engines.
     
    • Brofist Brofist x 1
    ^ Top  
  15. Rincewind Learned

    Rincewind
    Joined:
    Feb 8, 2020
    Messages:
    190
    Location:
    down under
    Haven't read HTPD, just had a quick look a while back but it seemed like good and fun introduction to Racket.

    That's a good attitude :salute:

    I suggest LISP/Scheme over anything else because of the sheer mind-reprogramming it will do to you, for the better. Hard to explain really, but if you dutifully work your way through the exercises in SICP, it will change your outlook about programming forever and it will make you a better programmer in any language. When I first read that book, I was doing Java full time, and I was quite surprised how my Java style had changed as if by magic just after working through the exercises in the first few chapters. I know, it sounds weird and a bit esoteric, but maybe I got you interested enough to give the book a go and see it for yourself :) People used the word "enlightened" a bit pejoratively earlier in this thread, but that is what learning LISP/Scheme for the first time is: an enlightening experience about computation.

    Python is okay I guess, it's good for everyday scripting and it has tons of useful libraries (one of the best things about is in fact the ecosystem), but the core language is a far cry from the sheer power of a LISP/Scheme. Having said that, I kinda like Python for what it does.

    Some highlights of things unique to LISPs that are missing from Python:

    - working on a program while it's running (that's right, changing data/functions/whatever on the fly)
    - ability to write expressive DSLs (invent your own mini-programming language that describes the task you're solving much better than a generic language)
    - macros (programs generating programs)
    - no distinction between code and data (!); they're the same thing
    - TIME TRAVEL!

    -----

    One more thing about writing game engines: if you're 100% sure that's what you want to do, that's of course fine and by all means go deep in C/C++. But probably there's hundreds (if not thousands) of non-engine developers to every single engine developer nowadays in gamedev (I don't work in gamedev, so I'm just making numbers up... maybe some working gamedev folks want to chime in on that. But there's a similar trend in practically every area of computing; for example, there are very few people working on actual web servers, but tons of developers writing web apps using those web servers etc. Similarly, how many people work of video/audio codecs in the world today? Very very few, but lots of programmers use those codec libraries, which is easy.)

    If I personally wanted to write a game, I'd just use some existing engine. The thing with engine development is that it is very technical, low-level and math heavy, and you'll spend years just learning about the theory and tech involved. It's a very narrow, and all-consuming area, so if you're that kind of super technical and very much math-focused person, then maybe it is for you. But chances are that you're a person who just wants to create games and you are more interested in design, gameplay and such, in which case you'd be better off using some existing engine. I might be wrong, but engine development seems to be something that doesn't leave room for much else, and the barrier entry is quite high. I don't think it's a good idea for most solo devs, except for geniuses who only need 4 hours of sleep or something :)

    Ah, and all that is assuming we're talking about 3D engines. Non-3D game engines can be definitely much simpler, but pretty much everything uses 3D nowadays anyway, unless it's 100% pre-rendered. So probably you'd be better off using some 3D engine anyway, but in theory you could write your own much simpler 2D engine from scratch.
     
    Last edited: May 13, 2021
    • Brofist Brofist x 2
    • Agree Agree x 1
    ^ Top  
  16. Rincewind Learned

    Rincewind
    Joined:
    Feb 8, 2020
    Messages:
    190
    Location:
    down under
    Last edited: May 13, 2021
    ^ Top  
  17. ChaDargo Learned

    ChaDargo
    Joined:
    Feb 19, 2018
    Messages:
    227
    Location:
    Texas
    Great points across the board that solidified my sticking with Racket (with some side effort in C). Perhaps an engine is too much to chew and not worth the effort; that's something I'll worry more about when I get more expertise in general.

    I definitely noticed what you're saying about Racket. When I started, I was doing Python and although it was easy to figure out how to make some basic things work, it was a bit overwhelming. Did HTDP's first couple chapters, came back to Python, and I could easily create functions even for my own little library for a text-based thing I was trying to make. Racket seems to force you tou figure it out; Python seems to offer tons of tools/tutorials to avoid figuring it out.

    I'll definitely be incorporating C into my studying, if just to be able to grasp the lower-level issues involved in programming. Thanks for the advice and the link to that comic. This thread has helped me a lot. Appreciate you guys!
     
    • Brofist Brofist x 2
    ^ Top  
  18. Rincewind Learned

    Rincewind
    Joined:
    Feb 8, 2020
    Messages:
    190
    Location:
    down under
    Good to hear the magic is working for ya too! :dance:

    Knowing C, Racket and Python will give you a very solid base for sure. Then you'll be able to make an informed decision on what tool is best for the job at hand.

    Glad to hear it helped, bro!
     
    Last edited: May 13, 2021
    • Brofist Brofist x 1
    ^ Top  
  19. Krice Arcane Developer

    Krice
    Joined:
    May 29, 2010
    Messages:
    178
    It doesn't matter that much if you are a beginner. You'll learn programming in any language, just pick one randomly. But maybe stay away from more esoteric languages like purely functional languages. They are better for specific tasks (science stuff etc.) and less practical in game programming.
     
    ^ Top  
  20. Hag Learned

    Hag
    Joined:
    Nov 25, 2020
    Messages:
    174
    Location:
    Breizh
    Very good choice of languages. Racket probably is one of the best to get you started in development and just do things that works, its ecosystem looks great.
    C is good when you want to go deeper and do your own low-level stuff, as well as getting some language culture since it is probably the single most important language of all times (what doesn't make it the best though).
    Python is more on the meh side compared to the others but its has a "it just works" style that is really refreshing.

    Well, some language are better than the others, or simply less suited for studies. Java is ok for what it does but learning CS with it is pain and sadness. C++ is the quickest way of getting the worst habits. Javascript is an abomination on every level. Just to talk about ones I know about.

    To learn development you need to study two things :
    - Functions, algorithms and the like, which is easiest done in a lightweight language, and better even in a Lisp,
    - And then implementation / low level, so you know at least how it works, and C (or assembly for the crazy ones) is your best bet.
     
    • Brofist Brofist x 2
    • Agree Agree x 1
    ^ Top  
  21. Catacombs Magister Patron

    Catacombs
    Joined:
    Aug 10, 2017
    Messages:
    3,952
    Make the Codex Great Again! Insert Title Here RPG Wokedex Strap Yourselves In Pathfinder: Kingmaker
    Did you read the entire book? I've read people say the first three chapters are good enough.
     
    ^ Top  
  22. Krice Arcane Developer

    Krice
    Joined:
    May 29, 2010
    Messages:
    178
    I don't know why the language would do that, it's more about what the programmer is going to do. If anything C++ teaches you to avoid bad programming the hard way.
     
    ^ Top  
  23. Twiglard Arcane Sad Loser

    Twiglard
    Joined:
    Aug 6, 2014
    Messages:
    3,090
    Location:
    Poland
    Read Practical Common Lisp and PAIP. SICP may be too basic if you already have some programming experience. Learn Scheme only if it's a revision/implementation with record types. Otherwise there's too many problems with maintainability and bad habits.

    Don't learn C as the first language as you're going to have problems knowing how to structure your programs while figuring out that you still need to zero-terminate after strncpy(3), and the difference between int(*)[3] and int**.
     
    • Brofist Brofist x 1
    ^ Top  
  24. Urthor Liturgist Patron

    Urthor
    Joined:
    Mar 22, 2015
    Messages:
    1,696
    Pillars of Eternity 2: Deadfire
    Anyone here big on the Scala/Haskell train?

    Decided I need to do some stuff in a language that doesn't look like my job, and hey the "objects and Java were all a giant mistake" guys seem to have it right.
     
    • Agree Agree x 2
    • Brofist Brofist x 1
    ^ Top  
  25. Rincewind Learned

    Rincewind
    Joined:
    Feb 8, 2020
    Messages:
    190
    Location:
    down under
    Yeah, been using Scala at work for 4+ years, quite nice. Couldn't go back to Java, really. Recently started using Kotlin, it's a bit like Scala-- but I quite like it a lot nevertheless.
     
    ^ Top  

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.