[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Implementing Self-Recompilation" vod_platform=youtube id=RQuVq1v2PkE annotator=Miblo annotator=debiatan] [0:07][Recap] [0:53][Plan for today] [2:32][Features and limitations of our current radial menu] [4:01][We will build our UI around the debug features we already have] [5:50][Let's find a way of turning debug features on and off easily from the debug interface] [6:31][Quick review of the debug camera] [7:20][There's a conflict between the reloading system and the debug event array collation] [8:33][Maybe we should flush all events after a reload] [10:12][Flushing the array event buffer] [12:15][The DLL reloading already cleared that buffer. We only need to restart the collation process] [14:00][Moving the ExecutableReloaded flag from the game input to the game memory] [14:59][Testing it] [15:39][The current way of switching between regular and debug cameras is inconvenient] [16:37][We would prefer to automate the process of changing the code and recompiling it] [18:02][We will collect all switches inside the globally accessible handmade_config.h] [20:03][Be banana-cakes][quote 256] [20:21][Assigning a type to config switches] [20:56][Rewriting the config file from inside the game code] [22:01][Implementing WriteHandmadeConfig] [23:31][We resort again to _snprintf_s to minimize the amount of CRT functions we will have to replace later] [27:22][Rewriting the config file after every debug UI action] [28:17][We want the game to recompile itself] [28:35][The platform layer will allow us to execute build.bat via DEBUGExecuteSystemCommand] [32:25][The OS function we are looking for is CreateProcess] [38:30][Testing it. It does not work] [38:46][CreateProcess returned false] [39:29][Using GetLastError to find out why] [40:31][Providing an explicit path to cmd.exe] [41:32][It works now] [41:42][Toggling the value of DEBUGUI_UseDebugCamera in the config file] [42:39][Introducing the Uber-Debug-UI!] [43:08][Getting rid of the compilation window pop-up] [44:20][Hiding the window using the wShowWindow flag inside the startup info parameter] [46:40][It works!] [46:50][Getting information about the state of the the compilation process] [50:00][We will use WaitForSingleObject to find that information] [52:54][Querying the platform layer about the state of the compilation process] [55:48]["We don't care big it is"][quote 253] [56:12][Implementing DEBUGGetProcessState] [58:31][Using GetExitCodeProcess to confirm the completion of the compilation] [1:02:05][Signalling the ongoing recompilation graphically] [1:03:21][Find that platform_api doesn't have DEBUGGetProcessState][quote 254] [1:03:38][Apologise for the slang][quote 255] [1:04:49][Q&A][:speech] [1:05:31][@powerc9k][Why be able to compile from the game if we can do it from the editor? Is it just to be cool?] [1:06:30][@ChronalDragon][Compile in mr4th's editor and do all of the game development work from in-game?] [1:06:51][@andsz_][I like how it's "STARTUPINFO", but "PROCESS_INFORMATION". Inconsistency even in a single small part of the WinAPI... Do such things annoy you in a "professional" API?] [1:07:33][@Mr4thDimention][Why are we writing to a code file instead of just passing -D to the build line? Seems like it would be a little easier, although I have to admit you made that look pretty easy] [1:08:24][@cubercaleb][Why not use system() instead of CreateProcess()?] [1:09:43][@glaman1605][Do you plan on reading the original config file and then rewrite with modified values?] [1:09:52][@TheSizik][Why not just set a boolean variable instead of recompiling a #define?] [1:10:38][@ejunkie64][Will there be a dev console?] [1:10:50][@Pseudonym73][Also, system() runs a program through CMD.EXE, which is yet another dependency] [1:11:57][@Lkey144][The chat recommended CREATE_NO_WINDOW as a process creation flag. You could probably use that instead of the minimized window] [1:12:38][@Trystan34][What is in the bat file that is run?] [1:12:48][@powerc9k][Why does it zoom out?] [1:13:02][@Radar_CS][Are you using sublime?] [1:13:07][@Quantumplation][Can you add a radial menu for debug camera, instead of piggybacking off toggle graph? It's bugging me] [1:13:19][Shut down][:speech] [/video]