My favorite part about jai is the fact that during Jon's first demo of the language he made it so that the language required you to play a game "well enough" to compile. He then continued on the demo and completely forgot to remove the code requiring you to play the game and the game's requirement, tried to compile, opened the game, instinctively closed the game window as he already had to close it 5 times before this happened, and was met with a message about how he was terrible after he realized what he had done XD.
@@tech6hutch Usually they have a thing in the dashboard that allows the creator to show links if they so choose to let them through. Unless if they removed the option to verify links, it'd be up to him whether or not he saw it.
Build systems ain't the reason that build times in C++ are that slow, it's the compilation model of C++ based on generating a translation unit per file given to the compiler that makes the build times slow, and certain features, like templates, concepts, SFINAE & constraints, partial template specialization, and specially, optimizations...
Came here to say this. Also C is not problematic because you can't break out of two for loops. And having to include external libraries to write a game in a general purpose programming language is also not a problem (what might be problematic is that dependency management is not part of C itself).
And dont forget the clean code recommendations that you need a single file just for every class, no matter how small (even enums) and that you need to include the header as the first include in the source (to make sure headers are self contained) which eliminate the ability to use precompiled headers. Also so many things could be implemented if we had whole file compilation and made the linker to do a little more (like the Objective-C linker does).
Partial template specialisation is not much slower than just a new class/procedure. It's an instance when you use it, for each compilation unit, that the template is instantiated that takes the most time. Especially stuff like variadic templates often call more templates, cascading into an enormous amount of generated code, that may well be duplicated in another compilation unit. Why you should just ignore people that say you should use make_unique and just use new, for instance. And forward declare all the things. I recommend actually profiling the build to find out what is taking all that time. You can do that in clang with -ftime-trace and dropping the json in some flame graphing program.
This is a fair point, but build systems and especially CMake add another layer of problems on top of that. CMake behaviour is often not intuitive, so It's very easy to accidentaly introduce spurious dependencies or duplicate jobs. In my experience, the compilation model of C++, combined with the way it's configured through CMake is where everything breaks. e.g. build fails because you included a header file from different target - oops, so you add the cpp file into your target and suddenly that file is built twice (even though you'd think CMake will build it once and cache it). Or, you already know about this problem, so you link the other target with your target instead, but now your target can't start building cpp files until the other completes, because CMake adds the dependency edge on full build, not on link step. I've found a ton of issues like this in the build at my previous job, 60% of the build time was basically wasted on nonsense like this.
Includes. You often include tens or hundreds of thousands of lines of code into every .cpp file. You end up having to compile the same code over and over again.
3:33 Reason it's called "The Language" (even if it's a third party tool), is because officially Jai doesn't have a name yet, so Jon only refers to it as "This programming language", "our language" or just "the language". =P
Omg thank you. I looked everywhere for how to pronounce it and finally was like, there's no way. He has to be doing this on purpose! Drives me crazy. Just say it once! >.< Is it Jai or Jai???
6:40 you can use the double if in other languages too, but it looks different. For example C: if (some_condition) switch (some_stuff) { // .... it's just inline, and since the switch/match syntax is "if thing ==" it looks like that.
I thought it came with SDL2 as a lib, not that it had it's own functions to create windows and render stuff on a basic level like that, that's really good!
> you can't break out of two for loops easily I don't understand why everyone hates goto. It's the correct solution. You whack a label at the bottom of the for loop, with an optional spot just before the label for the case when you don't break out of the for loop.
@@minerscale that's what all constrained control flow keywords are. the point is that they're constrained, so when you see the keyword, you know that there are only a limited number of things it can do
Lots of comparisons to things that are dumb about C++ that are not problems in any other languages. :D A module system should be a given. I've watched a lot of videos about this language, and Jonathan is always going on about how the main goal is just reducing friction when developing a game. Fast compilation speed, syntax that makes refactoring as easy as cut and paste ("if if" seems like an example of that), with compile time execution as a unique cherry on top (which other languages are just starting to see the benefit of as well). I'd be interested to hear how this plays out in a larger project.
Welcome to the Jai beta btw. I've been using it for a little over half a year now, and I'm loving it so far. There are some small things that I would like to be slightly easier to do, but it isn't necessary, and in most cases you can easily implement it yourself using the meta programing, or the normal language features. Also, Jai is pronounced with an A not and E.
@@VACatholic If you haven't already considered it, have you tried Odin? It doesn't have the metaprogramming, but it has many similarities and shared philosophies. Unfortunately, JB has said that the public interest in Jai is far too strong at the moment (they're getting spammed with requests), so we're discouraged from sharing how to get on right now. On another note, JB has recently said his game is getting closer to release, which I think means between 6-24 months, and if he sticks to the original plan, the language will be made mature and open relatively soon after the game is in production with low maintenance.
when looking for functions in Jai I tend to use grep manually for example: grep -rn 'read_entire_file.*::' (I use ".*" or " *" because I have seen some instances where the :: is padded weirdly, or there is more at the end of the function name)
Very interesting video. I agree with you on how you learn programming, just going and exploring is my favorite way as well. I also usually find that I don't actually understand the "how-to" docs until I've already gone through and figured out enough of the language myself anyway. Bc they're written by people who already understand the language, they usually don't do a good job of explaining it to folks who don't already. The name:type syntax seems to be gaining steam across a number of modern programming languages, from TypeScript to Rust to Go. My understanding is that it's easier for the compiler to parse, especially for languages that do a lot of type inference. It's also more in line with mathy algebraic type systems, and thus is common in the ML family of languages (Haskell, OCaml, etc), which these languages (especially TS & Rust) are directly inspired by. I am not sure how much Jai takes influence from them other than in the basic syntax. I personally have found that once I got used to it, I prefer it. I am curious, given the "function names are constants" thing, whether Jai has strong support for higher-order functions? I know its metaprogramming story is strong (and is similar to Zig's compile time programming, if I recall?), but I haven't seen anyone talk about functional programming paradigm support in Jai.
15:20 I tend to just check if it is down in the event loop and just have some variables with booleans and just set them on/off using that. For example: if event.key_code == { case #char "W"; move_up = xx event.key_pressed; case #char "A"; move_left = xx event.key_pressed; case #char "S"; move_down = xx event.key_pressed; case #char "D"; move_right = xx event.key_pressed; case .SPACEBAR; jump = xx it.key_pressed; } Another way of doing it that I think Jon is doing is to call out to different functions inside the event loop so you for example have a function for handling player events, etc. for event: events_this_frame { player_handle_event(event); // ... if event.type == { case .QUIT; isRunning = false; case .KEYBOARD; if event.key_pressed if event.key_code == { case .ESCAPE; isRunning = false; case .F11; // fullscreen stuff } } }
Hey! I'm enjoying Jai as well and find it very efficient to work with. I still would like a few more syntax sugar things like struct methods or 2d array overloads. I'm currently in process of making a video on Jai + Sokol but it's taking me a very long time, the project is ready but editing the video is very time consuming. Good luck to you and your game! Be sure to port it over to Jai. And I think Sokol might be actually a nice choice for your game.
gamedev graphics library should not be a part of any standard library. it's just too volatile, and its entire pipeline keeps evolving much faster than any language can ever hope to maintain. even first party graphics libraries like vulkan constantly suffer from "we're evolving too fast" problems. building a language with built-in vulkan support is a non-starter.
I've never used c++ but started to learn c recently... Your first statement about the nested for loops... Can't you use a goto statement to break out of the inner loop?
@@Cakez77 how did you get into the beta? Just emailed jblow? I would email him but I'm scared of rejection since I work in the financial sector now and the last game I worked on was before 2020
fun fact, you can do this foo := (a: int) -> int { /* ... */ } which essentially is a function pointer thing, and to make a function pointer with no default function you do something like this: foo : #type (int) -> int;
@@Jutastre Just because you can do something, it doesn't mean that you have to do it. Also, function pointers is a thing in a lot of languages, not just JS. Btw, C++ has this: auto foo = [](int a) { return a * 2; }; Jai just has a nicer way to do it. So you can have a function that can't be reassigned inside a function: foo :: () { bar :: () { } bar(); } or you can make it so it can be reassigned foo :: () { bar := () {} baz :: () {} bar(); bar = baz; bar(); }
@@Cakez77 @delphicdescant i guess so just for the case that it comes with c/c++ compilers and build system so like we already have big code base that cant be rewritten so they might try the build system as a start then might start using zig along with their prev code base thats where Zig even comes on top of Rust its just its not yet prod ready v1
Would love a link to his channel. I found channel by name randy who is a game dev but his videos are shorts and more show case oriented than programming.
I’d bet the explicit char call in the character binding has to do with UTF encoding and languages. Keys like esc or return are common keyboard keys where’s as letters are language dependent. Not my speciality but that was ringing some Go similarity bells in my head
There are 3 main reasons for this: 1) comparing to c++, jai is designed much easier to analyze (especially metaprogramming part) 2) it doesn't do a lot of crazy optimizations stuff, that gcc does and instead gives user easy way to optimize their code with "modern" techniques like allocator switching. 3) there are no incremental building by default
As someone writing large projects in Zig already, it's going to be much more difficult for a language like Jai to pull me away than it would have been to pull me away from C++...
i agree... with zigs interoperable nature with c and how EASY you can port in the raylib c library... Honestly why bother with learning another language...
I agree. With Zig out to replace C, Odin aimed at game dev, and Nim being so amazingly easy, fast, and compiling to C/C++, Objective-C, and JavaScript, Jai is late to the party and really has to stand out to gain traction.
@@Cakez77 Odin took a lot of inspirations from jai, the first thing that you would notice is how similar the syntax is. Also Odin is used in production, there's this company called gangafx which Bill (odin creator) work in, wrote its flagship real-time volumetric fluid simulation tool in Odin, EmberGen, they also WIP two new software, GeoGen for terrain generation and LiguiGen for liquid simulation. EmberGen used widely in Hollywood and some game development studies use it too.
@@Cakez77He advocates that C++ is a really terrible language, but it does somethings right that most other languages fail to do, so that's why we use it in games. This comes in complete contrast with your opening statement lol, and then you go on to say that it has some problems and the first thing you mention is that yoi can't break out of 2 for loops, and i laughed because he would consider this reason such a trivial not even worth mentioning shortcoming of the language, that's why I said it lol. You may want to watch his 2018 talk "Jon Blow's Design decisions on creating Jai a new language for game programmers", I find that interesting
4:45 I didn't expect to see my example code thing for OpenGL in Jai here lol. ... it's weird to see people use my code to learn themselves... but it's nice too.
@@benjaminpedersen9548 I litteraly just asked Jon by email and got into the beta. Most people just don't go that far so it seems to be enough. At least at the time it was
@@Cakez77 Odin is more ergonomic than Zig and also has inbuilt features that makes it easier to do gaming, VFX type development. Odin has the best error handling when compared to Zig, Go(and even something fancy as Rust) according to Rickard Andersson who was so impressed by the language and how the features work together that he made a whole Odin programming playlist on youtube.
If I watch enough of these videos on Jai, eventually I might just write a compiler for it and release it before Jon Blow does. Although, I do think he went in the wrong direction with a lot of the constructs. I don't like the way he handles switches, both the casing syntax and breaking versus falling through. The Pascal style typing has gotten out of hand with newer languages, and the way he does constants. I don't like the import syntax, especially if it requires those quotes and doesn't allow for a comma separated list. The fact that it does allow namespacing a given import is cool, but the way it does so annoys me. I went in a lot of completely different directions than he did for my own language. If he doesn't release Jai before I release my own language...
You can implement your Option/Maybe using a struct with an enum or bool and a polymorphic variable inside, and some functions if you don't want to check it manually.
If an ability to create a window in a one line is a single plus it's not a very good language TBH. sdl/raylib/whatever allows to make it in any language in more cross-platform way. At this point I think the whole video is big fat sarcasm rant about jai forever beta.
Lol 😂 I mean for me it is. The good thing is that the library is maintained by Jai and not a third party to that you have to add manually. That's mostly my point
That is not the main point of the language. The metaprogramming and compile-time execution features plus a bunch of smaller design decisions are the big selling points. Honestly, I think the in-program build system is a huge deal.
@@richardcsernus6845 because its outdated? Sure its fast as hell bu its only getting more complex as people update it. Its still a needlessly abstract language that while others are slow still do garbage collection and other features that C++ does not. the games industry for example could migrate to another language and people wouldnt knwo the difference. Having to rely on strict memory management like before isnt needed anymore when you have game engines that do it for you.
@@TheBlackMaster Its not GC vs BC. I actually have a language idea in my mind that does not do borrow checking, but neither GC and in memory safety its not as good as rust, but handles 99% of cases (and only error in remaining 1% if you are noob) - all while its much-much more simple and let a lot of valid and safe programs through that rust does not. For me rust is so much productivity pain for useless gain (I do not make those issues anyways in modern cpp) that I rather use modern C++ and code faster...
I admire you for challenging Blow with these videos. There's a lot of worshippers who just follow every idea he comes up with and it's pretty dangerous.
9:44, I hate any char separating the variable name and its type, specially if it requires pressing shift. I won't even use Carbon, if they won't change that s** syntax! However, the if with no ( ) was nice. Does this hit compilation time?
@@Cakez77 I think it would have to be a lot better than what they are currently using to entice them to make the switch. and honestly from what I've seen it's not better than either of the two I mentioned.
If you've ever followed *any* of Jon's projects you'll know he doesn't rush things out to beat the competition. That's not his strategy and never will be. He doesn't care about winning the short-term race, he cares about making the best goddamn language he can, and so far, he's doing a pretty fine job of it IMO. But yeah.. it totally sucks that not everybody has easy access to it, and I can understand how it feels dead if you're not in the beta and getting the weekly release notes of the insane amount of stuff being improved and changed. He's also the CEO of a company that's building quite a few other projects right now (Braid: Anniversary Edition just got a release date announced, and he constantly streams his Sokoban game's development on twitch, plus other, yet-unannounced projects). Building great things takes time.
@@dandymcgee zig and Odin aren't being 'rushed' either, yet those are two great products that are on par or better than jai that people can use right now. the reason jai isn't out now is because Jon is an elitist and his ego can't take getting criticisms, or suggestions from people he considers to be beneath him.
Without evaluating at its technical merits, Jai is just another ugly language. The double if just looks and feels wrong. Beauty in construction yields excellence in performance and quality.
I don't really see the point of Jai at this point. Zig and Rust are more likely to be C/C++ successors. Zig gets rid of many warts of C(no more weird macros or operator overloads), while Rust puts correctness first(basically no runtime errors/asserts/seg faults 99% of the time, for the cost of it being more opinionated). Jais's huge "sell" being that it ships with some dependencies is kinda weird when any modern language has a package manager, but basically any language has something like "Simp".
@@Cakez77 The people who are complaining about the compile times are the people who pull in hundreds of dependencies. A game written in pure OpenGL and with the Windiows-API compiles in 0.5 seconds for me.
I think Rust and Jai aim for different things. Rust ensures program correctness at the expense of compile-time. Jai ensures fast compile-time at the expense of program correctness. One thing that is very powerful about Jai is it has powerful reflection capabilities - you can write Jai code that dynamically reads the output of the parser and makes adjustments to it before the code is compiled. This means you can very easily write code-generators in Jai for generating boilerplate for you. Rust and C++ at the moment don't support reflection like that.
@oscarsmith-jones4108 Wouldn't it be possible in Jai to write static compile time checks that enforce safety in a targeted way so that new devs don't break project-specific rules? For the really hard problems this means static checks and project-specific rules can be enforced that even rust cannot do but with fast compile times.
As one of the participants said (maybe it was tsoding, but not sure): "instead of ending the closed beta, it will just grow enough so everyone who interested will have access"
My biggest gripe with Zig, Odin and Jai is their left-handed variable type declaration and also type inference being the default. Makes readability so much worse.
@@Cakez77 It's not even that it's a readjustment - it has been proven that it is actually worse for readability to have types right aligned instead of left like C. Why? Because your brain can parse the types of whole blocks of variables much faster that way, without even having to read them. Here's a basic example with just some primitive types: float myFirstFloat float mySecondFloat float myThirdFloat int someInteger int breaksNamingConvention bool someCondition string someText Compared to: myFirstFloat float mySecondFloat float myThirdFloat float someInteger int breaksNamingConvention int someCondition bool someText string As you may be able to tell, finding a specific variable of a specific type is much harder this way. In the case of primitives specifically, there's actually a funny thing where they are all (mostly) have different name character lengths, making them *even easier* to parse when they are aligned in a block like one would do in C: int (3) bool (4) float (5) string (6) That's why, as someone who really needs and wants this code readability as I have poor eyesight, this "trend" in many modern languages to change this is genuinely extremely frustrating. The over-use of type inference is similarly annoying, as understanding what a block of code does and what types it has gets much harder when they aren't explicitly stated anywhere - I mean, try reading a python script and understanding what any variable's type is. Thanks for coming to my TED Talk.
@@nolram That's a lot of nonsense. The type is rarely important, and if you can't infer it from the context, your code probably sucks. Using Python, a dynamically typed language, as an argument for type inference in a statically typed one shows a clear lack of experience/knowledge.
@@Giga4ever Well, a dynamically typed language is just an extreme example to visualise the point. Types in statically typed languages ALWAYS matter, especially for readability of code. Knowing what data your code operates on is key - there's very few more important things. And "inferring from context" not only takes more time than just... seeing it, it also leads to less awareness, and especially in larger codebases you can't rely on knowing the context. Using explicit types makes code more readable and faster to parse and is superior in almost every single scenario. You read your code more than you write it.
It's pronounced Jai, not Jai.
🤓
Oh my, I always thought it was neighter, pronounced it as Jai...
Jai ≠ Jai ?
You mean Jay, not J?
@@peezieforestem5078 He means Jai, not Jai or Jai. Just Jai.
My favorite part about jai is the fact that during Jon's first demo of the language he made it so that the language required you to play a game "well enough" to compile. He then continued on the demo and completely forgot to remove the code requiring you to play the game and the game's requirement, tried to compile, opened the game, instinctively closed the game window as he already had to close it 5 times before this happened, and was met with a message about how he was terrible after he realized what he had done XD.
What lol, so you have a clip of that. Sounds funny as hell
@@Cakez77 ruclips.net/user/clipUgkxiIlkFWoCwX2jzIo-4F3I53Ae0hBuNfQ8?si=z3fi_J-vPPiiDUxl
Links are shadowbanned by RUclips btw
@@tech6hutch Usually they have a thing in the dashboard that allows the creator to show links if they so choose to let them through. Unless if they removed the option to verify links, it'd be up to him whether or not he saw it.
idk, but there were "2 replies" and I only saw one, hence why I said something (since I'd also like to see this lol)@@anthonyewell3470
Build systems ain't the reason that build times in C++ are that slow, it's the compilation model of C++ based on generating a translation unit per file given to the compiler that makes the build times slow, and certain features, like templates, concepts, SFINAE & constraints, partial template specialization, and specially, optimizations...
Came here to say this. Also C is not problematic because you can't break out of two for loops. And having to include external libraries to write a game in a general purpose programming language is also not a problem (what might be problematic is that dependency management is not part of C itself).
And dont forget the clean code recommendations that you need a single file just for every class, no matter how small (even enums) and that you need to include the header as the first include in the source (to make sure headers are self contained) which eliminate the ability to use precompiled headers.
Also so many things could be implemented if we had whole file compilation and made the linker to do a little more (like the Objective-C linker does).
Partial template specialisation is not much slower than just a new class/procedure. It's an instance when you use it, for each compilation unit, that the template is instantiated that takes the most time. Especially stuff like variadic templates often call more templates, cascading into an enormous amount of generated code, that may well be duplicated in another compilation unit. Why you should just ignore people that say you should use make_unique and just use new, for instance. And forward declare all the things.
I recommend actually profiling the build to find out what is taking all that time. You can do that in clang with -ftime-trace and dropping the json in some flame graphing program.
This is a fair point, but build systems and especially CMake add another layer of problems on top of that. CMake behaviour is often not intuitive, so It's very easy to accidentaly introduce spurious dependencies or duplicate jobs. In my experience, the compilation model of C++, combined with the way it's configured through CMake is where everything breaks.
e.g. build fails because you included a header file from different target - oops, so you add the cpp file into your target and suddenly that file is built twice (even though you'd think CMake will build it once and cache it). Or, you already know about this problem, so you link the other target with your target instead, but now your target can't start building cpp files until the other completes, because CMake adds the dependency edge on full build, not on link step.
I've found a ton of issues like this in the build at my previous job, 60% of the build time was basically wasted on nonsense like this.
Includes. You often include tens or hundreds of thousands of lines of code into every .cpp file. You end up having to compile the same code over and over again.
3:33 Reason it's called "The Language" (even if it's a third party tool), is because officially Jai doesn't have a name yet, so Jon only refers to it as "This programming language", "our language" or just "the language". =P
Huh interesting, always thought it was Jai. Wonder what happens if he renames the language lol
Omg thank you. I looked everywhere for how to pronounce it and finally was like, there's no way. He has to be doing this on purpose! Drives me crazy. Just say it once! >.< Is it Jai or Jai???
"our language" **marxism intensifies**
Jai stands for "Just An Idea" at lest that was the initial reason for the word.
@@Argoon1981 Nope, Jonathan _never_ said anything like that about the name.
There is no official name for the language and there never was.
6:40 you can use the double if in other languages too, but it looks different. For example C:
if (some_condition) switch (some_stuff) { // ....
it's just inline, and since the switch/match syntax is "if thing ==" it looks like that.
I thought it came with SDL2 as a lib, not that it had it's own functions to create windows and render stuff on a basic level like that, that's really good!
Yeah, I was surprised too, but I also saw the SDL2 lib, so that does exist
its using glfw3
Very nice, I will like to see more in depth videos about jai
Noted, glad you like it. I actually have one more comming
> you can't break out of two for loops easily
I don't understand why everyone hates goto. It's the correct solution. You whack a label at the bottom of the for loop, with an optional spot just before the label for the case when you don't break out of the for loop.
Or simply break ; and it breaks out of the loop
@@andreffrosa Hey that's just goto designed to appease people told never to use goto.
That was my last use of goto. But since C++11's lambda feature, I never touched goto again.
People are simply not good developers
@@minerscale that's what all constrained control flow keywords are. the point is that they're constrained, so when you see the keyword, you know that there are only a limited number of things it can do
Nice👍 Almost made me want to start a jai project.
Hey that's great to hear, glad I could inspire you
Lots of comparisons to things that are dumb about C++ that are not problems in any other languages. :D A module system should be a given. I've watched a lot of videos about this language, and Jonathan is always going on about how the main goal is just reducing friction when developing a game. Fast compilation speed, syntax that makes refactoring as easy as cut and paste ("if if" seems like an example of that), with compile time execution as a unique cherry on top (which other languages are just starting to see the benefit of as well). I'd be interested to hear how this plays out in a larger project.
Welcome to the Jai beta btw.
I've been using it for a little over half a year now, and I'm loving it so far. There are some small things that I would like to be slightly easier to do, but it isn't necessary, and in most cases you can easily implement it yourself using the meta programing, or the normal language features.
Also, Jai is pronounced with an A not and E.
Thanks, would really like to see those metaprogramming features your talking about. I have never used anything like it even in c++
@@Cakez77 the compiler is an event loop that can be hooked into to control everything the compiler is doing.
Is there a way for non-personality non-game devs to get access? I'm an ML person who is frustrated with some tools and curious if/how jai solves them.
@@VACatholic If you haven't already considered it, have you tried Odin? It doesn't have the metaprogramming, but it has many similarities and shared philosophies. Unfortunately, JB has said that the public interest in Jai is far too strong at the moment (they're getting spammed with requests), so we're discouraged from sharing how to get on right now.
On another note, JB has recently said his game is getting closer to release, which I think means between 6-24 months, and if he sticks to the original plan, the language will be made mature and open relatively soon after the game is in production with low maintenance.
@@Muskar2 Fair enough. I have a day job, so it'd just be a hobby anyway.
when looking for functions in Jai I tend to use grep manually
for example:
grep -rn 'read_entire_file.*::'
(I use ".*" or " *" because I have seen some instances where the :: is padded weirdly, or there is more at the end of the function name)
Very interesting video. I agree with you on how you learn programming, just going and exploring is my favorite way as well. I also usually find that I don't actually understand the "how-to" docs until I've already gone through and figured out enough of the language myself anyway. Bc they're written by people who already understand the language, they usually don't do a good job of explaining it to folks who don't already.
The name:type syntax seems to be gaining steam across a number of modern programming languages, from TypeScript to Rust to Go. My understanding is that it's easier for the compiler to parse, especially for languages that do a lot of type inference. It's also more in line with mathy algebraic type systems, and thus is common in the ML family of languages (Haskell, OCaml, etc), which these languages (especially TS & Rust) are directly inspired by. I am not sure how much Jai takes influence from them other than in the basic syntax. I personally have found that once I got used to it, I prefer it.
I am curious, given the "function names are constants" thing, whether Jai has strong support for higher-order functions? I know its metaprogramming story is strong (and is similar to Zig's compile time programming, if I recall?), but I haven't seen anyone talk about functional programming paradigm support in Jai.
The proper way of learning yep also more fun
I don't know about the higher order functions tho, I'm not that involved yet
15:20 I tend to just check if it is down in the event loop and just have some variables with booleans and just set them on/off using that.
For example:
if event.key_code == {
case #char "W"; move_up = xx event.key_pressed;
case #char "A"; move_left = xx event.key_pressed;
case #char "S"; move_down = xx event.key_pressed;
case #char "D"; move_right = xx event.key_pressed;
case .SPACEBAR; jump = xx it.key_pressed;
}
Another way of doing it that I think Jon is doing is to call out to different functions inside the event loop so you for example have a function for handling player events, etc.
for event: events_this_frame {
player_handle_event(event);
// ...
if event.type == {
case .QUIT; isRunning = false;
case .KEYBOARD;
if event.key_pressed if event.key_code == {
case .ESCAPE; isRunning = false;
case .F11; // fullscreen stuff
}
}
}
Seems quite coupled with the update loop of the engine tho. But maybe that's good?
Looks like Jai (2014)will remain in close beta for another 10 years meanwhile ODIN (2017) is going full steam ahead with real time game rendering.
I will try out Odin soon, but it sounds really good man
Hey! I'm enjoying Jai as well and find it very efficient to work with. I still would like a few more syntax sugar things like struct methods or 2d array overloads.
I'm currently in process of making a video on Jai + Sokol but it's taking me a very long time, the project is ready but editing the video is very time consuming.
Good luck to you and your game! Be sure to port it over to Jai. And I think Sokol might be actually a nice choice for your game.
Stoked for this!
Subbed, waiting for that jai vid
@@MenkoDany thanks guys!
gamedev graphics library should not be a part of any standard library. it's just too volatile, and its entire pipeline keeps evolving much faster than any language can ever hope to maintain.
even first party graphics libraries like vulkan constantly suffer from "we're evolving too fast" problems. building a language with built-in vulkan support is a non-starter.
I've never used c++ but started to learn c recently... Your first statement about the nested for loops... Can't you use a goto statement to break out of the inner loop?
indeed.
Yeah you can use go-to, bot I found that it makes the code harder to read unfortunately
you can absolutely do that, and its common practice when working on kernels or drivers.
I just want JBlow to release it already ;_;
Don't worry, it will be out in 3023 👍
@@Cakez77 how did you get into the beta? Just emailed jblow? I would email him but I'm scared of rejection since I work in the financial sector now and the last game I worked on was before 2020
@@Cakez77 there are any way to try Jai before 3024 ? please..
Would be interested in your opinion on Odin, whcih is publically available.
Okay looks like that is what I'm doing next
fun fact, you can do this
foo := (a: int) -> int { /* ... */ }
which essentially is a function pointer thing, and to make a function pointer with no default function you do something like this:
foo : #type (int) -> int;
Oh god, will the js brainrot of always making pointers to anonymous functions spread to jai?
@@Jutastre Just because you can do something, it doesn't mean that you have to do it.
Also, function pointers is a thing in a lot of languages, not just JS.
Btw, C++ has this: auto foo = [](int a) { return a * 2; };
Jai just has a nicer way to do it.
So you can have a function that can't be reassigned inside a function:
foo :: () {
bar :: () {
}
bar();
}
or you can make it so it can be reassigned
foo :: () {
bar := () {}
baz :: () {}
bar();
bar = baz;
bar();
}
Pretty good video as it gives an idea how it would be to use Jay language
I like the pronunciation J-eye as in Chai. Jai just jives with me.
It's just how I say it lol, most be my German seeping in
LOL from every one of C++ terrible problems, this dude really went for "you can't quit a double for loop" c'mon dude that's a simple goto statement
Who will come on top Zig || Odin || Jai
Haven't tried the other two, but Jai was really good
My bet's on Zig, and it's not even close imo. I think the other two are *waaay* farther away from hitting any sort of critical mass.
What makes Zig so good?
@@Cakez77 @delphicdescant i guess so just for the case that it comes with c/c++ compilers and build system so like we already have big code base that cant be rewritten so they might try the build system as a start then might start using zig along with their prev code base thats where Zig even comes on top of Rust its just its not yet prod ready v1
@@Cakez77its comptime Feature and low-level-support (combined with the ability to use C Code)
I really like jonathan blow and this langage
Randy is programming Arcane in jai, really recommend his channel, he’s a fun guy
I'm actually watching his videos on that yeah, been a lot of fun
What videos are these? Would love to see more.
Would love a link to his channel.
I found channel by name randy who is a game dev but his videos are shorts and more show case oriented than programming.
Actually you can break from two for-loops easily by just one simple `goto` statement (And yes goto isn't that evil just like anything else)
The Jonathan Artificial Intelligence language for videogames.
What about Odin Lang? can you compare them, odin, C++ and Jai
Yeah, thanks for the suggestion. I will try out Zig and Odin too and then make a comparison
I’d bet the explicit char call in the character binding has to do with UTF encoding and languages. Keys like esc or return are common keyboard keys where’s as letters are language dependent. Not my speciality but that was ringing some Go similarity bells in my head
I wonder how he achieved those build times in less than a second.
Yeah me too, I think it's building it as a unity build internally. I get similar build times with c++ where using unity build
There are 3 main reasons for this: 1) comparing to c++, jai is designed much easier to analyze (especially metaprogramming part) 2) it doesn't do a lot of crazy optimizations stuff, that gcc does and instead gives user easy way to optimize their code with "modern" techniques like allocator switching. 3) there are no incremental building by default
You can return multiple values in C++ with structured bindings.
Amazing
As someone writing large projects in Zig already, it's going to be much more difficult for a language like Jai to pull me away than it would have been to pull me away from C++...
Sounds interesting, what makes it so good compared to c++? Maybe I should really try it out
@@Cakez77 the c/c++ interop alone makes it one of the best languages for people coming over from the (C)lan
i agree... with zigs interoperable nature with c and how EASY you can port in the raylib c library... Honestly why bother with learning another language...
I agree. With Zig out to replace C, Odin aimed at game dev, and Nim being so amazingly easy, fast, and compiling to C/C++, Objective-C, and JavaScript, Jai is late to the party and really has to stand out to gain traction.
There's no difference in Jai. You can use any C library and even generate bindings automatically @@ev3rybodygets177
It's really hard to understand the people waiting for Jai release if Odin lang is ready ...
I will try out Odin soon, I wonder if it's good
@@Cakez77 Odin took a lot of inspirations from jai, the first thing that you would notice is how similar the syntax is.
Also Odin is used in production, there's this company called gangafx which Bill (odin creator) work in, wrote its flagship real-time volumetric fluid simulation tool in Odin, EmberGen, they also WIP two new software, GeoGen for terrain generation and LiguiGen for liquid simulation.
EmberGen used widely in Hollywood and some game development studies use it too.
The answer: yes.
We will see, seems like there is Zig as well
Wait, were able to set woosync in the end?
Im not into making games but Im into repacing c++ could it be used for general programming?
I would pay money to see JBlow react to the first 10 seconds of this video lol
Would the intro trigger him? :O
@@Cakez77He advocates that C++ is a really terrible language, but it does somethings right that most other languages fail to do, so that's why we use it in games. This comes in complete contrast with your opening statement lol, and then you go on to say that it has some problems and the first thing you mention is that yoi can't break out of 2 for loops, and i laughed because he would consider this reason such a trivial not even worth mentioning shortcoming of the language, that's why I said it lol.
You may want to watch his 2018 talk "Jon Blow's Design decisions on creating Jai a new language for game programmers", I find that interesting
J is a programming language.
Jai is also a programming language.
J is pronounced "J". Jai is pronounced "J-eye"
4:45 I didn't expect to see my example code thing for OpenGL in Jai here lol.
... it's weird to see people use my code to learn themselves... but it's nice too.
oh lol it was your code? Well yeah it was very helpful to get started. In my opinion it should be part of the examples
so how exactly do i get access to Jai? i've wanted access for like half a decade at least lol
You have to ask Jonathan Blow for access. Write him an E-Mail with who you are and what you would like to do
@@Cakez77 Is that how you got access? My impression is that most get access by getting a key from someone already in the beta.
@@benjaminpedersen9548 I litteraly just asked Jon by email and got into the beta. Most people just don't go that far so it seems to be enough. At least at the time it was
Can jai be used for mobile?
The goal is to support mobile, but as it stands I don't think it's supported
Try odin sometime, its like jai at some point
Second time I hear this, will do yeah. Sounds interesting
Jai is the most based lang we've got in recent years
What is the software appears at 11:16 minutes
Oh, it's called RenderDoc, it allows you to inspect graphics applications
Thank you
@@Cakez77
@4:04 looks like you didn't clone the repository recursively
It's just a .zip file to download. As far as I know there is no "cloning"
@@Cakez77I guess they meant to use the command `git clone --recursive`
You should try odin next, its like jai too
I have never heard of it, 🤔
@@Cakez77 Odin is more ergonomic than Zig and also has inbuilt features that makes it easier to do gaming, VFX type development. Odin has the best error handling when compared to Zig, Go(and even something fancy as Rust) according to Rickard Andersson who was so impressed by the language and how the features work together that he made a whole Odin programming playlist on youtube.
C++ and javascript had a baby, but after a few years, it was found out that the real father is python
If I watch enough of these videos on Jai, eventually I might just write a compiler for it and release it before Jon Blow does. Although, I do think he went in the wrong direction with a lot of the constructs. I don't like the way he handles switches, both the casing syntax and breaking versus falling through. The Pascal style typing has gotten out of hand with newer languages, and the way he does constants. I don't like the import syntax, especially if it requires those quotes and doesn't allow for a comma separated list. The fact that it does allow namespacing a given import is cool, but the way it does so annoys me. I went in a lot of completely different directions than he did for my own language. If he doesn't release Jai before I release my own language...
"you get modules which are the C++ libraries"
"that are otherwise very difficult in C++ without a library"
"that is a huge benefit of Jai"
what????
Returning a tuple with a success bool. Almost an Option/Maybe type from functional programming. So close, but alas. :)
You can implement your Option/Maybe using a struct with an enum or bool and a polymorphic variable inside, and some functions if you don't want to check it manually.
"you can't break out of two for loops easily"
Goto: "am I a joke to you?"
i also thought about this
How can one get access?
Broz there not language called "J"
Keegan Mission
Monica Cliff
Nolan Ville
Is it really cross platform?
Yeah
@@Cakez77 damn, that's impressive. I simply MUST get access to the beta to try for myself
They borrowed good things from Golang
And those things would be? Never tried golang
Golang is garbage collected. Just stop
Why do you call it Jay?
Because that's how I say it? Dunno
I don't know about calling C++ "great"... It's mid at best. Header files and needing forward declaration at this point is only pain.
0:08 goto???
Friesen Spur
dynamic laguages should be illegal
Not reading the docs and just jumping into it is even more German than your accent.
Lol
15:04 lmao wtf
Jai! Not J,
Ja-eye
Lol
If an ability to create a window in a one line is a single plus it's not a very good language TBH. sdl/raylib/whatever allows to make it in any language in more cross-platform way. At this point I think the whole video is big fat sarcasm rant about jai forever beta.
Lol 😂 I mean for me it is. The good thing is that the library is maintained by Jai and not a third party to that you have to add manually. That's mostly my point
That is not the main point of the language. The metaprogramming and compile-time execution features plus a bunch of smaller design decisions are the big selling points. Honestly, I think the in-program build system is a huge deal.
Like the idea, not a big fan of the syntax
C++ is outdated and needs to die or evolve but nobody wants to do it. The games industry is so held back by still using C++.
what why
@@richardcsernus6845 because its outdated? Sure its fast as hell bu its only getting more complex as people update it. Its still a needlessly abstract language that while others are slow still do garbage collection and other features that C++ does not. the games industry for example could migrate to another language and people wouldnt knwo the difference. Having to rely on strict memory management like before isnt needed anymore when you have game engines that do it for you.
what do you think about rust ? I think that language can replace c++
I think the problem of rust is the borrow checker but I have never used it so I have to try it first to know for sure
@@Cakez77 Garbage collection vs borrow checker.
@@TheBlackMaster Its not GC vs BC. I actually have a language idea in my mind that does not do borrow checking, but neither GC and in memory safety its not as good as rust, but handles 99% of cases (and only error in remaining 1% if you are noob) - all while its much-much more simple and let a lot of valid and safe programs through that rust does not.
For me rust is so much productivity pain for useless gain (I do not make those issues anyways in modern cpp) that I rather use modern C++ and code faster...
Nah, this language is way too incomplete at this point in time.
I'll check it out in 10 years.
I admire you for challenging Blow with these videos. There's a lot of worshippers who just follow every idea he comes up with and it's pretty dangerous.
Really, walrus for assignment. Yeah, no thanks
It's pronounced jai, like with more of an "i" sound.
9:44, I hate any char separating the variable name and its type, specially if it requires pressing shift. I won't even use Carbon, if they won't change that s** syntax! However, the if with no ( ) was nice. Does this hit compilation time?
Well, the developer's own machine compiles 250,000 lines per second and he wants to hit 1 million once it is more feature stable.
Still don't see the point.
jai was "released" in beta 4 years ago and it's still vapor.
a huge number of what would have been jai adopters have already gone to odin and zig.
But they could come back if the language is good when it releases, you never know
@@Cakez77 I think it would have to be a lot better than what they are currently using to entice them to make the switch. and honestly from what I've seen it's not better than either of the two I mentioned.
Assuming Jon Blow even wants such attention like that
If you've ever followed *any* of Jon's projects you'll know he doesn't rush things out to beat the competition. That's not his strategy and never will be. He doesn't care about winning the short-term race, he cares about making the best goddamn language he can, and so far, he's doing a pretty fine job of it IMO. But yeah.. it totally sucks that not everybody has easy access to it, and I can understand how it feels dead if you're not in the beta and getting the weekly release notes of the insane amount of stuff being improved and changed. He's also the CEO of a company that's building quite a few other projects right now (Braid: Anniversary Edition just got a release date announced, and he constantly streams his Sokoban game's development on twitch, plus other, yet-unannounced projects). Building great things takes time.
@@dandymcgee zig and Odin aren't being 'rushed' either, yet those are two great products that are on par or better than jai that people can use right now.
the reason jai isn't out now is because Jon is an elitist and his ego can't take getting criticisms, or suggestions from people he considers to be beneath him.
Nope, it will not replace C++
test comment
Confirmed
Anderson Jeffrey Garcia James Robinson Larry
Without evaluating at its technical merits, Jai is just another ugly language. The double if just looks and feels wrong. Beauty in construction yields excellence in performance and quality.
simp module 😂😂 !r
KEKW
it is not jei bro
You can jai deez nutz bro
Jones Dorothy Thomas Anna Jones Robert
I don't really see the point of Jai at this point. Zig and Rust are more likely to be C/C++ successors. Zig gets rid of many warts of C(no more weird macros or operator overloads), while Rust puts correctness first(basically no runtime errors/asserts/seg faults 99% of the time, for the cost of it being more opinionated). Jais's huge "sell" being that it ships with some dependencies is kinda weird when any modern language has a package manager, but basically any language has something like "Simp".
Gonna try Zig and Rust to see for myself, but I have heard bad things about rust compilation times.
@@Cakez77 The people who are complaining about the compile times are the people who pull in hundreds of dependencies. A game written in pure OpenGL and with the Windiows-API compiles in 0.5 seconds for me.
I think Rust and Jai aim for different things. Rust ensures program correctness at the expense of compile-time. Jai ensures fast compile-time at the expense of program correctness. One thing that is very powerful about Jai is it has powerful reflection capabilities - you can write Jai code that dynamically reads the output of the parser and makes adjustments to it before the code is compiled. This means you can very easily write code-generators in Jai for generating boilerplate for you. Rust and C++ at the moment don't support reflection like that.
@oscarsmith-jones4108 Wouldn't it be possible in Jai to write static compile time checks that enforce safety in a targeted way so that new devs don't break project-specific rules? For the really hard problems this means static checks and project-specific rules can be enforced that even rust cannot do but with fast compile times.
It will forever be in closed beta 🤣
yeah it could be lol
As one of the participants said (maybe it was tsoding, but not sure): "instead of ending the closed beta, it will just grow enough so everyone who interested will have access"
@@cyanmargh I was interested, 5 fkng years ago, never got access. Now I'm all about Rust anyway so who cares
see windows 10... dont care
My biggest gripe with Zig, Odin and Jai is their left-handed variable type declaration and also type inference being the default. Makes readability so much worse.
It's definitely switch up yeah. Takes time getting used to
@@Cakez77 It's not even that it's a readjustment - it has been proven that it is actually worse for readability to have types right aligned instead of left like C. Why? Because your brain can parse the types of whole blocks of variables much faster that way, without even having to read them. Here's a basic example with just some primitive types:
float myFirstFloat
float mySecondFloat
float myThirdFloat
int someInteger
int breaksNamingConvention
bool someCondition
string someText
Compared to:
myFirstFloat float
mySecondFloat float
myThirdFloat float
someInteger int
breaksNamingConvention int
someCondition bool
someText string
As you may be able to tell, finding a specific variable of a specific type is much harder this way. In the case of primitives specifically, there's actually a funny thing where they are all (mostly) have different name character lengths, making them *even easier* to parse when they are aligned in a block like one would do in C:
int (3)
bool (4)
float (5)
string (6)
That's why, as someone who really needs and wants this code readability as I have poor eyesight, this "trend" in many modern languages to change this is genuinely extremely frustrating.
The over-use of type inference is similarly annoying, as understanding what a block of code does and what types it has gets much harder when they aren't explicitly stated anywhere - I mean, try reading a python script and understanding what any variable's type is.
Thanks for coming to my TED Talk.
@@nolram That's a lot of nonsense. The type is rarely important, and if you can't infer it from the context, your code probably sucks. Using Python, a dynamically typed language, as an argument for type inference in a statically typed one shows a clear lack of experience/knowledge.
@@Giga4ever Well, a dynamically typed language is just an extreme example to visualise the point.
Types in statically typed languages ALWAYS matter, especially for readability of code. Knowing what data your code operates on is key - there's very few more important things. And "inferring from context" not only takes more time than just... seeing it, it also leads to less awareness, and especially in larger codebases you can't rely on knowing the context.
Using explicit types makes code more readable and faster to parse and is superior in almost every single scenario. You read your code more than you write it.
That's not readability being worse it's just how used to it you are.
WHAT IS YOUR CHAT FONT 🤮