8 ms·
JAI Primer: A Programming Language for Games
- jjaredsimpson 11y agoWatching him occasionally stream his sessions shows me that what he is doing is just funzies. His tooling is so far behind anything all other languages have that I would never bother to learn this language, because it was "for games." If I wanted to make a game I would learn any engine using any number of language bindings.
- AlexeyBrin 11y agoJAI is for games in the sense that reflects the experience of a well known game developer that writes game engines and games.
- renox 11y agoAnd also in the sense that it allows you to easily remove the safety checks when you need higher performance while Rust doesn't necessarily allow it (array access for example). So I'd say that Rust seems more suited to write an OS, a webbrowser as in both cases safety is critical and Jai for games as performance is critical. For other applications which needs low latency (so no GC) but are neither safety critical nor performance critical? Jai's 'look and feel' seems to me much more seducing than Rust (assuming/hoping Jai becomes real).
- zurn 11y agoRust does let you do unsafe array indexing and other unsafe stuff. But it doesn't support switching the semantics of safe code to unsafe with a build flag, you need to explicitly use "unsafe" in code.
- renox 11y ago> But it doesn't support switching the semantics of safe code to unsafe with a build flag Jai allow this for array indexing AND it also allow the reverse: reinserting array checks even when there is an 'unsafe access' operation: this way even if you made a mistake in adding an 'unsafe access' operation it's easy to find where the error is (assuming the error is reproducible of course).
- pcwalton 11y agoI haven't seen any cases in which adding a global build flag to turn off bounds checks would actually improve performance. People overfocus on bounds checks because they're an easy thing to understand, but they're just one of many performance issues when creating a new language, and not a particularly interesting one at that since APIs, compiler optimizations, and branch predictors all conspire to drive their overhead down to near-zero (in my experience).
- renox 11y agoSure, but I think that having one global flag to remove bound checks is useful as it allows you to measure this bounds checks performance impact easily. And then when you know how long it takes to find an index out-of-bound error and you see that the removal performance improve is small.. Well, you remove the flag.
- adrusi 11y agoHe's been working on this project mostly alone for only a few months, how can you possibly expect the tooling to be on par with anything else. There's a reason it's not released. And it's great that you can just pick up an engine, but someone's gotta write that engine, and there's a reason triple a studios aren't using unity for major releases; you'll never get quite as good performance out of a general purpose engine as you would from a custom one.
- mcphage 11y ago> there's a reason triple a studios aren't using unity for major releases They are, however, using Unreal Engine for tons of major releases.
- learc83 11y agoBut most of those major releases require some amount of custom work on the engine. They still need C++ programmers who can understand what's going on under the hood.
- cheepin 11y agoHearthstone (by Blizzard) is a Unity game, not that performance is a huge concern for card games. It's a pretty thin client mainly for displaying the animations/artwork while most of the logic runs serverside. Still, it's a very profitable game by a triple A company.
- learc83 11y agoHearthstone isn't what anyone would normally call a AAA game though. Until the end of the beta they only had 15 employees working on it. They basically had to use an established engine because they didn't have the budget to build their own.
- kybernetyk 11y ago>Hearthstone (by Blizzard) is a Unity game, And I asked myself why Hearthstone stresses my system so much. Now it's clear.
- AlexeyBrin 11y agoAs of this writing there are no public compilers for Jai, so all information in this text is collated from Jon Blow's YouTube videos. Until the language is actually released, at least in an alpha version, writing a tutorial is just speculation. Anything can change in the actual language implementation. That being said, the author initiative is laudable if you don't want to watch a few hours of Youtube videos.
- candeira 11y agoI have a friend who writes a lot of C++ code for signal processing, software sound synthesis mainly. Watching Jon Blow's videos I could tell this was something my friend would be interested in, because the problem space is very similar: you need realtime performance, can't afford even the slightest garbage collection pause, etc. However, I could not tell my friend "go watch videos for six hours". Thanks to Jorge Rodríguez, I can email my friend a document that will take him less than half an hour to read.
- deleted 11y ago[deleted]
- nephewtom 11y agoThis is what Jon Blow said about C++ on Twitter: [https://twitter.com/jonathan_blow/status/561371202350878720 https://twitter.com/jonathan_blow/status/561371202350878720] "If you want to never get any work done, use a programming language like this: https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers https://isocpp.org/blog/2012/11/universal-references-in-c11-... " I used to enjoy programming in C++, even though I always thought it was too complex. Too many things to learn and too many approaches. For example, I never could grasp template-meta-programming thing. May be I didn't dedicated enough time, but that's the point. If it takes so much time to learn the language and its complexities, you have much less time to program "things" with it.
- imron 11y agoI love the idea of seamlessly switching between AoS and SoA for data types.
- asgard1024 11y agoI like that idea too, but what I like even more is the bold originality in it. I think hackers who make these new programming languages should try to be original, and experiment with weird things that actually help them solve whatever problems they feel they have during development, because language is pretty much a programmer's user interface. And also this particular feature is close to my heart, because what I would like to see as a feature(s) in programming languages that the programmer would only supply the data schema, and compiler selects the actual data structure based on run time performance characteristics of the program.
- unwind 11y agoFor those who don't follow, the acronyms mean "array of structures" vs "structure of arrays". These are two orthohonal ways to represent data, both of which have advantages which make them attractive. Being able to switch the same data around between the two is cool and innovative.
- DoctorZeus 11y agoThe #run directive addresses some major pain points for me. Is there anything analogous in other languages?
- adrusi 11y agoYeah, similar constructs exist in D and Nim. I don't know well enough how they compare to give any thorough analysis, though.
- renox 11y agoI don't know what Nim do but AFAIK in D you're (voluntarily) limited in what you can do at compile time because in effect with Jai compiling a program is running it, so this can have security implications..
- mcphage 11y agoIn theory a good optimizing compiler should see that some code doesn't depend on anything external and do it, but I'm not sure to what extent they do. GCC with higher optimization settings does do some pretty crazy stuff, so I would expect it to figure out something like in the example code pretty easily.
- pron 11y agoAll Lisps have macros, which are the same only more powerful (as they're allowed to transform code).
- otabdeveloper 11y agoYes, constexpr in C++.
- vvanders 11y agoAside from the aos/soa I feel like Rust hits a lot of the same points. Nice to see #run similar to elixir macros.
- Hemospectrum 11y agoYep, a lot of people have noticed that. He's mentioned Rust in a few of his videos (and the compiler devs are always taking notes about his grievances) but he doesn't seem interested in working with the Rust community in any way. He considers Rust too ideologically opinionated to be of use to him.
- dkersten 11y agoJai also seems rather "ideologically opinionated" to me (which isn't a bad thing in my opinion).
- PopeOfNope 11y ago> He considers Rust too ideologically opinionated to be of use to him. He's not wrong. The rust community approaches everything from the standpoint that we should be forcing devs to code in a particular way because safety. What I like about Blow is that, so far, he's big into giving the dev options along with some (completely optional) syntactic sugar. The focus is on functionality, not ideology.
- sanxiyn 11y agoThe idea that a programming language should focus more on helping people do things (functionality) rather than preventing people do things (safety) is an ideological stance, just as much as the reverse. Describing one side as functionality and the other side as ideology is not a good description. I understand that many people's ideology align better with Jai compared to Rust. On the other hand, many other people's ideology align better with Rust compared to Jai.
- pcwalton 11y ago> The rust community approaches everything from the standpoint that we should be forcing devs to code in a particular way because safety No, I'd actually be perfectly fine allowing the safety features to be turned off, and have suggested it several times. Nobody has seemed particularly interested, though, because what people tend to find is that safety ends up being good for productivity as well.
- kabdib 11y agoRule of thumb for doing a programming language: Write the debugger first. Or at least, very, very early. This will inform you of poor choices you've made, and you're going to need a debugger anyway.
- cheepin 11y agoWhat poor choices are revealed by writing a debugger in particular? At this point, he compiles Jai to C, and the compiler isn't too gigantic yet, so there's not a huge surface area to look for compiler bugs.
- humanrebar 11y ago> What poor choices are revealed by writing a debugger in particular? Well, for one, you can't just transpile to ANSI C, compile, and end up with sensible debug symbols in your binary. You'll end up with debug symbols for the C code, not the original language. So you end up writing in one language and debugging in another. This is one reason most new languages target LLVM.
- sanxiyn 11y agoCompiling to C with #line directive actually gives a good enough debugging experience, similar to compiling to JavaScript with source map. This is much easier than generating debug info, even with LLVM.
- pcwalton 11y agoI don't think it's good enough. You can't inspect variables, types will be wrong, any namespacing you're doing will leak into the debugger, single step won't give you the right semantics unless your language is extremely close to C, gdb pretty printing won't know how to print your language's values, etc. Backtraces will sort of work (although the name mangling will leak through), but little else will. You really need to generate DWARF directly in your frontend in order to have an acceptable debugging experience.
- 11y ago
- eigenbom 11y agoI'm excited for Jai, and if it ever makes it out into the world I look forward to building some games with it. However, I just see C++ continuing to get better and better for games programming. The recent appearance of the Core Guidelines [1] (and the eventual codified form for compilers) will be a huge leap. I wish we had full #run-type control over the compile phase, but full constexpr support is a step of the way there. 1. https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md https://github.com/isocpp/CppCoreGuidelines/blob/master/CppC...