Game Engine Programming: Console commands, Cool metaprogramming

  Рет қаралды 25,922

Jonathan Blow

Jonathan Blow

Күн бұрын

Пікірлер: 41
@blackmaestros
@blackmaestros 11 ай бұрын
It’s interesting to revisit the earlier Jon’s streams and see how the game looked like back then.
@kalelsoffspring
@kalelsoffspring 7 жыл бұрын
Wow, seeing that compile time for 37000 lines of code was amazing. The metaprogramming support is awesome
@64jcl
@64jcl 6 жыл бұрын
Yes we need JAI now! :)
@snoophoggfan6873
@snoophoggfan6873 7 жыл бұрын
You are honestly my new favorite KZbinr. I could watch this all day. Keep up the good coding!
@deftlyhacked3494
@deftlyhacked3494 7 жыл бұрын
Creating a compiled programming language that executes your interpreted command language. #TrueSkill
@GiammarcoAgazzotti
@GiammarcoAgazzotti 5 жыл бұрын
Catching up really late on these videos. Really enjoying them. You are inspiring me to do such things for the game me and my team are developing, such a good inspiration! Keep up the good work man, nice job.
@ivanbraidi
@ivanbraidi 7 жыл бұрын
"English, DO YOU SPEAK IT??" -> Best commit message ever! XD
@dimarichmain
@dimarichmain 3 жыл бұрын
"Added add"
@markusiak1
@markusiak1 7 жыл бұрын
I simply love it! :) Jai is so cool. And these explanations. Oh my ;)
@UncoveredTruths
@UncoveredTruths 7 жыл бұрын
thankyou for streaming so much, im in the middle of nowhere with just my phone so this has been great
@crybirb
@crybirb 7 жыл бұрын
I'm a very bad programmer and I couldn't follow this project fully because I'm getting my CS degree, but it's so amazing to see a little snippets over the years since this project started and I'm very pumped to use it when it comes out.
@casvanmarcel
@casvanmarcel 7 жыл бұрын
this is so inspiring and makes me so happy
@DerMannInDerWand
@DerMannInDerWand 5 жыл бұрын
leaves: float Seems right
@Lagiacrus42
@Lagiacrus42 7 жыл бұрын
Hey, Jon! For code generation, would it be possible to include data structures and procedures in the standard library specifically for generating code at compile time, as opposed to dealing with raw strings? One issue with the C preprocessor is that splicing strings together results in inconvenient errors; it would be a lot nicer to substitute 'expressions' for example. If you think this is a bad idea, thoughts on why, and any alternatives you might have, if any?
@jblow888
@jblow888 7 жыл бұрын
Yes, I plan to have that kind of stuff; part of the reason I am doing these exercises is to figure out what would be good to put into the library. However, I will say that several people have suggested a more data-structure-oriented way of generating code by default (instead of strings) and I am not sure I buy it. The good thing about strings is you can see obviously when they are malformed. Arbitrary ASTs, not so much.
@AlejandroMartinez4
@AlejandroMartinez4 7 жыл бұрын
This has been really amazing.
@clankill3r
@clankill3r 7 жыл бұрын
This stream was f*cking awesome! This gave me so many ideas of how to tackle a certain problem I have without using tons of code. The only thing I would really like now is named return values (for metaprogramming). And multiple return values (now it only supports 2 return values I believe). @Jonathan Will it eventually be possible to return more then 2 values?
@jblow888
@jblow888 7 жыл бұрын
Actually you can already use an arbitrary number of return values. There's no limit.
@clankill3r
@clankill3r 7 жыл бұрын
damn, I love you so much :D
@skullfirec
@skullfirec 7 жыл бұрын
Thanks for this Jon. Love this concept! Would you consider moving things you need on the metaprogramming phase elsewhere? eg. getInteger, getFloat, etc. feels wrong to be both on the commands.jai (which depends on first.jai in some way) and first.jai will now depend on implementation of getInteger, getFloat on commands.jai. Or perhaps add a third file JUST for userbase commands, instead of mixing it up on the same commands.jai?
@jblow888
@jblow888 7 жыл бұрын
Well, first.jai does not really "depend" on those things in the regular sense used in programming languages, but it's true that if you change those routines then first.jai will be wrong. But you could pretty straightforwardly just put the procedure that generates the metaprogram into commands.jai itself, and just call into it from first.jai.
@videouploader1677721
@videouploader1677721 7 жыл бұрын
At 00:31:42, what if files/modules/libraries had an init function that gets called automatically by the entry point function/main (not sure in what order though) instead of having to manually remember to call these type of functions?
@jblow888
@jblow888 7 жыл бұрын
The problem with that is you run into problems, where you need to initialize things in a clear order in order for them to work, but automatic calls like that are hard to order. You see this problem with global constructors in C++.
@Raattis
@Raattis 7 жыл бұрын
Well, because that Start/Awake granularity is not always enough Unity also has option for explicit execution ordering. This whole thing is on a bit different level here when comparing programming languages to game engines.
@Pyromuffin
@Pyromuffin 7 жыл бұрын
Very cool. I am not too much a fan of building up compile time functions by adding strings together. Maybe you could have #directive that stringifies a regular function body and maybe some language keywords that work like % in format strings. maybe compile time function generation wont be so common that you'd want a facility for this, but it would be nice.
@zacpier
@zacpier 7 жыл бұрын
Well, I think the beauty of a system of this is that it doesn't require any special APIs or learning. I can look at the definitions of the structs that the compiler gives the code, and use the data to build a function just like I would write any other code. With any other system, you'd have to learn a special method of generating code, and since you don't have to metaprogram that often, you'd constantly be relearning the special syntax for this. I think string-based code generation is a nice compromise between power and sane programming practice.
@Pyromuffin
@Pyromuffin 7 жыл бұрын
i agree. i haven been thinking about this for a while since i made that comment and there's not really anything that will ever be as flexible as emitting strings. it definitely has to be an option to do it using strings. watching jon program, it's actually very different from how i program. i can't survive without intellisense (always work with huge code bases that i didn't write). if you don't need code completion to work then writing program strings isn't that much different than your regular workflow. it does sting to give up completion for compile time function generation however.
@TetraluxOnPC
@TetraluxOnPC 7 жыл бұрын
+Kelly MacNeill Jai also has "here strings" where you provide an arbitrary sequence of characters which serve as the sequence that terminates the string. e.g: X :: #string END f :: (i: $T) { return i * 2; } END
@mars3142
@mars3142 6 жыл бұрын
What would the best way to do that in C++? I mean, how can I generate the "front_" functions at compile time? Is that even possible without a custom preprocessor?
@64jcl
@64jcl 6 жыл бұрын
Most languages has some kind of attribute tag you can put on functions which is essentially a preprocessor thing. If it doesnt have it you can make your own using a comment above your function with a unique tag. Your preprocessor then "just" looks for these comment tags and parse the function definition, creating the front functions as well as the register stuff. If custom preprocessor functions is not supported by the compiler a simple shell/batch file can be called instead before calling your compiler to generate your code.
@dimarichmain
@dimarichmain 3 жыл бұрын
The best way is to abandon C++.
@GeorgeWulfers_88
@GeorgeWulfers_88 7 жыл бұрын
Awesome!
@needlessoptions
@needlessoptions 7 жыл бұрын
Hey Jon it's me the mememaster
@bigmofo1122
@bigmofo1122 7 жыл бұрын
You can inspect your global config value and do function call at any time from within the debugger. In-game console are for the users who want to tweak his experience. Why do a in-game console, and even take the time to make it good, if it's not 'user level' and will be compiled out when shipping? I understand that your home-brew language don't have good debugger. But from earlier stream you have shown that the Witness had a console only in the dev build. Why is that?
@Borgilian
@Borgilian 3 жыл бұрын
Because sometimes you want to print out data to a console (or modify debug data), and you don't want your project to spawn a child cmd.exe. Also windows terminals are slow.
@Awpteamoose
@Awpteamoose 7 жыл бұрын
Have you considered hooking up an existing scripting language and exposing functions/variables to it instead of making a console like that?
@TheMaginor
@TheMaginor 7 жыл бұрын
He said in an earlier video that that is overkill and the scripting language may do allocations that fragments the heap unnecessarily, which is bad on some platforms. When I think about it, that may have been in regard to loading variables from a file though.
@64jcl
@64jcl 6 жыл бұрын
I believe Jon's goal has always been to use the same language for everything, so the programmer only have to learn one language in order to do anything, including meta-programming. A lot of languages are just riddled with silly macro nonsense that looks totally unlike the actual programming language, or use some kind of magic tags everywhere that generate a lot of boilerplate behind the scenes. I believe Jon's idea is for the programmer to be more in control of whats actually happening and be able to read their own code at a later time as well as its written in the same language as the whole thing.
@Fan64Mario
@Fan64Mario 7 жыл бұрын
I always wonder: Is he going to implement the jai compiler in jai?
@martinmidtgaard
@martinmidtgaard 7 жыл бұрын
He has talked about it earlier, and he is not that interested in it currently. While the language is still in flux, he would have to change the compiler while changing the language. There is also not much to gain from writing the compiler in jai other than some sort of "achievement".
Game Engine Programming: Animation Groundwork (full version)
2:06:17
Jonathan Blow
Рет қаралды 21 М.
Game Engine Programming: Drop-Down Console
3:24:51
Jonathan Blow
Рет қаралды 37 М.
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 25 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 50 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 28 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,1 МЛН
Jonathan Blow on how an operating system should work
14:22
Anton Swifton
Рет қаралды 114 М.
Jonathan Blow Q&A Session Nov2017
1:51:18
Game Dev Graz
Рет қаралды 36 М.
Making a New Compiler
15:36
Modern Retro Dev
Рет қаралды 7 М.
How a Microcontroller starts
28:49
Artful Bytes
Рет қаралды 55 М.
Game Engine Programming: Animation Playback (part 1)
2:49:17
Jonathan Blow
Рет қаралды 13 М.
SOME UNIQUE C++ CODE! // Pacman Clone Code Review
26:42
The Cherno
Рет қаралды 289 М.
Creator of git, Linus Torvalds Presents the Fundamentals of git
1:10:15
Developers Alliance
Рет қаралды 152 М.
Code vs Data (Metaprogramming) - Computerphile
7:38
Computerphile
Рет қаралды 108 М.
Game engine programming: Mesh VBOs.
2:30:59
Jonathan Blow
Рет қаралды 32 М.
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 25 МЛН