Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What's so special about games that makes it not useful? Python has it and it's bread and butter, and Godot language is basically a gimped, less expressive, and less useful knockoff of python


> gimped, less expressive

That's the point. Lots of what Python does isn't required in a game engine and is slow.

It's basically visual scripting but quicker to produce, the whole thing is C++ underneath.


So basically instead of

   number_list = [ x for x in range(20) if x % 2 == 0]
   print(number_list)
one gets to write something like this,

    auto number_list = std::views::iota(0, 20) | std::views::filter([](const int n) {return n % 2 == 0; });
    for(int num: number_list)
        std::cout << num << ' ';


Maybe look at the code of real games out there to find out why list comprehensions aren't needed in a game engine specific language and what typical code looks like...


Once upon a time I was on SCEE offices in SOHO, was IGDA member for almost a decade, attended a couple of GDCE back in the day, regular visitor of Flipcode and GameDev.net back when they actually mattered.

Maybe don't try to guess the possible lack of knowledge of random people on the Internet.


Fair enough but while I've used list comprehensions or similar constructs while doing stats, never seen it in game code.

Usually it's just incrementing things in a loop, rather than creating lists...

Like why wouldn't you just do:

for x in range(20):

  if x % 2 == 0

    print(x)
Or push it to a list or something. The specific type of list transformation that comprehensions make slightly easier isn't common in game code and doesn't make things more readable versus for loops.


I was pointing out how much Python like code it is possible to write in modern C++, everything else is irrelevant.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: