[video output=day022 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Instantaneous Live Code Editing" vod_platform=youtube id=oijEnriqqcs annotator=dspecht annotator=jacebennett annotator=Miblo annotator=theinternetftw] [0:02][Recap and set the stage for the day][:speech] [2:22][Remove DllMain() and successfully recompile][:"hot reloading"] [3:28][Demo :"hot reloading", and determine to reduce the update lag and enable debugging of it][:run] [5:58][Visual Studio .pdb unloading][:speech] [7:00][Try using cl's -Fd flag[ref site="Microsoft Docs" page="/Fd (Program Database File Name)" url=https://docs.microsoft.com/en-us/cpp/build/reference/fd-program-database-file-name?view=vs-2017] to output the .pdb to a different location, without success] [10:32][Try using cl's -PDB\:filename linker flag[ref site="Microsoft Docs" page="/PDB (Use Program Database)" url=https://docs.microsoft.com/en-us/cpp/build/reference/pdb-use-program-database?view=vs-2017] to output the .pdb to a different location, successfully] [11:16][Set the .pdb location using a batch file invocation of %date%] [16:59][Test out :"hot reloading" to find that we create many .pdb files][:run] [18:26][Suppress the output of del by piping it to a file] [20:29][Piping stdout and stderr][:speech] [21:42][Pipe both the stdout and stderr output of del to NUL, and disable incremental linking] [23:31][Find that our compilation output is more concise, and that we are :"hot reloading" in the debugger][:run] [24:15][Enable Win32LoadGameCode() to use the ftLastWriteTime to determine when a DLL update is necessary[ref site="Microsoft Docs" page="FindFirstFileA function" url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfilea]][:"hot reloading"] [33:09][Find that :"hot reloading" continues to work latently][:run] [33:34][Make WinMain() reload the DLL if it was updated, using CompareFileTime()[ref site="Microsoft Docs" page="CompareFileTime function" url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-comparefiletime]][:"hot reloading"] [35:45][Try :"hot reloading" to find that it is now instantaneous][:run] [37:29][Try setting the Working Directory to the data directory, and find that Win32GetLastWriteTime() fails to find our .dll file][:admin :"hot reloading" :run] [39:49][Enable WinMain() to locate our .exe file using GetModuleFilenameA()[ref site="Microsoft Docs" page="GetModuleFilenameA function" url=https://docs.microsoft.com/en-gb/windows/desktop/api/libloaderapi/nf-libloaderapi-getmodulefilenamea]][:"hot reloading"] [45:44][Find that we get the full path][:"hot reloading" :run] [46:00][Truncate the path to the base filename][:"string manipulation"] [48:31][Step through our path truncation to show it all happen][:run :"string manipulation"] [49:52][Introduce CatStrings() for WinMain() to construct our .exe file path][:"string manipulation"] [55:25][Implement CatStrings()][:"string manipulation"] [57:49][Step through CatStrings() to find that it does what we want][:"hot reloading" :run :"string manipulation"] [59:44][Set up the new Q&A question grabber, and reflect on our :"hot reloading" improvements][:admin :speech] [1:01:21][Q&A][:speech] [1:01:45][Unseen :Owl of Shame moment on the chat machine][:speech] [1:02:24][How do you manage to time your coding so perfectly?][:authored] [1:02:34][You mentioned yesterday you had something you wanted to address from a previous day, but never did][:authored] [1:03:31][Will this capability be in the shipping game or will it only be for debugging?][:authored :"hot reloading"] [1:04:15][Does the reload of the DLL reset the game entirely?][:authored :"hot reloading"] [1:04:21][Demonstrate seamless :"hot reloading"][:run] [1:05:07][How much time have you spent planning this game prior to even starting on Day 001?][:authored] [1:06:43][Are you building the game in two sort of sections, one being core C++ section and the other being a platform service section?][:authored :language :"platform layer"] [1:07:21][Since DLLs are not on OSX or Linux how will we handle these in those environments?][:authored :"hot reloading" :"platform layer"] [1:07:41][@beepo][Did you list your qualifications in a previous stream? If not, what are they?] [1:08:13][Why don't you use dynamic buffer allocation?][:authored :memory] [1:09:09][You said that you are going to show us how to make a game well. What are your qualifications for saying you are making a good game, code-wise?][:authored] [1:11:16][Could you explain your method of compressed programming somewhere in writing, on the forum, maybe?[ref site="Casey's Blog" page="Semantic Compression" url=https://caseymuratori.com/blog_0015]][:authored] [1:12:42][When FindFirstFile() is called, does Windows actually read anything from disk][:authored :"file io"] [1:13:06][One way to abuse the fact that the game is in a separate DLL is to open the game part up to modders and modders' tools][:authored] [1:14:00][One common theme in these videos is that you shouldn't clean up OS objects or :memory on shutdown, but OS objects will presumably need to be cleaned up on DLL reload, correct?][:authored :"hot reloading"] [1:14:54][I wish you had a subscriber button, this is awesome. Are we in Q&A time right now?][:authored] [1:17:09][@firefly2442][Are we going to see the process of designing the game too, as in the game concept rather than the code?][:"game design"] [1:20:31][Can you give some examples of some types of code changes to the game DLL that won't work well with :"hot reloading"?][:authored] [1:22:39][Do you have any opinion on lua, such as using it for configuration or more comprehensive scripting?][:authored :language] [1:24:09][Do you think this method of :"hot reloading" can be useful for developing other types of software besides a game, like e.g. a mobile app or business system?][:authored] [1:25:00][Do you think there is a case for DSLs in some cases, instead of using C for the code, like for :AI?][:authored :language] [1:26:19][@panic00][One benefit of lua is that you don't have to recompile at all][:language] [1:26:45][Will the game :engine be mostly generic or tailored for this game?][:authored] [1:27:28][Could you talk about Larrabee and Xeon Phi?][:authored :hardware] [1:28:16][Do I recommend C over C++?][:authored :language] [1:31:17][As a beginning programmer, is Unity a good start to develop some basic games?][:authored] [1:31:58][You complain a lot about the Windows :API, but clearly other platforms aren't any better. What would your ideal, general-purpose platform look like?][:authored :"platform layer"] [1:32:16][Were there any personal projects that you had done prior to graduating high school / college that came in handy when looking for a job? How did you come to work at RAD?[ref site="Intro to C on Windows" page="Day 5 Q&A" url=https://guide.handmadehero.org/intro-to-c/day5qa/#3504]][:authored] [1:33:43][Do you think games can make use concurrency and parallelism more than it is now?][:authored :threading] [1:34:06][Where can I find the song used in the YouTube trailer?[ref author="Handmade Hero" title="Announcement Trailer" publisher=YouTube url=https://www.youtube.com/watch?v=A2dxjOjWHxQ]][:authored] [1:34:35][Can you show how to set keybindings in emacs?][:admin :authored] [1:35:47][What do you think of Blizzard as a game development company?][:authored] [1:36:58][Perhaps this question is better suited for the forums: What guidance can you provide for newbie game developers looking to find artists for their game projects?][:authored] [1:37:39][You mentioned on-stream :metaprogramming in C. What does that look like? Been dying to know][:authored :language] [1:37:53][:Metaprogramming in C][:language :speech] [1:39:52][@ambiguous_panda][You mentioned that you don't think you will make much of a profit from becoming a Twitch Partner, but you get 7× more viewers than some of the full-time streamers] [1:42:04][@telegraph_cable][Sorry if I missed it, but did you fix the expected-bytes-until-flip bug in the :audio code?] [1:42:37][Can you make a lot of money by C programming?][:authored :language] [1:44:31][Do you use :"hot reloading" in any of your non-game projects?][:authored] [1:44:41][Why do you think so few people learn this stuff?][:authored :engine :library] [1:50:09][I know some of your friends went to ArenaNet, but I can't stress how much Guild Wars 2 feels awful][:authored] [1:50:39][Call it here][:speech] [/video]