hero/code022: Full modernisation pass

This commit is contained in:
Matt Mascarenhas 2019-01-01 00:00:18 +00:00
parent 9b3230e1ea
commit d84bd19364
1 changed files with 94 additions and 31 deletions

View File

@ -1,33 +1,96 @@
[video 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] [video 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]
[2:30][Recap, and cleaning up DLL creation code] [0:02][Recap and set the stage for the day][:speech]
[7:25][Trying to set the name of the .pdb file] [2:22][Remove DllMain() and successfully recompile][:"hot reloading"]
[9:35][PDBPATH and setting the name of the .pdb file for handmade.cpp] [3:28][Demo :"hot reloading", and determine to reduce the update lag and enable debugging of it][:run]
[15:10][Found the command, now Setting random file name with %date% and some crazy batch syntax] [5:58][Visual Studio .pdb unloading][:speech]
[19:00][making DEL less intrusive, by piping output to a file] [7:00][Try using cl's -Fd flag to output the .pdb to a different location, without success[ref
[24:00][making the reload of the .dll faster] site="Microsoft Docs"
[35:00][Compare File Times] page="/Fd (Program Database File Name)"
[39:49][Finding the the dir of the executable so we can find the .dll] url=https://docs.microsoft.com/en-us/cpp/build/reference/fd-program-database-file-name?view=vs-2017]]
[50:25][String Processing Code] [10:32][Try using cl's -PDB\:filename linker flag to output the .pdb to a different location, successfully[ref
[1:01:25][Q&A][:speech] site="Microsoft Docs"
[1:02:24][Question: How do you manage to time your coding so perfectly] page="/PDB (Use Program Database)"
[1:02:34][Question: You mentioned yesterday you had something from a previous days but never did] url=https://docs.microsoft.com/en-us/cpp/build/reference/pdb-use-program-database?view=vs-2017]]
[1:03:31][Question: Will this capability be in the shipping game or will it only be for debuging] [11:16][Set the .pdb location using a batch file invocation of %date%]
[1:04:15][Question: Does the reload of the dll reset the game] [16:59][Test out :"hot reloading" to find that we create many .pdb files][:run]
[1:05:07][Question: How much time have you spent planning this game prior to even starting on day 001] [18:26][Suppress the output of del by piping it to a file]
[1:06:43][Question: Are you building the game in two sections, Games layer and a Platform layer] [20:29][Piping stdout and stderr][:speech]
[1:07:21][Question: Since DLL's are not on linux or OSX how will we handle automatic reloading of the code] [21:42][Pipe both the stdout and stderr output of del to NUL, and disable incremental linking]
[1:08:13][Question: Why don't you use dynamic buffer allocation] [23:31][Find that our compilation output is more concise, and that we are :"hot reloading" in the debugger][:run]
[1:09:09][Question: You said that you are going to show us how to make a game well, what qualifications do you have for that] [24:15][Enable Win32LoadGameCode() to use the ftLastWriteTime to determine when a DLL update is necessary[ref
[1:11:16][Question: Could you expain your method of compressed programing in writing] site="Microsoft Docs"
[1:12:42][Question: When findFirstFile is called does windows actually read anything from disk] page="FindFirstFileA function"
[1:13:06][Question: One way to abuse the fact that the game is in a seperate dll is to open the game part up to modders and modders tools] url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfilea]][:"hot reloading"]
[1:14:03][Question: One common theme in the series so far is that you should not clearn up OS memory on shutdown but OS objects will possibly need to be cleaned up on DLL reload? correct?] [33:09][Find that :"hot reloading" continues to work latently][:run]
[1:17:09][Question: Are we going to see the process of designing the game] [33:34][Make WinMain() reload the DLL if it was updated, using CompareFileTime()[ref
[1:20:31][Question: Can you give some examples of code that won't play nice with the dynamic code reloading] site="Microsoft Docs"
[1:22:39][Question: Do you have any opinion on lua for a scripting language, config loading] page="CompareFileTime function"
[1:24:09][Question: Do you think this method of hot reloading of the code can be used in other types of software other then a game] url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-comparefiletime]][:"hot reloading"]
[1:25:01][Question: Do you think there is a case for DSLs instead of using C] [35:45][Try :"hot reloading" to find that it is now instantaneous][:run]
[1:26:20][Question: One benefit of lua is that you don't have to recompile] [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]
[1:26:45][Question: Is the game engine going to be generic or custom to this game] [39:49][Enable WinMain() to locate our .exe file using GetModuleFilenameA()[ref
[1:28:16][Question: Do I recommend C over C++] 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] [/video]