Index hero/code544
This commit is contained in:
parent
b22282c9ab
commit
c882354f99
|
@ -0,0 +1,53 @@
|
||||||
|
[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Caching Unpacked Entities Across Frames" vod_platform=youtube id=6MN0Ks5VeSg annotator=Miblo]
|
||||||
|
[0:01][Recap and set the stage for the day, judiciously packing and unpacking entities][:"entity system" :speech]
|
||||||
|
[4:05][Show the game running][:run]
|
||||||
|
[4:12][Remove entity_reference in favour of making the traversable_reference and entity structs identify entities by entity_id][:"entity system"]
|
||||||
|
[18:51][Hit our assertion in GetHashFromID()][:"entity system" :run]
|
||||||
|
[19:11][Change GetEntityByID() to only call GetHashFromID() if the ID.Value is valid][:"entity system"]
|
||||||
|
[20:15][Find that we're back to good][:"entity system" :run]
|
||||||
|
[21:59][Set up to cache our entities, likening our plan to L1 and L2 caches in CPUs][:caching :"entity system" :speech]
|
||||||
|
[28:49][Make RepackEntitiesAsNecessary() repack entities that do not fall within a given chunk volume, introducing IsContainedInChunkVolume() and respecifying the world's version of CreateEntity() as AcquireUnpackedEntitySlot()][:caching :"entity system"]
|
||||||
|
[45:31][Clean up the entity slot stuff, introducing a free_entity for the world to contain and CreateWorld() to chain up][:"entity system"]
|
||||||
|
[1:04:23][See nothing in-game][:caching :"entity system" :run]
|
||||||
|
[1:04:49][Walk through our new entity :caching code][:"entity system" :research]
|
||||||
|
[1:09:33][Consult the profiler][:caching :"entity system" :run]
|
||||||
|
[1:10:34][Temporarily make RegisterEntity() operate on every Entity it is passed, even if it resides outside our sim region][:caching :"entity system"]
|
||||||
|
[1:11:06][Crash on a call to END_BLOCK()][:caching :"entity system" :run]
|
||||||
|
[1:15:14][Consider performing heap compaction on our entities][:caching :"entity system" :memory]
|
||||||
|
[1:17:39][Remove free_entity in favour of making RepackEntitiesAsNecessary() perform heap compaction on our entities][:caching :"entity system" :memory]
|
||||||
|
[1:24:13][Crash again on a call to END_BLOCK()][:caching :"entity system" :run]
|
||||||
|
[1:30:29][Revert RegisterEntity() to only operate on an Entity if in resides outside our sim region][:caching :"entity system"]
|
||||||
|
[1:31:32][Step through many calls to RegisterEntity(), watching the Entity->P values][:caching :"entity system" :run]
|
||||||
|
[1:34:50][Step through AddPlayer() and through the :camera initialisation code to see no obvious incorrectness][:caching :"entity system" :run]
|
||||||
|
[1:41:00][Carefully read through EnsureRegionIsUnpacked() and RepackEntitiesAsNecessary()][:caching :"entity system" :research]
|
||||||
|
[1:43:10][Try to break in to RepackEntitiesAsNecessary() to find that we never actually repack entities][:caching :"entity system" :run]
|
||||||
|
[1:44:54][Consider our bug to be in EnsureRegionIsUnpacked() and RegisterEntity()][:caching :"entity system" :research]
|
||||||
|
[1:47:44][See our world off in the distance, with our :camera and entities misplaced][:caching :"entity system" :run]
|
||||||
|
[1:49:04][Scour the code in the knowledge that we're tackling a positional bug][:caching :"entity system" :research]
|
||||||
|
[1:51:43][Offsetting the sim region origin across frames][:blackboard :geometry]
|
||||||
|
[1:54:56][Fix the order of arguments passed to Subtract() by EnsureRegionIsUnpacked()][:"entity system" :geometry]
|
||||||
|
[1:55:20][Find that we've solved the problem][:caching :"entity system" :run]
|
||||||
|
[1:56:06][Start to enable RepackEntitiesAsNecessary() to repack entities that are some distance outside our sim region][:caching :"entity system"]
|
||||||
|
[1:58:31][Make EnsureRegionIsUnpacked() responsible for packing entities][:caching :"entity system"]
|
||||||
|
[2:08:05][Hit our assertion in EnsureRegionIsUnpacked()][:caching :"entity system" :run]
|
||||||
|
[2:08:46][Fix EnsureRegionIsUnpacked() to square our MaxAllowedDistance][:caching :"entity system"]
|
||||||
|
[2:09:08][Find that we're fine][:caching :"entity system" :run]
|
||||||
|
[2:09:25][Q&A][:speech]
|
||||||
|
[2:10:29][@uplinkcoder][Q: Would you do Linux programming if you had a ~RemedyBG on Linux?]
|
||||||
|
[2:11:18][@0lpbm][Q: Will there be any :memory difference with TooFarFromPrecision vs no TooFarFromPrecision? (If so, can we see in the memory viewer?)][:caching :"entity system"]
|
||||||
|
[2:12:10][@brimonk][Q: I'm working on a project where "the client" has written some prototyped :mathematics code in Matlab. I've translated most of it, however, I have some discrepancies with the output, and I can't figure out if there's a better way to debug the problem than a whole bunch of printf debugging. Thoughts?][:language]
|
||||||
|
[2:14:00][@Brian][Q: When you are hopping around in a large room, it appears when you are hopping up, it seems that the outer area is lighter than that around around the player. Is this on purpose? Or used temporarily to demonstrate something?][:lighting]
|
||||||
|
[2:15:26][@lkraider][Q: How large a world does the float precision allow in this case? (I remember it being a problem in some games with large maps where the edges lose precision)][:mathematics]
|
||||||
|
[2:16:08][Step in to EnsureRegionIsUnpacked() and inspect our ChunkDimInMeters to see the sheer size of our world][:run]
|
||||||
|
[2:18:14][@wolverinegator][Q: The assertion that we didn't find was a debugtable assertion: assert macro inside record event macro inside destructor of the timed function. Can we put a MessageBox into the assert macro to find these kinds of asserts more easily?][:language]
|
||||||
|
[2:18:26][@vtlmks][Q: Heard about posits? Better precision and faster than normal floats (not in hardware yet obviously)[ref
|
||||||
|
site="The Next Platform"
|
||||||
|
page="New Approach Could Sink Floating Point Computation"
|
||||||
|
url=https://www.nextplatform.com/2019/07/08/new-approach-could-sink-floating-point-computation/]]
|
||||||
|
[2:20:10][@centhusiast][Q: Do you have time to explain on the zooming towards the mouse position and how it can be implemented (not coding just the concept and algorithm)? Thanks a million][:geometry]
|
||||||
|
[2:20:41][@iwrestledabeer][Q: Do you have any advice on how to ensure the uniqueness of :UI element ids in an immediate mode UI in a setting in which the number of elements changes from frame to frame (so using monotonically increasing counter won't work)?]
|
||||||
|
[2:24:14][@organoompkin][@handmade_hero What's the most effective way of testing code? I come from a web development background and there's a very heavy focus on unit testing and test driven development. I'm not sold on the dogma of that and I don't think it's really used in game development, which makes me curious as to how you do test effectively in game development]
|
||||||
|
[2:29:31][@centhusiast][Q: You said last week you will explain the zooming towards the mouse pointer on the white board. If it is not too much bother, otherwise I try to find something on google. Thanks a lot again][:geometry]
|
||||||
|
[2:30:21][Zooming towards mouse pointer, using a Stretch() function][:blackboard :geometry]
|
||||||
|
[3:04:37][End][:speech]
|
||||||
|
[/video]
|
Loading…
Reference in New Issue