Which coding languages are you comfy in these days?

Sometimes when talking about game-development-related topics here I have the urge to post code examples. However, I’m not quite sure what people will tend to find accessible these days. In my own life, I tend to write in either Ruby or C++, but I know that Ruby doesn’t see that much use in game dev right now (outside of on my computer or for RMVX Ace) and C++ can be kind of opaque for the uninitiated. I feel like Ruby can be pretty readable even if you don’t know it very well, but if you don’t know it at all I imagine it’s still going to be kind of confusing.

2 Likes

at the moment I mostly write Go but I can churn out some Python without having to turn my brain on which is always nice, and my shell scripting and js are both objectively fine

3 Likes

C# is my go to, slowly learning Godot script.

3 Likes

I have a feeling that Python will turn out to be easiest common denominator to use for code examples here at this point in time (which is a little sad to me because I have a strong preference for Ruby but I don’t want to be a stick in the mud—I will happily explain Ruby to anyone who wants to know more about it though, it’s really fun!! :stuck_out_tongue: ). GDScript seems very similar to Python so I would hope that code examples in Python would still be fairly accessible to a GDScript user. The most significant difference might be their stdlibs—I’ve written significantly more Python than GDScript so I might be wrong but that’s definitely the impression I get.

Actually, @hellojed, does this example make sense to you? It’s a simple Python 3 program with no error checking or anything.

import sys

cols = int(sys.argv[1])
rows = int(sys.argv[2])

outp = []

for i in range(rows):
    for j in range(cols):
        outp.append('*')
    outp.append("\n")

print(''.join(outp), end="")

You use it like this at the shell:

% python box.py 5 3
*****
*****
*****

(As a side note, just to gesture at what I like so much about Ruby, here’s the identical program in Ruby:

cols = ARGV[0].to_i
rows = ARGV[1].to_i

outp = []

rows.times do
  cols.times { outp << '*' }
  outp << "\n"
end

print outp.join
% ruby box.rb 9 4
*********
*********
*********
*********

Not too hard to read, eh, even if you don’t know Ruby perhaps…??)

2 Likes

I had to look this up because it’s been so long since I’ve made a CLI app, but yeah the rest of it makes sense

2 Likes

Okay cool, thank you. Maybe Python is the best language to default to then? I guess like, C# has kind of similar-ish imperative syntax “in the small” (like in the bodies of functions etc.), so unless the discussion is specifically about OO design questions or w/e, maybe even people who prefer C# might find code examples in Python still fairly accessible? A lot of game programming discussions are kind of at the imperative level first and foremost anyway…like, if you’re just talking about ways to calculate X or Y or whatever.

1 Like

If you’re trying to explain an algorithm I find that psuedo code is the best. The specifics don’t really matter it’s just the “Ok, take in a function with a width and height, print a line of width *'s height times”.

If you’re trying to solve a programming problem it’s probably just best to do it in that langauge.

And if you’re having a hard time doing the second one, we are in the age of LLMs, so… yeah.

I forgot every bit of Python I learned, which is a bit of an issue since I was using it for this game I’ve been working on for the last 30 damn years. Really unfortunate but at least I’ve become really good at becoming “feelies maker”, glad I can fall back on being a lifestyle brand kingpin until I remember how to use computers. Which I’m sure will happen any day now.

8 Likes

Well, I guess like, the downside with pseudocode is that it’s not immediately executable—even if you’re just discussing an algorithm, if you use a language that your readers are comfortable with actually working in and have tooling set up for etc., you can share an example with them that they can run immediately and then play and experiment with etc. and that might really help them get a feel for what you’re talking about. The other issue with pseudocode too is that it can be a little slick—real code forces you to say enough to actually get a running program going, so you’re less likely to skim too fast over the details like you can with pseudocode. It kind of depends on the context of course…sometimes I would use pseudocode, but I feel like it’s nice to know a language that a lot of people will have immediate familiarity with (and maybe tooling set up for).

