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

99 lines
10 KiB
Plaintext
Raw Permalink Normal View History

2021-03-15 18:49:50 +00:00
[video output=day626 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Cleaning Up Traversables" vod_platform=youtube id=f4ioc8-lDc0 annotator=Miblo]
[0:00][Welcome to the stream][:speech]
[0:36][Consider throwing in some gameplay stuff][:run]
[2:53][Determine to add lockable doors][:"entity system" :movement :run]
[4:50][Note our broken transactional occupy points][:"entity system" :movement :run]
[5:41][Reacquaint ourselves with TransactionalOccupy()][:"entity system" :movement :research]
[9:25][Test transactional occupation with a snake entity][:"entity system" :movement :run]
[10:12][Reacquaint ourselves with tree placement in GenerateRoom()][:"entity system" :"procedural generation" :research]
[11:26][Make GenerateRoom() set each tile to be occupied by a tree as not open][:"entity system" :"procedural generation"]
[11:42][Our garden now lacks some trees][:"entity system" :"procedural generation" :run]
[11:53][Consider this to be an entity packing / unpacking bug][:"entity system" :research]
[14:27][Make UpdateAndRenderEntities() mark tiles by occupation][:"debug visualisation" :"entity system"]
[15:51][Hit a write access violation in PushCube()][:"entity system" :run]
[16:40][Hit an Emission assertion in PushCube()][:"entity system" :run]
[16:54][Make UpdateAndRenderEntities() pass an Emission value of 1.0f to PushCube()][:"entity system"]
[17:04][See our tile occupation][:"entity system" :run]
[17:21][Our tile occupation markers do not change colour][:"entity system" :run]
[17:48][Investigate this as an entity packing / unpacking bug][:"entity system" :research]
[21:30][Respecify entity_traversable_point to use an entity_id rather than an entity *, introducing an entity_id version of IsValid()][:"entity system"]
[26:22][Our tile occupation markers still do not change colour][:"entity system" :run]
[26:56][Scour the :"entity system" for traversable preservation]
[28:08][Step through TransactionalOccupy()][:"entity system" :run]
[31:39][Our tile occupation marker has not changed colour][:"entity system" :run]
[32:13][Fix UpdateAndRenderEntities() to use our "occupied" Color][:"debug visualisation" :"entity system"]
[32:47][Our tile occupation markers now change colour][:"entity system" :run]
[33:03][Hop over to the garden, yearning for a click-and-move debug feature][:"entity system" :run]
[34:11][Our tree tiles are not marked as occupied][:"entity system" :run]
[35:14][Our hero tile is also considered unoccupied on startup][:"entity system" :run]
[35:30][Make GenEntityAtTraversable() call TransactionalOccupy()][:"entity system" :"procedural generation"]
[37:26][Our trees now occupy their tiles][:"entity system" :run]
[37:59][We have mysterious tile occupation markers][:"entity system" :run]
[39:17][@thanveershah][What is this built on?][:"game engine"]
[39:26][@belginul][Unity][:"game engine"]
[39:43][On the legitimacy of the question][:"game engine" :speech]
[40:09][@pyromaggot][Windows is built on Unity][:"game engine" :"operating system"]
[40:34][Start to investigate our mystery occupation points][:"entity system" :research]
[41:04][@silverqraw][You'd actually be surprised how many are working on their own engines / games from scratch. It's pretty encouraging][:"game engine"]
[41:58][@rationalcoder][There should be disclosure policies in place so we can specifically avoid using hard real-time systems that are written in JavaScript in the future][:language]
[42:17][Make GenEntityAtTraversable() and PlaceOrphan() use GenEntity_IsNotOccupier][:"entity system"]
[47:34][Our conversation tiles work fine, but we still have mystery occupation points][:"entity system" :run]
[49:26][Our plan for doors: Supporting multiple door unlocking mechanisms][:"entity system" :run]
[52:16][We lack a door texture][:admin :art]
[52:55][Create a locking door entity, augmenting gen_connection with DoorFromAToB and DoorFromBToA][:"data structure" :"entity system"]
[58:25][Enable GenerateRoom() to create doors, using Intersect() and AddObstacle()][:"entity system" :geometry :"procedural generation"]
[1:06:15][Introduce GetTileAbs()][:"entity system" :geometry]
[1:07:22][Finish enabling GenerateRoom() to create doors][:"entity system" :"procedural generation"]
[1:09:57][Our orphanage is no different][:"entity system" :run]
[1:10:25][Make CreateDungeon() request a DoorFromAToB][:"entity system" :"procedural generation"]
[1:11:01][Our dungeon contains a door][:"entity system" :"procedural generation" :run]
[1:12:23][Disable the tile occupation markers in UpdateAndRenderEntities()][:"debug visualisation" :"entity system"]
[1:12:30][Plan to sink the doors into the floors next time][:"entity system" :run]
[1:12:46][Q&A][:speech]
[1:13:28][@thesandvichmaker][@handmade_hero Here's a hot question live off the press: Stack Overflow says you must use smart pointers. The [~hero Handmade Hero] codebase has no smart pointers, how can this be?!][:language]
[1:14:02][Programmer stages of mental development wrt architecture][:speech]
[1:14:43][Programmer stages of mental development wrt architecture: n) individual element thinking / architecture][:speech]
[1:18:00][Programmer stages of mental development wrt architecture: n+1) grouped element thinking][:speech]
[1:24:44][@vaualbus][@handmade_hero The good of having to learn the [~hero Handmade Hero] codebase is that the use of internal imposes the inability to use the STL as it is there too defined and broke the compilation. So is the reason why we skip C++ badness][:language]
[1:25:11][@stuntcoder][n+2 is when you reached guru stage after 30 years and your code finally "looks" as simple as written by someone at n-3 stage, but it is free of all the BS]
[1:28:03][@pythno][Q: If you look at the old id code (Wolf3D, Doom, Quake, ...) there they already think of large groups when it comes to :memory or at least they allocate just once (for the most part) and then go with it. Then why did we go "backwards"? n) is what I was taught at university from Professors who were around at the "Doom" time. What happened?]
[1:30:19][@said6289][Nowadays, engineers aren't engineers]
[1:31:02][@joeppp][Maybe people like Carmack (and [@cmuratori you]) should be more vocal. Now it's the mediocre guys shouting and the gurus keeping quiet. How are we supposed to learn?]
[1:32:22][@intraterrestriel][Q: Does this stuff apply to game engine programming only or also to corporate logistics (crud)?]
[1:33:09][@beastexmachina][I really appreciate the way that you presented that. Matches my first response to auto_ptr but I couldn't express the rationale as well. Also why I like C, because you have more pressure to think in the n+1 way][:language]
[1:38:57][Example of transitioning from n to n+1: Character creation in Granny][:memory :speech]
[1:42:13][Designing out :memory allocation failure bugs by creating a "working" stub arena][:speech]
[1:43:28][@rockpaperpi][Q: A lot of your n category seems to cover :"error handling". Are you concerned at all with any secure coding concepts to cover undefined behavior with people looking to exploit it?][:security]
[1:45:12][Growable arenas and failure handling][:memory :speech]
[1:46:58][@thesandvichmaker][Q: Let's say I want to push some dynamic amount of data, and I run out of space. The calling code expects N bytes, and will write N bytes, but I don't have N bytes. How do you handle this case in that style?][:memory]
[1:48:50][Programmer stages of mental development wrt architecture: n+2?) ZII][:speech]
[1:50:20][@mindspyke][Is a repeat mapped page an OS thing, or is that something custom?][:memory :"operating system"]
[1:51:49][@centhusiast][Q: Have you read the paper Fast Efficient Fixed-Size Memory Pool No Loops and No Overhead by Ben Kenwright?][:memory]
[1:52:31][@rationalcoder][Q: So all of the code has a check to see if the struct is a stub and doesn't do anything?][:memory]
[1:53:47][@centhusiast][Q: Could you quickly take a look at the paper?[ref
author="Ben Kenwright"
title="Fast Efficient Fixed-Size Memory Pool: No Loops and No Overhead"
publisher="School of Computer Science, Newcastle University"
url=https://www.thinkmind.org/download.php?articleid=computation_tools_2012_1_10_80006]][:memory]
[2:00:10][@aphotic44][@handmade_hero Are you familiar with Richard Fabian's Data-Oriented Design book?[ref
author="Richard Fabian"
title="Data-Oriented Design"
url=https://www.dataorienteddesign.com/dodbook/] He's an advocate of laying out data in normalized form, and representing relationships between entities in tables, much like a relational :database though not literally SQL of course][:database :memory]
[2:02:12][On publishing papers on known knowledge][:speech]
[2:03:47][@uncountable][In related works it does say "On the other hand, the technique we present here is not novel, but is a modification of an existing technique"[ref
author="Ben Kenwright"
title="Fast Efficient Fixed-Size Memory Pool: No Loops and No Overhead"
publisher="School of Computer Science, Newcastle University"
url=https://www.thinkmind.org/download.php?articleid=computation_tools_2012_1_10_80006]][:memory]
[2:05:29][@centhusiast][Q: Could you explain about ECC :memory?]
[2:08:25][@tarriest_python][@handmade_hero It's called Hamming codes. It can correct single bit flips, and detect two bit flips. It's all done in very simple hardware. Ben Eater and 3blue1brown have very good videos on the topic][:memory]
[2:08:47][@pythno][Q: In [~hero Handmade Hero], do you align the elements you put into the arena? Someone told me that nowadays on desktop CPUs the alignment for read / write is not as important but it is probably better to get as many things into a cache line as possible][:memory]
[2:11:45][@centhusiast][Q: Can hyperthreading cause false sharing?][:memory :threading]
[2:12:35][@infinum][@handmade_hero Did you ever have any problems with your back sitting all day long, or you just buy an expensive chair and all problems go away?][:health]
[2:13:44][Plug the Space Series Mesh Back Task Chair[ref
site=OfficeChairs.com
page="Space Series Mesh Back Task Chair"
url=https://www.officechairs.com/Black-Air-Grid-Mesh-Back-Swivel-Desk-Chair-CH00517.aspx]][:research]
[2:14:42][We are good to go][:speech]
[/video]