[video output=day339 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging Particle Camera Offset Motion" vod_platform=youtube id=76TSb_HiKus annotator=Miblo]
[1:17][Run the game and consider our current situation with entities being incorrectly displaced while the camera moves]
[4:09][handmade_particles.cpp: Try temporarily nullifying the FrameDisplacement, run the game and see what happens]
[6:04][handmade_particles.h: Add FloorZ and ChunkZ to the particle_4x struct]
[8:08][handmade_particles.cpp: Make SpawnFire() take FloorZ and ChunkZ and enable UpdateAndRenderFire() to compute the transform from these values]
[13:48][Run the game to see if that affects things and consider why we see that sinusoidal slippage]
[26:13][Debugger: Step in to SpawnFire() and compare the transforms of a particle and its calling entity]
[30:07][handmade_particles.cpp: Make UpdateAndRenderFire() set the particle's OffsetP to OffsetP + P, before nullifying that P]
[33:06][Run the game and see if this is more correct]
[34:20][handmade_particles.cpp: Keep the particles in one place, run the game and watch how they move]
[38:16][build.bat: Switch to -O2, run the game, crash and investigate why]
[44:43][Explain the bug with us doing an unaligned load]
[46:46][handmade_world_mode.cpp: Pass AlignNoClear(16) to the PushStruct() call which sets the ParticleCache, run the game and find that that fixed it]
[47:19][Switch to the software renderer, observe the corkscrew motion in the particles and consider how to fix it]
[50:29][handmade_particles.cpp: Make UpdateAndRenderFire() pass 0 as the alignment to PushBitmap(), run the game to see if that affects it, and continue investigating]
[54:57][Q&A][:speech]
[55:17][@nxsy][Look at the screen border while you're doing it]
[57:17][@cyberpunkhobo][Entities get displaced by the modified CameraP during room transitions, I think]
[57:52][@cyberpunkhobo][What if you disable the parabolic camera transition between rooms?]
[58:27][handmade_sim_region.cpp: Toggle off the parabolic camera, run the game and see that the entity displacement is now solid]
[1:02:57][handmade_world_mode.cpp: Try setting CameraP.z and then CameraP.y to 0, run the game and see how that affects it]
[1:05:03][handmade_entity.cpp: Note that UpdateAndRenderEntities() is erroneously using the CameraOffset.z to set the floor height, and make it use CameraP]
[1:07:00][handmade_particles.cpp: Make UpdateAndRenderParticleSystems() and UpdateAndRenderFire() take CameraP]
[1:08:38][Run the game and see that it sort of worked]
[1:10:36][@mixthemeow][Full on 3D would probably be less complicated at this point]
[1:14:33][@boogie_improper][What is the difference between Handmade Hero and 1935?]
[1:14:56][@jayphi][So just now the fix only applied to the particles? Because the borders are still moving]
[1:15:12][@nxsy][In the code, I think they mean]
[1:19:12][@erdomina][Are we able to change the projection in this game?]
[1:19:36][@zuurr_][In UpdateAndRenderEntities (in handmade_entity.h) is the MovementMode_AngleAttackSwipe case missing a break or is the fall-through intentional]
[1:19:49][@dragoonx6][How far would you say you are with developing the game? How many episodes can we still expect?]
[1:21:16][@serge_rgb][Do you find it difficult to context-switch between 1935 and Handmade Hero, and, if so, has it gotten easier with time?]
[1:23:54][Go back and end the stream][:speech]
[/video]
