Handmade Hero»Episode Guide
Improving Camera Placement and Room Alignment
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu Movement

a
w
s
d
h j k l


Quotes and References Menus

Enter Jump to timecode

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
0:00Recap and set the stage for the day
🗩
0:00Recap and set the stage for the day
🗩
0:00Recap and set the stage for the day
🗩
1:30Run the game with the determination to position and zoom the camera to focus on a given rectangle, and retain the simulation region until the camera transitions are complete
🏃
1:30Run the game with the determination to position and zoom the camera to focus on a given rectangle, and retain the simulation region until the camera transitions are complete
🏃
1:30Run the game with the determination to position and zoom the camera to focus on a given rectangle, and retain the simulation region until the camera transitions are complete
🏃
7:39Make UpdateAndRenderWorld() merge the camera bounds into the simulation region
7:39Make UpdateAndRenderWorld() merge the camera bounds into the simulation region
7:39Make UpdateAndRenderWorld() merge the camera bounds into the simulation region
8:42Run the game to still see entities drop out of the simulation region
🏃
8:42Run the game to still see entities drop out of the simulation region
🏃
8:42Run the game to still see entities drop out of the simulation region
🏃
9:05Enlarge the SimBounds in UpdateAndRenderWorld()
9:05Enlarge the SimBounds in UpdateAndRenderWorld()
9:05Enlarge the SimBounds in UpdateAndRenderWorld()
10:00Run the game and no longer see entities drop out of the simulation region
🏃
10:00Run the game and no longer see entities drop out of the simulation region
🏃
10:00Run the game and no longer see entities drop out of the simulation region
🏃
10:49Note the risks to allowing the simulation region to be determined by the camera
10:49Note the risks to allowing the simulation region to be determined by the camera
10:49Note the risks to allowing the simulation region to be determined by the camera
16:13Run the game and set up to implement our dynamically zooming camera
🏃
16:13Run the game and set up to implement our dynamically zooming camera
🏃
16:13Run the game and set up to implement our dynamically zooming camera
🏃
21:52Determine to hand-code camera zoom levels per room
🏃
21:52Determine to hand-code camera zoom levels per room
🏃
21:52Determine to hand-code camera zoom levels per room
🏃
23:24Work towards enabling UpdateCameraForEntityMovement() to set the TargetOffsetZ from the stored CameraOffset.z
23:24Work towards enabling UpdateCameraForEntityMovement() to set the TargetOffsetZ from the stored CameraOffset.z
23:24Work towards enabling UpdateCameraForEntityMovement() to set the TargetOffsetZ from the stored CameraOffset.z
26:21Run the game to see nothing
🏃
26:21Run the game to see nothing
🏃
26:21Run the game to see nothing
🏃
26:46Make GenerateRoom() initialise the CameraOffset.z to 16
26:46Make GenerateRoom() initialise the CameraOffset.z to 16
26:46Make GenerateRoom() initialise the CameraOffset.z to 16
27:21Run the game to see our usual camera view
🏃
27:21Run the game to see our usual camera view
🏃
27:21Run the game to see our usual camera view
🏃
27:37Introduce GetCameraOffsetZForDim() to dynamically zoom the camera
27:37Introduce GetCameraOffsetZForDim() to dynamically zoom the camera
27:37Introduce GetCameraOffsetZForDim() to dynamically zoom the camera
34:43Make UpdateAndRenderWorld() write out the Camera.OffsetZ
34:43Make UpdateAndRenderWorld() write out the Camera.OffsetZ
34:43Make UpdateAndRenderWorld() write out the Camera.OffsetZ
35:23Run the game and watch that Camera.OffsetZ change while traversing the orphanage
🏃
35:23Run the game and watch that Camera.OffsetZ change while traversing the orphanage
🏃
35:23Run the game and watch that Camera.OffsetZ change while traversing the orphanage
🏃
38:10Determine to fix the camera's room selection bug
🏃
38:10Determine to fix the camera's room selection bug
🏃
38:10Determine to fix the camera's room selection bug
🏃
40:09Make UpdateAndRenderEntities() draw the room boundaries
40:09Make UpdateAndRenderEntities() draw the room boundaries
40:09Make UpdateAndRenderEntities() draw the room boundaries
41:08Run the game to see those room boundaries
🏃
41:08Run the game to see those room boundaries
🏃
41:08Run the game to see those room boundaries
🏃
41:43Fix GenerateRoom() to correctly align the collision volumes of both even- and odd-sized rooms, removing the world_room_camera struct and making ChunkPositionFromTilePosition() take a world_generator that contains the TileDim
41:43Fix GenerateRoom() to correctly align the collision volumes of both even- and odd-sized rooms, removing the world_room_camera struct and making ChunkPositionFromTilePosition() take a world_generator that contains the TileDim
41:43Fix GenerateRoom() to correctly align the collision volumes of both even- and odd-sized rooms, removing the world_room_camera struct and making ChunkPositionFromTilePosition() take a world_generator that contains the TileDim
55:03Run the game to see that the room alignment is off-by-one
🏃
55:03Run the game to see that the room alignment is off-by-one
🏃
55:03Run the game to see that the room alignment is off-by-one
🏃
55:31Fix GenerateRoom() to correctly align the room collision volumes
55:31Fix GenerateRoom() to correctly align the room collision volumes
55:31Fix GenerateRoom() to correctly align the room collision volumes
55:46Run the game to see that the rooms are correctly aligned in X and Y, and consider how to align them in Z
🏃
55:46Run the game to see that the rooms are correctly aligned in X and Y, and consider how to align them in Z
🏃
55:46Run the game to see that the rooms are correctly aligned in X and Y, and consider how to align them in Z
🏃
57:12Temporarily prevent ChunkPositionFromTilePosition() from offsetting the room collision volumes in Z
57:12Temporarily prevent ChunkPositionFromTilePosition() from offsetting the room collision volumes in Z
57:12Temporarily prevent ChunkPositionFromTilePosition() from offsetting the room collision volumes in Z
58:01Run the game to see how this change aligns the rooms
🏃
58:01Run the game to see how this change aligns the rooms
🏃
58:01Run the game to see how this change aligns the rooms
🏃
59:01Make GenerateRoom() compute the RoomCenter along all axes
59:01Make GenerateRoom() compute the RoomCenter along all axes
59:01Make GenerateRoom() compute the RoomCenter along all axes
1:01:51Step in to GenerateRoom() to see that MakeSimpleGroundedCollision() may be busted
🏃
1:01:51Step in to GenerateRoom() to see that MakeSimpleGroundedCollision() may be busted
🏃
1:01:51Step in to GenerateRoom() to see that MakeSimpleGroundedCollision() may be busted
🏃
1:03:28Change GenerateRoom() to align the room collision volumes using MapIntoSimSpace() renamed from GetSimRelativePosition()
1:03:28Change GenerateRoom() to align the room collision volumes using MapIntoSimSpace() renamed from GetSimRelativePosition()
1:03:28Change GenerateRoom() to align the room collision volumes using MapIntoSimSpace() renamed from GetSimRelativePosition()
1:07:57Run the game to see how our rooms are now aligned, and consider peeking into rooms
🏃
1:07:57Run the game to see how our rooms are now aligned, and consider peeking into rooms
🏃
1:07:57Run the game to see how our rooms are now aligned, and consider peeking into rooms
🏃
1:12:20Introduce AddLamp() for GenerateRoom() to call and add a lamp to every room
1:12:20Introduce AddLamp() for GenerateRoom() to call and add a lamp to every room
1:12:20Introduce AddLamp() for GenerateRoom() to call and add a lamp to every room
1:16:04Run the game to see the bright lights
🏃
1:16:04Run the game to see the bright lights
🏃
1:16:04Run the game to see the bright lights
🏃
1:16:43Prevent UpdateAndRenderWorld() from adding a light at the hero's location
1:16:43Prevent UpdateAndRenderWorld() from adding a light at the hero's location
1:16:43Prevent UpdateAndRenderWorld() from adding a light at the hero's location
1:17:01Run the game to see our unlit hero
🏃
1:17:01Run the game to see our unlit hero
🏃
1:17:01Run the game to see our unlit hero
🏃
1:17:31Reduce the lamp brightness in GenerateRoom()
1:17:31Reduce the lamp brightness in GenerateRoom()
1:17:31Reduce the lamp brightness in GenerateRoom()
1:17:46Run the game to see our dimmer lights
🏃
1:17:46Run the game to see our dimmer lights
🏃
1:17:46Run the game to see our dimmer lights
🏃
1:18:13Make AddLamp() reposition the lamps, and GenerateRoom() generate them in the four corners of the rooms
1:18:13Make AddLamp() reposition the lamps, and GenerateRoom() generate them in the four corners of the rooms
1:18:13Make AddLamp() reposition the lamps, and GenerateRoom() generate them in the four corners of the rooms
1:23:26Run the game to see our lights in the corners of rooms
🏃
1:23:26Run the game to see our lights in the corners of rooms
🏃
1:23:26Run the game to see our lights in the corners of rooms
🏃
1:24:36Enable GenerateRoom() to randomise the light colours
1:24:36Enable GenerateRoom() to randomise the light colours
1:24:36Enable GenerateRoom() to randomise the light colours
1:26:34Run the game to see our differently coloured lights
🏃
1:26:34Run the game to see our differently coloured lights
🏃
1:26:34Run the game to see our differently coloured lights
🏃
1:27:20insobot 4 minutes into the Q&A, 11 until end. (based on NOTE)
🗪
1:27:20insobot 4 minutes into the Q&A, 11 until end. (based on NOTE)
🗪
1:27:20insobot 4 minutes into the Q&A, 11 until end. (based on NOTE)
🗪
1:28:10Make PushCube() take a v3 Radius to uniformly size cubes, and propagate this change
1:28:10Make PushCube() take a v3 Radius to uniformly size cubes, and propagate this change
1:28:10Make PushCube() take a v3 Radius to uniformly size cubes, and propagate this change
1:36:10Run the game to find that the walls are suddenly taller
🏃
1:36:10Run the game to find that the walls are suddenly taller
🏃
1:36:10Run the game to find that the walls are suddenly taller
🏃
1:37:34Make GenerateRoom() align the rooms in Z as they were before
1:37:34Make GenerateRoom() align the rooms in Z as they were before
1:37:34Make GenerateRoom() align the rooms in Z as they were before
1:38:57Run the game to see the room alignment
🏃
1:38:57Run the game to see the room alignment
🏃
1:38:57Run the game to see the room alignment
🏃
1:40:34Prevent GenerateRoom() from offsetting the HalfTileDim.z
1:40:34Prevent GenerateRoom() from offsetting the HalfTileDim.z
1:40:34Prevent GenerateRoom() from offsetting the HalfTileDim.z
1:42:00Run the game to see the room alignment
🏃
1:42:00Run the game to see the room alignment
🏃
1:42:00Run the game to see the room alignment
🏃
1:43:24Consider our alignment scheme
🗩
1:43:24Consider our alignment scheme
🗩
1:43:24Consider our alignment scheme
🗩
1:45:30Draw the chunk locations in UpdateAndRenderWorld()
1:45:30Draw the chunk locations in UpdateAndRenderWorld()
1:45:30Draw the chunk locations in UpdateAndRenderWorld()
1:48:30Run the game to see our chunk boundary
🏃
1:48:30Run the game to see our chunk boundary
🏃
1:48:30Run the game to see our chunk boundary
🏃
1:48:47Prevent ChunkPositionFromTilePosition() from adjusting the Offset.z
1:48:47Prevent ChunkPositionFromTilePosition() from adjusting the Offset.z
1:48:47Prevent ChunkPositionFromTilePosition() from adjusting the Offset.z
1:49:03Run the game to see that the chunk boundary lines up with the floor
🏃
1:49:03Run the game to see that the chunk boundary lines up with the floor
🏃
1:49:03Run the game to see that the chunk boundary lines up with the floor
🏃
1:49:14Disable most of the debug visualisation and take a walk about the orphanage
🏃
🖮
1:49:14Disable most of the debug visualisation and take a walk about the orphanage
🏃
🖮
1:49:14Disable most of the debug visualisation and take a walk about the orphanage
🏃
🖮
1:50:34Disable the room boundary debug visualisation
1:50:34Disable the room boundary debug visualisation
1:50:34Disable the room boundary debug visualisation
1:50:59Run the game and consider our dynamic camera
🏃
1:50:59Run the game and consider our dynamic camera
🏃
1:50:59Run the game and consider our dynamic camera
🏃
1:51:45Q&A
🗩
1:51:45Q&A
🗩
1:51:45Q&A
🗩
1:52:02joshuadolman Q: Is there a particular reason why the sim region and / or lighting region are based on "world space" rather than connected rooms? I know that's how it was originally put together but are there any benefits / disadvantages either way? Also, if you place the lighting boundary right before a lamp and then move so it enters the light region, doesn't it kind of pop-in a little? (It's more of a fade but hopefully you know what I mean, entering the big square room does what I mean with the lamps at the top)
🗪
1:52:02joshuadolman Q: Is there a particular reason why the sim region and / or lighting region are based on "world space" rather than connected rooms? I know that's how it was originally put together but are there any benefits / disadvantages either way? Also, if you place the lighting boundary right before a lamp and then move so it enters the light region, doesn't it kind of pop-in a little? (It's more of a fade but hopefully you know what I mean, entering the big square room does what I mean with the lamps at the top)
🗪
1:52:02joshuadolman Q: Is there a particular reason why the sim region and / or lighting region are based on "world space" rather than connected rooms? I know that's how it was originally put together but are there any benefits / disadvantages either way? Also, if you place the lighting boundary right before a lamp and then move so it enters the light region, doesn't it kind of pop-in a little? (It's more of a fade but hopefully you know what I mean, entering the big square room does what I mean with the lamps at the top)
🗪
1:54:41sahfortv Q: I think there were two typos: 1. GetCameraOffsetZForDim() had XCount; typo 2. PushLight() PushCube() had x, x, z
🗪
1:54:41sahfortv Q: I think there were two typos: 1. GetCameraOffsetZForDim() had XCount; typo 2. PushLight() PushCube() had x, x, z
🗪
1:54:41sahfortv Q: I think there were two typos: 1. GetCameraOffsetZForDim() had XCount; typo 2. PushLight() PushCube() had x, x, z
🗪
1:55:15Fix typo in GetCameraOffsetZForDim()
1:55:15Fix typo in GetCameraOffsetZForDim()
1:55:15Fix typo in GetCameraOffsetZForDim()
1:56:46lorymaster Q: Haven't really followed much, but are those static lights simulated? If yes, would it be a good idea to make their lighting pre-calculated to improve performance?
🗪
1:56:46lorymaster Q: Haven't really followed much, but are those static lights simulated? If yes, would it be a good idea to make their lighting pre-calculated to improve performance?
🗪
1:56:46lorymaster Q: Haven't really followed much, but are those static lights simulated? If yes, would it be a good idea to make their lighting pre-calculated to improve performance?
🗪
1:57:30pragmascrypt Q: Will the up-facing sprite cards be affected by the lighting in the future?
🗪
1:57:30pragmascrypt Q: Will the up-facing sprite cards be affected by the lighting in the future?
🗪
1:57:30pragmascrypt Q: Will the up-facing sprite cards be affected by the lighting in the future?
🗪
1:58:05alexkelbo Q: Will we do shadow maps?
🗪
1:58:05alexkelbo Q: Will we do shadow maps?
🗪
1:58:05alexkelbo Q: Will we do shadow maps?
🗪
1:58:25Consider how shadow maps could work with sprite cards, and making stairwells
🏃
1:58:25Consider how shadow maps could work with sprite cards, and making stairwells
🏃
1:58:25Consider how shadow maps could work with sprite cards, and making stairwells
🏃
2:00:11ttbjm Q: It looks like rooms below you can be outside of the lighting volume
🗪
2:00:11ttbjm Q: It looks like rooms below you can be outside of the lighting volume
🗪
2:00:11ttbjm Q: It looks like rooms below you can be outside of the lighting volume
🗪
2:02:23cvaucher Q: I'm cleaning up the color handling to track down rendering differences between my OpenGL and Metal backends. Is there a generally accepted way to pass / store colors in the pipeline, i.e. pre-convert everything in the asset packer to linear or widest color space? The world generation code is currently linearizing the sRGB color inputs so that they can then be reconverted to sRGB by OpenGL during blending. This seems inefficient?
🗪
2:02:23cvaucher Q: I'm cleaning up the color handling to track down rendering differences between my OpenGL and Metal backends. Is there a generally accepted way to pass / store colors in the pipeline, i.e. pre-convert everything in the asset packer to linear or widest color space? The world generation code is currently linearizing the sRGB color inputs so that they can then be reconverted to sRGB by OpenGL during blending. This seems inefficient?
🗪
2:02:23cvaucher Q: I'm cleaning up the color handling to track down rendering differences between my OpenGL and Metal backends. Is there a generally accepted way to pass / store colors in the pipeline, i.e. pre-convert everything in the asset packer to linear or widest color space? The world generation code is currently linearizing the sRGB color inputs so that they can then be reconverted to sRGB by OpenGL during blending. This seems inefficient?
🗪
2:05:39alexkelbo Q: Should we change the color of the hero sprite depending on the surrounding light? He looks too bright in the darker areas
🗪
2:05:39alexkelbo Q: Should we change the color of the hero sprite depending on the surrounding light? He looks too bright in the darker areas
🗪
2:05:39alexkelbo Q: Should we change the color of the hero sprite depending on the surrounding light? He looks too bright in the darker areas
🗪
2:07:220lpbm Q: Shouldn't lights behave as other entities in regards to the sim region?
🗪
2:07:220lpbm Q: Shouldn't lights behave as other entities in regards to the sim region?
🗪
2:07:220lpbm Q: Shouldn't lights behave as other entities in regards to the sim region?
🗪
2:08:060lpbm Q: I thought they are visible when outside?
🗪
2:08:060lpbm Q: I thought they are visible when outside?
🗪
2:08:060lpbm Q: I thought they are visible when outside?
🗪
2:08:16Understanding the simulation region in terms of the lighting
🏃
2:08:16Understanding the simulation region in terms of the lighting
🏃
2:08:16Understanding the simulation region in terms of the lighting
🏃
2:10:47jim0_o Q: Will you be adding fire-flies and will you call them lighting-bugs?
🗪
2:10:47jim0_o Q: Will you be adding fire-flies and will you call them lighting-bugs?
🗪
2:10:47jim0_o Q: Will you be adding fire-flies and will you call them lighting-bugs?
🗪
2:10:55That's all, folks
🗩
2:10:55That's all, folks
🗩
2:10:55That's all, folks
🗩