[video output=day356 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Making the Debug System CLANG Compatible" vod_platform=youtube id=q_FIMxta6zo annotator=Miblo] [0:31][Set the stage for the day with a few words on compiling for multiple platforms] [3:20][Determine to make the debug system compatible with CLANG] [5:48][handmade_debug_interface.h: Explain the RecordDebugEvent() and DEBUG_NAME macros] [8:59][Describe our problem and demo string concatenation] [14:06][Consult the GCC documentation (see Resouces, GCC Manual)] [14:52][handmade.cpp: Demo the difference between GCC's and Visual Studio's implementations of string concatenation] [17:28][Consider how to workaround the problem] [26:07][Consider adding support for constant string concatenation to CLANG] [27:04][handmade_debug.cpp: Reacquaint ourselves with the code] [28:33][4coder feature request: A standard way to send a platform message to 4coder in order to jump to a file at a given line] [31:16][handmade_debug.interface.h: Consider having two versions of UniqueFileCounterString__()] [34:25][handmade_debug_interface.h: Add Name to the debug_event struct and make BEGIN_BLOCK and END_BLOCK take it] [41:46][handmade_debug.cpp: Change DebugParseName() to take a ProperName] [45:34][handmade_debug_interface.h: Make the TIMED_BLOCK macros take a Name] [46:52][Run the game to see what that produces] [48:47][Step through DebugParseName() and inspect what it does] [50:31][handmade_debug.cpp: Make GetElementFromEvent() set a Name rather than NameStartsAt] [52:48][handmade_debug.cpp: Make DEBUGInit() set the Name] [54:04][Run the game and see what we're recording] [54:54][handmade_debug_interface.h: Ensure that everyone is passing the correct information down] [57:30][Inspect the assembly for the debug system during the cutscene rendering] [1:02:47][Step through GetElementFromEvent() and StoreEvent() to see what they do] [1:05:47][handmade_debug.cpp: Make DEBUGEventToText() use our newly passed Name and run the game to see what it produces] [1:07:41][Determine that we've solved our problem and close the issue] [1:11:22][Run the game and assess our situation] [1:12:48][Determine to fix the camera tracking] [1:15:03][Step into UpdateCameraForEntityMovement() and investigate why the player is never being found by EntityOverlapsRectangle()] [1:23:47][handmade_sim_region.cpp: Make UpdateCameraForEntityMovement() test on IsInRectangle() rather than EntityOverlapsRectangle()] [1:28:12][Step into UpdateCameraForEntityMovement() and receive a positive result] [1:29:46][handmade_sim_region.cpp: Make UpdateCameraForEntityMovement() record the RoomDelta differently] [1:32:50][Run the game and find that the camera is incorrectly positioned] [1:33:35][handmade_sim_region.cpp: Make UpdateCameraForEntityMovement() correctly set the RoomRelP, run the game and find that it's having trouble snapping back] [1:34:48][handmade_sim_region.cpp: Change UpdateCameraForEntityMovement() to snap to the room centers] [1:37:02][Run the game and find that the camera snaps correctly] [1:37:33][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() to interpolate between camera positions] [1:38:29][Run the game to see that it correctly interpolates between camera positions] [1:38:54][Consider supporting differently sized rooms] [1:39:50][handmade_world_mode.cpp: Make AddStandardRoom() take RadiusX and RadiusY in order to create variably sized rooms] [1:48:13][Run the game to see that we're creating rooms as we were doing] [1:48:38][handmade_world_mode.cpp: Enable AddStandardRoom() to align the rooms and support different radii] [1:53:07][Run the game to see what that does] [1:53:36][handmade_world_mode.cpp: Try changing the sizes of the rooms] [1:55:08][Run the game to find that we have different sized rooms] [1:56:11][handmade_world_mode.cpp: Enable AddStandardRoom() to know the sizes of abutting rooms] [1:58:32][Run the game to see our variably sized rooms and consider making the camera zoom to correctly frame the rooms] [1:59:26][Q&A][:speech] [2:00:29][@zilarrezko][Hey Casey, is anyone planning on doing a more boiled down version of Handmade Hero, to take apart the game and give a breakdown of the aspect of each system in the project?] [2:01:13][@Miblo][Or make the camera pan within the room?] [2:01:33][@highergravity][Long time archive viewer, but first time live streamer! I have two pre-stream questions but I can never make the pre-stream time. 1) Do you have a strong opinion about why int *p is "superior style" than int* p, or are you impartial to whatever the developer prefers?] [2:02:12][Demo: Pointer declaration style] [2:04:40][@highergravity][2) Do compiler optimisations (-O2) guarantee that the same output is generated for time-independent code? That is, does the out-of-order processing ever introduce some nasty logic / contol flow bugs that -Od wouldn't?] [2:08:01][@mtsmox][You said you didn't want to use PRETTY_FUNCTION because that wouldn't work because of duplicate GUIDs. But the only place where PRETTY_FUNCTION would have been used is in TIMED_FUNCTION, which should never be used more then once in any function anyway. So not using DEBUG_NAME in TIMED_FUNCTION would solve the problem. All the other calls to TIMED_BLOCK_ would still work with DEBUG_NAME and thus use the COUNTER to be unique. So I think the extra field for the Name is really not necessary.] [2:08:55][@zennmystic][You talked about GCC / CLANG at the start. To be clear, you will be dropping visual studio at some point?] [2:09:43][@linike860][What is your opinion on Minkowski Portal Refinement for collision detection and response? I feel it is much nicer as it gives you much of the collision information (normal, depth, etc.) without having to implement an entire separate algorithm like GJK does] [2:10:26][@zilarrezko][Have you tried -Ox for optimizations? I believe it gives even faster code (it's a fast hand for multiple optimization flags, I believe)] [2:12:36][@garryjohanson][I would like to cast my vote that we should do the slides some day] [2:12:57][@tukimitzu][How long do you think it will take for JAI to take over the C++ space in the game industry? It's not even out yet and I can already say that language is the best thing ever designed] [2:14:54][@ray_caster][Are you using SDL? If not and, assuming the answer isn't just "everything needs to be hand-made", is there another reason? What are your thoughts in general on SDL?] [2:17:50][@zennmystic][I guess what I was really asking was will you be dropping it?] [2:19:02][@azmreece][Do you have any thoughts on when to use multiple threads? Is the answer any more in depth than "when single-threaded isn't fast enough"?] [2:21:26][@tuxiak][Do you still have a TODO list like you used to? Could you show it? I'm still on Day ~110 with the videos] [2:21:51][Wrap it up][:speech] [/video]