1 Like

This might be kind of an off-the-wall suggestion but like, if you use Gentoo Linux, your skills will stay sharp. Your computer will stop working in random ways otherwise or w/e. So you have to stay on your toes…like living in a trap labyrinth. Could be something to consider if you are feeling inclined that way.

5 Likes

idk if i’m missing something but when i was doing a lil python course a while ago the pseudo code i tried to write was basically the same as the python i ended up writing. like what’s the difference. i’m sure it starts to diverge once you get into weird functions or w/e but

2 Likes

Well, like, pseudocode can be a lot of things…you can kind of just make up the notation as you please, and it can be quite slick if you know the audience will be able to fill in the details. Like, here’s some pseudocode from Data Structures and Network Algorithms by Robert Tarjan:

He gives precise meanings to the symbols and keywords and things here earlier in the book; they’re kind of specifically set up to make it easy to talk about graphs, follow some old-fashioned conventions because the book is from the early '80s, etc., so they’re kind of different in character than what Python gives you, and also just more abstract.

I feel like this kind of aproach can be nice for a relatively confident audience, but it’s not as good for beginners necessarily—it takes kind of an abstract view of programming apart from any language, and that can take time to develop even after you already know one language fairly well.

1 Like

I’ve grown to tolerate Javascript. I still appreciate Ruby’s syntax and think it’s very nice as a shell scripting replacement. Python is fine, Lua is fine. C# looks good but I’ve never written any for money. IMO any ALGOL descendent is mainstream for purposes of posting examples and semipseudocode.

4 Likes

i’ve written a decent amount of js, ruby, python, java, c#, and elm. made a concerted effort to pick up both rust and haskell but neither stuck. i don’t know that i’m comfortable writing in any language because computers are evil but i think if i got the opportunity to work with newish c# outside the context of unity and .net framework hell i’d hate that the least. i’d give a lot to not have to worry about null checks etc again

5 Likes

use lua and piss off everyone with 1-based indexing

9 Likes

image

we could be discussing hard-hitting problems like this

5 Likes

I have a deep-seated loathing for pythonic syntax that probably isnt even worth talking about, but that language is what I was mostly using at work the past year or so up until a couple weeks ago. Now its back to the enterprise golang mines. They finally added generics since last time I had to use it at my job so thats nice I guess.
C# has been my go to for a long time from unity and then godot, but these days most of the code I write is in javascript thanks to rpgmaker. I used to really hate js but overtime its become somewhat conformable for me. Ive internalized enough of its pitfalls and evil quirks that I can crank it out without thinking too hard which is exactly what I need from a scripting language. Nightmare for writing engine code though, huge mistake on that front.

3 Likes

pythonic syntax has gotten worse and worse over the years since it was always kind of a toy language that let you write pseudocode and barely think about it but now that everything has decorators and typing and weird inverse list comprehensions the enforced whitespace isn’t cute or easier anymore, I’m really glad that I volunteered to be a go [docs] maintainer at my current job because the way we’re obliged to write python is about as joyless as es6->typescript whereas the way we write go lets me effectvively not give a shit the way I used to with python

I do not appreciate how much go despises local imports (it is so opinionated about directory/module structure to very little benefit) but other than that I have few complaints

3 Likes

i write java for a living and i’ve grown comfortable with it. when i don’t get strong typing it annoys me a bit but i can handle writing javascript every now and then when we need some specific event-handling for the enterprise thing we develop. have made a couple things in python and C# on occasion.

one of these days i wanna make a small game using raylib with C (or maybe rust since there are bindings for it) as both a learning exercise in game-making and a introduction to low-level programming

2 Likes

I have at various times also written C#, haskell, ruby, lua, php, though somehow never java, and I don’t particularly love any of them

oh, the default go linting in vscode is also impressively aggressive compared to everything else, I like it but I’m surprised they’re able to push it that hard