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

52 lines
6.5 KiB
Plaintext

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Improving Collision Volumes and the Camera" vod_platform=youtube id=Ll55Vdtf9NU annotator=Miblo]
[0:02][Recap and set the stage for the day]
[4:34][Run the game to see our debug collision volumes, and determine to implement room-based collision volumes]
[8:32][handmade_entity.h: Add CollisionVolume to the entity struct and propagate that change]
[17:30][handmade_sim_region.cpp: Introduce EntityOverlapsEntity(), remove EntitiesOverlap() and continue propagating CollisionVolume]
[23:47][handmade_math.h: Introduce a version of HasArea() that takes a rectangle3, and continue propagating the entity struct change]
[35:12][Run the game to see that the volumes are being offset unnecessarily]
[35:35][handmade_entity.cpp: Prevent UpdateAndRenderEntites() from calling DrawVolume()]
[35:57][Run the game to see that we are back to something relatively sane]
[36:17][handmade_entity.cpp: Enable UpdateAndRenderEntites() to colour the collision volumes according to whether they are colliding]
[36:58][Run the game to see our properly bounded rooms]
[38:34][handmade_world_mode.cpp: Make AddStandardRoom() only bias the floor tiles upwards]
[40:08][Run the game to see what that looks like]
[43:21][handmade_world_mode.cpp: Make PlayWorld() increase the TypicalFloorHeight, run the game to see how that height feels and note a graphical artefact when going downstairs]
[46:41][handmade_world_mode.cpp: Try to increase the tile size, and decrease the hero size in an effort to combat that clipping artefact when on the stairs]
[48:51][Run the game and consider fixing the problem by moving the camera over to the stairs]
[49:25][handmade_world_mode.cpp: Temporarily make AddStandardRoom() generate the stairwell in the centre and run the game to see that the artefact does not occur]
[52:47][handmade_sim_region.cpp: Consider giving the camera a physical location in the world, which gets unpacked into the sim region]
[57:18][Blackboard: Camera Target Position]
[58:54][handmade_sim_region.cpp: Construct the notion of a camera target position in UpdateCameraForEntityMovement()]
[1:02:16][Run the game and note that the camera is currently unable to articulate to the game where it is trying to view]
[1:03:08][handmade_sim_region.cpp: Make UpdateCameraForEntityMovement() position the camera in a sim region]
[1:04:31][handmade_world_mode.cpp: Make UpdateAndRenderWorld() set the SimulationCenter based on the camera target]
[1:07:40][Run the game and consider how best to locate the camera in the world]
[1:12:38][handmade_world_mode.h: Add OffsetZ to the game_camera struct for UpdateCameraForEntityMovement()]
[1:13:40][Run the game to see that the focusing still works]
[1:14:02][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() and UpdateAndRenderWorld() to lock the camera to the hero's location]
[1:17:36][Run the game to see the camera following the hero]
[1:19:10][handmade_sim_region.cpp: Introduce the notion of a SpecialCamera region in UpdateCameraForEntityMovement()]
[1:22:03][handmade_world_mode.cpp: Enable AddStandardRoom() to create a collision volume which triggers the SpecialCamera]
[1:28:46][Run the game to see our collision volume]
[1:29:35][handmade_world_mode.cpp: Temporarily disable the familiars, and extend the collision volume upwards]
[1:30:51][Run the game to try triggering that collision volume]
[1:34:29][Q&A][:speech]
[1:35:59][@kknewkles][Hi Casey! Two questions: 1) How come RAD aren't owning every avenue of compression in existence, like video codecs? and 2) Will Handmade Hero at some point be beautifully, 2D-animated like the excellent, excellent Hollow Knight, that everyone should play, by the way?]
[1:39:31][@sausagesuperb][Why don't you search and replace for the new short sexy data types]
[1:39:41][@kknewkles][That was Shovel Knight! Hollow Knight is a new game!]
[1:40:19][@0xdeadbeefh][Is the camera for this game gonna be plenty smart or just a little smart? In this staircase I imagine you might want to measure the velocity of the player to not have it affect the camera if the player is rushing straight past]
[1:41:22][handmade_sim_region.cpp: Prevent the camera from panning to the staircase unless the hero is traversing the stairs]
[1:42:21][Run the game to see how that works]
[1:43:07][@macielda][Is the Debug Text draw order still inverted? It seems so by the looks of the Debug text. Is the profiler still working?]
[1:43:41][@teamrandb][Greetings Casey! Last week during the wonderful Handmade Chat you demonstrated how to dynamically create code in memory. You have mentioned in the past how you do a fair bit of meta-programming and I always envisioned that you would generate C / C++ code to files. When you tackle meta-programming, do you write out to disk first and then have it compiled? Do you do it all in memory similar to what you did last week? Combination of both?]
[1:45:28][@jezzi23][Hey Casey. I was messing around with 4x4 matrix multiplication implementations and whipped out ten variations, some of which naive and others more optimal with SIMD. Out of curiosity I performance tested them all on MSVC, clang and gcc. I was very surprised by the results as the compilers seem to be doing very different things for this simple task. For example, on gcc the naive versions sometimes beat what I thought would be optimal SIMD (seems like it was able to output better intrinsics) but on clang it was the opposite. MSVC seems to have failed at unrolling a loop and all implementations were crap except for a manually unrolled SIMD version. I realize this is a rathole of a problem but is this really where we're at in terms of the philosophy of "write once and let each compiler do the best thing for the platform"? Any thoughts?]
[1:53:31][@macielda][I remember you mentioned at some point that you were really interested in Salt & Sanctuary. Have you played it? Did you work on that game?]
[1:53:51][@wordisnull][Can you please explain once more why you kept CameraOffsetZ? Is it for movement beetwen tilemaps or for something else?]
[1:54:05][Blackboard: Encoding the location the camera is looking at]
[1:56:07][@m0re85][If it's too off-topic I'll ask tomorrow during pre-stream, follow up on devirtualization: Your main criticism about virtual functions was the overhead you get from the indirection, so with devirtualization would you consider using them, or are there any other downsides compared to tagged unions?]
[1:58:19][Close it down with a plug of @AsafGartner's searcher[ref
site="Handmade Hero Annotations Search"
url=https://asafgartner.github.io/annotations_search/]][:research]
[/video]