cinera_handmade.network/cmuratori/hero/code/code207.hmml

76 lines
6.7 KiB
Plaintext

[video output=day207 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Using Introspection Data" vod_platform=youtube id=3_7IMU6l6Pc annotator=Miblo]
[1:46][Recap and set the stage for the day]
[4:06][simple_preprocessor.cpp: On understanding the contents of structs]
[7:31][simple_preprocessor.cpp: Make ParseMember take StructTypeToken]
[9:11][Run the preprocessor and see this new information]
[9:55][build.bat: Pipe the output of the preprocessor to handmade_generated.h at compile time]
[11:13][Describe ths metaprogramming workflow]
[11:40][handmade.h: #include handmade_meta.h]
[12:00][handmade_meta.h: Introduce member_definition and meta_type]
[13:48][handmade_meta.cpp: #include handmade_generated.h and #include this file in handmade.cpp]
[14:38][handmade_generated.h: Mention the fact that once this is generated, we always have it]
[15:19][handmade_debug.cpp: Set some values and print them out using DEBUGTextLine]
[22:18][Debugger: Run the game and see these debug values]
[23:15][handmade_debug.cpp: Introduce DEBUGDumpStruct]
[24:58][handmade_sim_region.h: Make sim_region introspected]
[25:46][handmade_meta.h: Add the types in sim_region to meta_type]
[26:24][handmade_debug.cpp: Set these values of sim_region and print them out]
[27:25][Run the game and see the sim_region printing out]
[27:47][handmade_generated.h: Note that new types have to keep being redefined in handmade_meta.h]
[28:28][handmade_math.h: introspect rectangle2 and rectangle3]
[29:10][simple_preprocessor.cpp: Process handmade_math.h]
[30:11][Run the preprocessor and see that these rectangles are now defined]
[30:45][handmade_debug.cpp: Show what we otherwise would have to do to define a new type]
[31:55][Run the game and view those rectangles]
[32:08][handmade_debug.cpp: Use the meta generator to define rectangle3 for us, and manually define MetaType_v3]
[35:47][Run the game and see our debug output]
[35:58][handmade_debug.cpp: Discuss ways to get this code generated for us]
[37:48][simple_preprocessor.cpp: Introduce meta_struct to enable us to keep track of structs seen]
[41:51][simple_preprocessor.cpp: Printout #define META_HANDLE_TYPE_DUMP and loop over the Meta structs]
[45:11][simple_preprocessor.cpp: Take a look at how this injection works]
[46:01][Run the game and see all of this new stuff being printed out]
[46:14][handmade_debug.cpp: Add the concept of an indent level]
[48:50]["There's nothing worse than a whiny C compiler"][quote 277]
[51:29][Run the game and see our newly indented output]
[51:52][simple_preprocessor.cpp: Print a line to tell us what the member was]
[52:38][Run the game and look over our generated debug information]
[53:20][handmade_world.h: introspect world_position]
[54:47][simple_preprocessor.cpp: Process handmade_world.h]
[55:02][Run the game and see the entity printout]
[56:24][handmade_sim_region.h: introspect everything]
[57:39][Run the game and notice that pointers aren't handled correctly]
[58:36][handmade_meta.h: Introduce member_definition_flag]
[59:14][simple_preprocessor.cpp: Recognise pointers]
[59:46][handmade_debug.cpp: Dereference a pointer and skip printing it if it's null]
[1:00:43][Run the game and see it starting to make more sense]
[1:00:55][handmade_debug.cpp: Set TestCollisionVolumeGroup parameters]
[1:03:01][Run the game and see this information]
[1:03:13][handmade_debug.cpp: Set another lot of values, but note that the generator does not know how to handle them]
[1:03:47][handmade_sim_region.h and handmade.h: Introduce counted_pointer]
[1:04:43][simple_preprocessor.cpp: Note that the parser must be aware of how to handle these counted pointers]
[1:05:20][On building on our knowledge to progress from basic introspection to metaprogramming]
[1:06:24][Q&A][:speech]
[1:07:22][@ChronalDragon][So when you say you've built up multiple layers of metaprogramming, do you mean your metaprograms output things like what we wrote today?]
[1:07:59][@nxsy][Isn't offsetof fairly safe to rely on with remotely recent compilers?]
[1:08:26][handmade.cpp: Try using offsetof]
[1:10:25][@blah238][Someone said that the string function you were looking for was called strdup]
[1:10:43][@garryjohanson][In the episode of the Jeff and Casey Show "The Wolf Doesn't Want to Come Anymore" you mentioned that you use metaprogramming techniques to make up for modern language shortcomings. Curious what functionality you have used metaprogramming to achieve that you would have found prohibitive in modern languages? Can you suggest any specific usages to pursue for either program robustness, optimization, etc.?]
[1:12:25][@ChronalDragon][To rephrase, are your "multiply layered" metaprograms outputting further metaprograms? Or is it a single layer that has enough complexity to be considered more than a single pass? (Not sure how to phrase, I was mostly trying to prompt further discussion of what you've mentioned previously)]
[1:14:04][@JamesWidman][Odd... offsetof is defined in MSVC's <stddef.h>, and is specified in C '89 as belonging to that header... Did I miss something?]
[1:15:12][Debugger: Use the test project to Go to Definition of offsetof]
[1:17:09][@binjimin][Based on what Jonathan Blow has so far, do you think JAI will have the metaprogramming capabilities that you'd want? If not, what do you think it is missing?]
[1:18:23][@paulsm1th][You said in a previous stream that you don't really program in C anymore, you basically program in "Caseylang". Does that refer to your metaprogramming tools or is there more to it than that?]
[1:18:38][@d7samurai][You're not using header files for OpenGL / Direct3D?]
[1:18:48][@sjohn_c][Have you worked with any functional languages? Haskell or maybe Scala?]
[1:19:25][@blah238][Maybe a bit off topic but going along with the Master Spy thing, have you ever done a stealth game and, if so, what particular programming challenges do stealth mechanics bring that you don't usually have to deal with?]
[1:20:54][@Stephenlast][Is the syntax of Casey-Lang still very close to C?]
[1:21:09][@insofaras][Your metaprogramming tools sound very useful, will you ever open source them, maybe in your will if nothing else?]
[1:22:08][@Shoozza][Will you write your own installer for Handmade Hero? Or just zip it and be done with it?]
[1:23:24][@boondoggle42][How about writing a Casey-Approved GUI debugger for Jai?]
[1:24:15][@JamesWidman][I'm looking forward to additional visualizers in the debug view (e.g. a small grid view with a dot or line from (0,0) to represent a v2 along with the decimal digits). Do you think that would be worthwhile?]
[1:25:28][@garryjohanson][Do you ever metaprogram the sims stuff and the job queue?]
[1:27:31][@vSealos][Is there any feature you would add to Jai?]
[1:30:58][Close it down][:speech]
[1:33:14][Announcement: F2P discussion between Casey and Shawn McGrath on Thursday][:speech]
[/video]