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

44 lines
3.7 KiB
Plaintext
Raw Normal View History

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Cleaned Up Streaming Entity Simulation" vod_platform=youtube id=jdknM4bPUcc annotator=Miblo]
[0:50][Recap and set the stage for the day]
[1:11][handmade_world.cpp: Get the sizeof *Source in PackEntityIntoChunk]
[2:15][handmade_sim_region.h: Rename StorageIndex to ID in entity]
[4:12][handmade_sim_region.cpp: Rename GetHashFromStorage to GetHashFromID]
[4:55][handmade_sim_region.h and .cpp: Remove EntityFlag_Nonspacial from entity_flags and continue cleaning stuff up]
[8:06][handmade_world_mode.cpp and handmade_entity.h: Remove the Sword]
[12:34][handmade_world.cpp: Make PackEntityIntoWorld store the entity's location]
[15:40][Debugger: Step into BeginSim and find that we don't get any entities out in our initial pack]
[18:21][Debugger: Step into PackEntityIntoWorld and follow the code through to RemoveWorldChunk]
[23:57][handmade_world.cpp: Increment the Chunk->EntityCount in PackEntityIntoChunk]
[25:03][Run the game and see that we're getting closer, but that the body has stopped tracking the head]
[27:46][handmade_sim_region.cpp: Collapse down AddEntityRaw and AddEntity]
[32:14][Run the game and see exactly the same thing]
[32:21][handmade_sim_region.cpp: Introduce ConnectEntityPointers]
[34:55][Run the game and find that the head and body remain connected]
[35:17][handmade_entity.h: Move the entity-related structs in from handmade_sim_region.h]
[38:33][handmade_world_mode.cpp: Disable the Z-movement and then try traversing the world]
[39:48][handmade_sim_region.cpp: Introduce DeleteEntity]
[43:26][Run the game and test entering and exiting it]
[45:13][handmade_entity.h: Explain why world_position is no longer necessary and consider removing it]
[48:07][handmade_sim_region.cpp: Make BeginSim compute world_position and pass ChunkDelta to AddEntity]
[51:19][handmade_sim_region.cpp: Make the EntityP in EndSim relative to ChunkP]
[56:42][Run the game and find that we can go off the screen okay]
[56:58][handmade_sim_region.cpp: Set the Entity->P and chunk movements at the end of EndSim]
[57:48][Run the game and find that the camera does now follow the hero]
[58:42][Q&A]
[1:00:25][@dustinten][Is there any real difference between #ifndef and #if !defined? I always use the first but I see you use the latter]
[1:00:55][@dudeinbasement1][Do you feel like we take steps backward when we get into code we haven't been in in a while, e.g. the problems with moving the screen?]
[1:01:22][@grub_smub][Do you use a lot of header files?]
[1:01:53][Remove all instances of #if !defined]
[1:06:07][@xgabrielxal][Why not #pragma once?]
[1:08:56][@erdomina][Would you say the architecture of the entity system is based more on experience than on exploration?]
[1:09:28][@dustinten][Do you have a plan for the "components" of the entities? Just use the flags like you are now?]
[1:09:47][@longboolean][As a codebase grows new functions are created and others are no longer called anywhere. Are there any good ways that you recommend for finding out which functions / blocks of code are never used anywhere?]
[1:11:29][@duroate][Is there a way to run the game "entirely" and find out what parts of your code aren't being used, to get rid of?]
[1:13:02][@josianmarriott][The dynamite jack entity system is similar (but without compression)]
[1:13:37][@ttbjm][Have you checked LOC recently?]
[1:14:14][@Jim0_o][How is your arm now? Any chance of a streamathon?]
[1:14:39][@dudeinbasement1][CTime needs cloc built-in]
[1:15:37][@J_vanRijn][Re code coverage, when Farbrausch was trying to cut down size of Kkrieger they wrote a quick code coverage tool called Lekktor and because someone didn't use a certain key in the menu, the code to handle it was left out in the released version]
[1:20:33][Wrap it up]
[/video]