| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906 |
- <!doctype html>
- <html lang="en" class="no-js">
- <head>
-
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
-
-
-
-
- <link rel="prev" href="culling.html">
-
-
- <link rel="next" href="../pathfinding/index.html">
-
-
- <link rel="icon" href="../assets/images/favicon.ico">
- <meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.11">
-
-
-
- <title>Tile Pooling - DunGen</title>
-
-
-
- <link rel="stylesheet" href="../assets/stylesheets/main.4af4bdda.min.css">
-
-
- <link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
-
-
-
-
-
- <script src="https://unpkg.com/iframe-worker/shim"></script>
-
-
-
-
-
-
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
- <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
-
-
-
- <link rel="stylesheet" href="../stylesheets/extra.css">
-
- <script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
-
-
-
-
-
- </head>
-
-
-
-
-
-
-
- <body dir="ltr" data-md-color-scheme="slate" data-md-color-primary="black" data-md-color-accent="cyan">
-
-
- <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
- <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
- <label class="md-overlay" for="__drawer"></label>
- <div data-md-component="skip">
-
-
- <a href="#optimization-tile-pooling" class="md-skip">
- Skip to content
- </a>
-
- </div>
- <div data-md-component="announce">
-
- </div>
-
-
-
-
- <header class="md-header md-header--shadow" data-md-component="header">
- <nav class="md-header__inner md-grid" aria-label="Header">
- <a href="../index.html" title="DunGen" class="md-header__button md-logo" aria-label="DunGen" data-md-component="logo">
- <svg width="100%" height="100%" viewBox="0 0 258 272" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
- <path d="M79,20.998C103.163,20.998 126.827,20.993 150.49,21.002C156.512,21.004 156.994,21.502 157,27.603C157.008,36.435 157.275,45.279 156.89,54.094C156.689,58.68 158.685,61.484 161.849,64.242C170.723,71.978 179.515,79.812 188.188,87.772C190.849,90.214 193.071,93.217 195.28,95.995C199.425,101.209 199.993,100.532 203.73,100.441C209.056,100.311 214.403,100.217 219.713,100.549C222.988,100.754 224.083,99.873 224.059,96.517C223.93,78.354 223.952,60.189 224.044,42.025C224.059,38.949 223.341,37.434 219.868,37.603C214.383,37.872 208.877,37.791 203.381,37.715C199.579,37.663 197.517,38.715 197.907,43.168C198.327,47.964 197.807,52.836 198.065,57.655C198.263,61.366 196.432,62.919 193.348,61.885C188.656,60.311 184.193,58.029 179.724,55.858C179.188,55.598 179.033,54.157 179.028,53.262C178.979,44.43 179.007,35.598 178.995,26.766C178.99,22.857 180.241,20.823 184.822,20.897C200.816,21.158 216.816,20.988 232.814,21.004C239.132,21.01 240.996,22.894 240.998,29.241C241.006,56.07 241.005,82.9 240.998,109.729C240.997,114.795 238.959,117.469 233.922,117.935C228.649,118.423 223.32,118.407 218.015,118.42C208.355,118.444 198.68,117.994 189.04,118.408C184.225,118.615 181.96,116.755 180.231,112.653C175.241,100.811 167.104,91.401 156.54,84.26C153.778,82.394 150.001,81.189 146.67,81.142C126.51,80.86 106.344,81.107 86.182,80.92C81.723,80.878 80.502,82.453 80.517,86.753C80.64,122.394 80.606,158.037 80.499,193.679C80.487,197.764 81.821,199.148 86.047,199.093C103.375,198.866 120.707,198.998 138.038,198.998C159.059,198.998 178.198,184.319 182.849,163.942C184.15,158.243 183.93,152.135 183.91,146.215C183.896,141.846 185.254,139.882 189.885,139.936C204.381,140.105 218.88,139.974 233.378,140.01C238.862,140.024 240.989,142.215 240.993,147.822C241.011,180.317 241.012,212.813 240.992,245.308C240.988,250.939 238.967,252.977 233.218,252.985C205.722,253.022 178.226,253.017 150.73,252.989C145.524,252.983 144.074,251.47 144.001,246.325C143.982,244.992 144.14,243.641 143.973,242.329C143.34,237.341 146.132,235.979 150.411,235.99C160.395,236.016 171.06,236.112 181.183,236.112C181.349,229.59 181.592,223.106 181.957,216.723C182.112,214.015 183.166,213.054 185.926,212.937C199.005,212.385 199.002,212.308 199.002,225.465C199.002,236.846 199.003,236.883 210.211,236.618C214.669,236.512 219.122,236.203 223.998,235.966L223.998,215.809C223.998,197.812 223.911,179.813 224.071,161.817C224.103,158.195 223.211,156.729 219.348,156.922C213.399,157.218 207.424,157 201.518,157C200.995,162.216 201.49,167.296 200.093,171.982C197.761,179.807 196.375,184.335 192.2,189.003C186.463,195.42 180.539,202.401 173.212,206.467C165.218,210.904 155.809,213.982 146.533,214.772C140.003,215.328 133.915,215.112 127.586,214.988C124.239,214.923 122.845,216.06 122.934,219.622C123.145,228.116 123.005,236.618 123.001,245.117C122.998,251.059 121.128,252.977 115.061,252.989C97.897,253.025 80.733,253.002 63.568,253.002C51.404,253.002 39.239,253.028 27.074,252.99C21.11,252.972 19.972,251.911 19.969,246.171C19.952,212.512 20.027,178.852 19.931,145.193C19.92,141.244 21.512,139.936 25.206,139.967C36.037,140.056 46.872,139.868 57.7,140.066C61.659,140.139 62.704,138.654 62.9,134.816C63.079,131.328 63.031,127.859 62.985,124.329C62.92,119.388 61.017,118.259 56.858,118.302C47.864,118.397 38.869,118.381 29.875,118.42C29.044,118.424 28.21,118.569 27.382,118.535C20.483,118.255 19.854,117.626 19.858,110.743C19.874,83.582 19.901,56.422 19.946,29.261C19.957,22.709 21.747,21.005 28.509,21.001C45.173,20.992 61.836,20.998 79,20.998M40.806,37.592C39.579,39.018 37.305,40.427 37.283,41.871C37.009,60.012 37.047,78.158 37.045,96.302C37.045,98.812 38.187,100.243 40.973,100.24C46.626,100.235 52.281,100.327 57.93,100.537C61.815,100.681 63.165,99.043 63.06,95.156C62.832,86.672 62.99,78.177 63.001,69.687C63.01,63.101 65.168,60.989 71.882,60.989C92.36,60.99 112.837,60.999 133.315,60.997C139.718,60.996 139.987,60.711 139.998,54.125C140.004,50.629 139.757,47.111 140.059,43.642C140.457,39.073 138.568,37.373 134.101,37.395C103.319,37.551 72.535,37.595 40.806,37.592M62.997,200.455C62.997,187.472 63.078,174.487 62.886,161.507C62.863,159.996 61.38,157.25 60.476,157.208C52.923,156.859 45.347,157.01 37.87,157.01C37.87,182.364 37.917,206.983 37.817,231.602C37.803,235.205 39.289,236.074 42.623,236.055C62.599,235.939 82.576,236.005 102.552,235.977C103.642,235.975 104.732,235.678 105.997,235.493C105.997,229.703 105.875,224.216 106.048,218.738C106.137,215.898 105.136,214.958 102.315,214.998C93.661,215.12 85.004,215.009 76.348,215.006C62.998,215 62.998,215.006 62.997,200.455Z" style="fill:currentColor;fill-rule:nonzero;"/>
- <g transform="matrix(1,0,0,1,91.4761,179.778)">
- <text x="0px" y="0px" style="font-family:'Arial-BoldMT', 'Arial', sans-serif;font-weight:700;font-size:110px;fill:currentColor;">D</text>
- </g>
- </svg>
- </a>
- <label class="md-header__button md-icon" for="__drawer">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
- </label>
- <div class="md-header__title" data-md-component="header-title">
- <div class="md-header__ellipsis">
- <div class="md-header__topic">
- <span class="md-ellipsis">
- DunGen
- </span>
- </div>
- <div class="md-header__topic" data-md-component="header-topic">
- <span class="md-ellipsis">
-
- Tile Pooling
-
- </span>
- </div>
- </div>
- </div>
-
-
-
-
-
-
-
- </nav>
-
- </header>
-
- <div class="md-container" data-md-component="container">
-
-
-
-
-
-
- <main class="md-main" data-md-component="main">
- <div class="md-main__inner md-grid">
-
-
-
- <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
- <div class="md-sidebar__scrollwrap">
- <div class="md-sidebar__inner">
-
- <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
- <label class="md-nav__title" for="__drawer">
- <a href="../index.html" title="DunGen" class="md-nav__button md-logo" aria-label="DunGen" data-md-component="logo">
- <svg width="100%" height="100%" viewBox="0 0 258 272" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
- <path d="M79,20.998C103.163,20.998 126.827,20.993 150.49,21.002C156.512,21.004 156.994,21.502 157,27.603C157.008,36.435 157.275,45.279 156.89,54.094C156.689,58.68 158.685,61.484 161.849,64.242C170.723,71.978 179.515,79.812 188.188,87.772C190.849,90.214 193.071,93.217 195.28,95.995C199.425,101.209 199.993,100.532 203.73,100.441C209.056,100.311 214.403,100.217 219.713,100.549C222.988,100.754 224.083,99.873 224.059,96.517C223.93,78.354 223.952,60.189 224.044,42.025C224.059,38.949 223.341,37.434 219.868,37.603C214.383,37.872 208.877,37.791 203.381,37.715C199.579,37.663 197.517,38.715 197.907,43.168C198.327,47.964 197.807,52.836 198.065,57.655C198.263,61.366 196.432,62.919 193.348,61.885C188.656,60.311 184.193,58.029 179.724,55.858C179.188,55.598 179.033,54.157 179.028,53.262C178.979,44.43 179.007,35.598 178.995,26.766C178.99,22.857 180.241,20.823 184.822,20.897C200.816,21.158 216.816,20.988 232.814,21.004C239.132,21.01 240.996,22.894 240.998,29.241C241.006,56.07 241.005,82.9 240.998,109.729C240.997,114.795 238.959,117.469 233.922,117.935C228.649,118.423 223.32,118.407 218.015,118.42C208.355,118.444 198.68,117.994 189.04,118.408C184.225,118.615 181.96,116.755 180.231,112.653C175.241,100.811 167.104,91.401 156.54,84.26C153.778,82.394 150.001,81.189 146.67,81.142C126.51,80.86 106.344,81.107 86.182,80.92C81.723,80.878 80.502,82.453 80.517,86.753C80.64,122.394 80.606,158.037 80.499,193.679C80.487,197.764 81.821,199.148 86.047,199.093C103.375,198.866 120.707,198.998 138.038,198.998C159.059,198.998 178.198,184.319 182.849,163.942C184.15,158.243 183.93,152.135 183.91,146.215C183.896,141.846 185.254,139.882 189.885,139.936C204.381,140.105 218.88,139.974 233.378,140.01C238.862,140.024 240.989,142.215 240.993,147.822C241.011,180.317 241.012,212.813 240.992,245.308C240.988,250.939 238.967,252.977 233.218,252.985C205.722,253.022 178.226,253.017 150.73,252.989C145.524,252.983 144.074,251.47 144.001,246.325C143.982,244.992 144.14,243.641 143.973,242.329C143.34,237.341 146.132,235.979 150.411,235.99C160.395,236.016 171.06,236.112 181.183,236.112C181.349,229.59 181.592,223.106 181.957,216.723C182.112,214.015 183.166,213.054 185.926,212.937C199.005,212.385 199.002,212.308 199.002,225.465C199.002,236.846 199.003,236.883 210.211,236.618C214.669,236.512 219.122,236.203 223.998,235.966L223.998,215.809C223.998,197.812 223.911,179.813 224.071,161.817C224.103,158.195 223.211,156.729 219.348,156.922C213.399,157.218 207.424,157 201.518,157C200.995,162.216 201.49,167.296 200.093,171.982C197.761,179.807 196.375,184.335 192.2,189.003C186.463,195.42 180.539,202.401 173.212,206.467C165.218,210.904 155.809,213.982 146.533,214.772C140.003,215.328 133.915,215.112 127.586,214.988C124.239,214.923 122.845,216.06 122.934,219.622C123.145,228.116 123.005,236.618 123.001,245.117C122.998,251.059 121.128,252.977 115.061,252.989C97.897,253.025 80.733,253.002 63.568,253.002C51.404,253.002 39.239,253.028 27.074,252.99C21.11,252.972 19.972,251.911 19.969,246.171C19.952,212.512 20.027,178.852 19.931,145.193C19.92,141.244 21.512,139.936 25.206,139.967C36.037,140.056 46.872,139.868 57.7,140.066C61.659,140.139 62.704,138.654 62.9,134.816C63.079,131.328 63.031,127.859 62.985,124.329C62.92,119.388 61.017,118.259 56.858,118.302C47.864,118.397 38.869,118.381 29.875,118.42C29.044,118.424 28.21,118.569 27.382,118.535C20.483,118.255 19.854,117.626 19.858,110.743C19.874,83.582 19.901,56.422 19.946,29.261C19.957,22.709 21.747,21.005 28.509,21.001C45.173,20.992 61.836,20.998 79,20.998M40.806,37.592C39.579,39.018 37.305,40.427 37.283,41.871C37.009,60.012 37.047,78.158 37.045,96.302C37.045,98.812 38.187,100.243 40.973,100.24C46.626,100.235 52.281,100.327 57.93,100.537C61.815,100.681 63.165,99.043 63.06,95.156C62.832,86.672 62.99,78.177 63.001,69.687C63.01,63.101 65.168,60.989 71.882,60.989C92.36,60.99 112.837,60.999 133.315,60.997C139.718,60.996 139.987,60.711 139.998,54.125C140.004,50.629 139.757,47.111 140.059,43.642C140.457,39.073 138.568,37.373 134.101,37.395C103.319,37.551 72.535,37.595 40.806,37.592M62.997,200.455C62.997,187.472 63.078,174.487 62.886,161.507C62.863,159.996 61.38,157.25 60.476,157.208C52.923,156.859 45.347,157.01 37.87,157.01C37.87,182.364 37.917,206.983 37.817,231.602C37.803,235.205 39.289,236.074 42.623,236.055C62.599,235.939 82.576,236.005 102.552,235.977C103.642,235.975 104.732,235.678 105.997,235.493C105.997,229.703 105.875,224.216 106.048,218.738C106.137,215.898 105.136,214.958 102.315,214.998C93.661,215.12 85.004,215.009 76.348,215.006C62.998,215 62.998,215.006 62.997,200.455Z" style="fill:currentColor;fill-rule:nonzero;"/>
- <g transform="matrix(1,0,0,1,91.4761,179.778)">
- <text x="0px" y="0px" style="font-family:'Arial-BoldMT', 'Arial', sans-serif;font-weight:700;font-size:110px;fill:currentColor;">D</text>
- </g>
- </svg>
- </a>
- DunGen
- </label>
-
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../index.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Introduction
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../changelog.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Changelog
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
-
-
- <div class="md-nav__link md-nav__container">
- <a href="../getting-started/index.html" class="md-nav__link ">
-
-
-
- <span class="md-ellipsis">
- Getting Started
-
- </span>
-
- </a>
-
-
- <label class="md-nav__link " for="__nav_3" id="__nav_3_label" tabindex="0">
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- </div>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_3">
- <span class="md-nav__icon md-icon"></span>
- Getting Started
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../getting-started/1-creating-tiles.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- 1. Creating Tiles
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../getting-started/2-doorways.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- 2. Doorways
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../getting-started/3-dungeon-flow.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- 3. Dungeon Flow Basics
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../getting-started/4-scene-setup.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- 4. Scene Setup & First Generation
-
- </span>
-
- </a>
- </li>
-
-
-
- </ul>
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" >
-
-
- <div class="md-nav__link md-nav__container">
- <a href="../core-concepts/index.html" class="md-nav__link ">
-
-
-
- <span class="md-ellipsis">
- Core Concepts
-
- </span>
-
- </a>
-
-
- <label class="md-nav__link " for="__nav_4" id="__nav_4_label" tabindex="0">
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- </div>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_4">
- <span class="md-nav__icon md-icon"></span>
- Core Concepts
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../core-concepts/tiles.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Tiles & Tile Component
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../core-concepts/weighting.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Weighting
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../core-concepts/tile-sets.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Tile Sets
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../core-concepts/archetypes.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Archetypes
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../core-concepts/doorways.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Doorways
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../core-concepts/dungeon-flow.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Dungeon Flow Asset
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../core-concepts/flow-editor.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Flow Editor
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../core-concepts/dungeon-generator.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Dungeon Generator
-
- </span>
-
- </a>
- </li>
-
-
-
- </ul>
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" >
-
-
- <div class="md-nav__link md-nav__container">
- <a href="../advanced-features/index.html" class="md-nav__link ">
-
-
-
- <span class="md-ellipsis">
- Advanced Features
-
- </span>
-
- </a>
-
-
- <label class="md-nav__link " for="__nav_5" id="__nav_5_label" tabindex="0">
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- </div>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_5">
- <span class="md-nav__icon md-icon"></span>
- Advanced Features
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/props-variety.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Props for Variety
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/doors.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Doors
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/multiple-floors.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Multiple Floors
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/lock-key-system.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Lock & Key System
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/injecting-tiles.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Injecting Special Tiles
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/connection-rules.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Tile Connection Rules
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/attached-dungeons.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Generating Attached Dungeons
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/additional-collisions.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Avoid Collisions With the Scene
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/runtime-events.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Runtime Events & Code Execution
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/post-processing.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Custom Post-Processing
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../advanced-features/character-component.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- DunGen Character Component
-
- </span>
-
- </a>
- </li>
-
-
-
- </ul>
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--active md-nav__item--nested">
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" checked>
-
-
- <div class="md-nav__link md-nav__container">
- <a href="index.html" class="md-nav__link ">
-
-
-
- <span class="md-ellipsis">
- Optimization
-
- </span>
-
- </a>
-
-
- <label class="md-nav__link " for="__nav_6" id="__nav_6_label" tabindex="0">
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- </div>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="true">
- <label class="md-nav__title" for="__nav_6">
- <span class="md-nav__icon md-icon"></span>
- Optimization
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="culling.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Built-in Culling
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--active">
-
- <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
-
-
-
-
-
- <label class="md-nav__link md-nav__link--active" for="__toc">
-
-
-
- <span class="md-ellipsis">
- Tile Pooling
-
- </span>
-
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <a href="tile-pooling.html" class="md-nav__link md-nav__link--active">
-
-
-
- <span class="md-ellipsis">
- Tile Pooling
-
- </span>
-
- </a>
-
-
- <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
-
-
-
-
-
-
- <label class="md-nav__title" for="__toc">
- <span class="md-nav__icon md-icon"></span>
- Table of contents
- </label>
- <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
-
- <li class="md-nav__item">
- <a href="#what-is-tile-pooling" class="md-nav__link">
- <span class="md-ellipsis">
- What is Tile Pooling?
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#enabling-tile-pooling" class="md-nav__link">
- <span class="md-ellipsis">
- Enabling Tile Pooling
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#pre-warming-the-pool" class="md-nav__link">
- <span class="md-ellipsis">
- Pre-Warming the Pool
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Pre-Warming the Pool">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#creating-the-tile-pool-preloader" class="md-nav__link">
- <span class="md-ellipsis">
- Creating the Tile Pool Preloader
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#using-the-pre-loader" class="md-nav__link">
- <span class="md-ellipsis">
- Using the Pre-loader
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#managing-state" class="md-nav__link">
- <span class="md-ellipsis">
- Managing State
- </span>
- </a>
-
- </li>
-
- </ul>
-
- </nav>
-
- </li>
-
-
-
- </ul>
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
-
-
- <div class="md-nav__link md-nav__container">
- <a href="../pathfinding/index.html" class="md-nav__link ">
-
-
-
- <span class="md-ellipsis">
- Pathfinding
-
- </span>
-
- </a>
-
-
- <label class="md-nav__link " for="__nav_7" id="__nav_7_label" tabindex="0">
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- </div>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_7">
- <span class="md-nav__icon md-icon"></span>
- Pathfinding
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../pathfinding/unity-navmesh.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Unity NavMesh Components
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../pathfinding/astar-pathfinding.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- A* Pathfinding Project Pro
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../pathfinding/custom-adapters.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Custom Adapters
-
- </span>
-
- </a>
- </li>
-
-
-
- </ul>
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
-
-
- <div class="md-nav__link md-nav__container">
- <a href="../integrations/index.html" class="md-nav__link ">
-
-
-
- <span class="md-ellipsis">
- Integrations
-
- </span>
-
- </a>
-
-
- <label class="md-nav__link " for="__nav_8" id="__nav_8_label" tabindex="0">
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- </div>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_8">
- <span class="md-nav__icon md-icon"></span>
- Integrations
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../integrations/sectr.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- SECTR Portal Culling
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../integrations/playmaker.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- PlayMaker Actions
-
- </span>
-
- </a>
- </li>
-
-
-
- </ul>
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >
-
-
- <div class="md-nav__link md-nav__container">
- <a href="../troubleshooting/index.html" class="md-nav__link ">
-
-
-
- <span class="md-ellipsis">
- Troubleshooting
-
- </span>
-
- </a>
-
-
- <label class="md-nav__link " for="__nav_9" id="__nav_9_label" tabindex="0">
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- </div>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_9">
- <span class="md-nav__icon md-icon"></span>
- Troubleshooting
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../troubleshooting/limitations.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Limitations & Considerations
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../troubleshooting/analysis.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Analysis
-
- </span>
-
- </a>
- </li>
-
-
-
- </ul>
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--nested">
-
-
-
- <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
-
-
- <label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
-
-
-
- <span class="md-ellipsis">
- Reference
-
- </span>
-
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
- <label class="md-nav__title" for="__nav_10">
- <span class="md-nav__icon md-icon"></span>
- Reference
- </label>
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../reference/faq.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- FAQ
-
- </span>
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../reference/cookbook.html" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Cookbook
-
- </span>
-
- </a>
- </li>
-
-
-
- </ul>
- </nav>
-
- </li>
-
-
- </ul>
- </nav>
- </div>
- </div>
- </div>
-
-
-
- <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
- <div class="md-sidebar__scrollwrap">
- <div class="md-sidebar__inner">
-
- <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
-
-
-
-
-
-
- <label class="md-nav__title" for="__toc">
- <span class="md-nav__icon md-icon"></span>
- Table of contents
- </label>
- <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
-
- <li class="md-nav__item">
- <a href="#what-is-tile-pooling" class="md-nav__link">
- <span class="md-ellipsis">
- What is Tile Pooling?
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#enabling-tile-pooling" class="md-nav__link">
- <span class="md-ellipsis">
- Enabling Tile Pooling
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#pre-warming-the-pool" class="md-nav__link">
- <span class="md-ellipsis">
- Pre-Warming the Pool
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Pre-Warming the Pool">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#creating-the-tile-pool-preloader" class="md-nav__link">
- <span class="md-ellipsis">
- Creating the Tile Pool Preloader
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#using-the-pre-loader" class="md-nav__link">
- <span class="md-ellipsis">
- Using the Pre-loader
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#managing-state" class="md-nav__link">
- <span class="md-ellipsis">
- Managing State
- </span>
- </a>
-
- </li>
-
- </ul>
-
- </nav>
- </div>
- </div>
- </div>
-
-
-
- <div class="md-content" data-md-component="content">
- <article class="md-content__inner md-typeset">
-
-
- <h1 id="optimization-tile-pooling">Optimization: Tile Pooling</h1>
- <div class="admonition warning">
- <p class="admonition-title">Important Consideration</p>
- <p>Enabling Tile Pooling requires careful management of object states within your Tiles. Objects might persist in an altered state (e.g., an opened chest) when a Tile is reused. See the <a href="#managing-state">Managing State</a> section for more details.</p>
- </div>
- <h2 id="what-is-tile-pooling">What is Tile Pooling?</h2>
- <p>By default, when a Tile is no longer needed, it is simply destroyed. By contrast, with Tile Pooling enabled, Tiles are instead disabled and returned to the pool when they are no longer needed. This allows them to be reused later, avoiding costly instantiation of new Tile GameObjects.</p>
- <p>As you can see from the charts below, enabling Tile Pooling significantly speeds up dungeon generation, reducing time spent on instantiating tiles by as much as 70%.</p>
- <p><img align="left" alt="Tile Pooling Performance - Basic Sample" src="../assets/images/optimization/pooling-performance-basic.png" width="45%" /></p>
- <p><img alt="Tile Pooling Performance - Dungeon Crawler Sample" src="../assets/images/optimization/pooling-performance-dungeon-crawler.png" width="45%" /></p>
- <div style="clear: both;"></div>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>Tile Pooling will not improve the generation speed of the first dungeon you generate, as there will be no Tiles in the pool at that point. See the <a href="#pre-warming-the-pool">Pre-Warming the Pool</a> section below to see how pooling can be used to improve first-run dungeons as well.</p>
- </div>
- <hr />
- <h2 id="enabling-tile-pooling">Enabling Tile Pooling</h2>
- <p>Tile Pooling can be enabled from the project settings (<code>Edit > Project Settings... > DunGen</code>). Under the 'Optimization' section, check the <strong><code>Enable Tile Pooling</code></strong> checkbox. That's it! DunGen will now reuse old tiles.</p>
- <hr />
- <h2 id="pre-warming-the-pool">Pre-Warming the Pool</h2>
- <p>By default, Tile Pooling will only improve performance in subsequent dungeon generations, as there are no tiles yet in the pool for the initial generation. We can solve this by pre-warming the pool with some tiles that we will instantiate in the editor and save alongside the scene. We do this with the <code>Tile Pool Preloader</code> component.</p>
- <h3 id="creating-the-tile-pool-preloader">Creating the <code>Tile Pool Preloader</code></h3>
- <ol>
- <li>Create a new GameObject in your scene</li>
- <li>Add the <code>Tile Pool Preloader</code> component (<code>Add Component > DunGen > Pooling > Tile Pool Pre-loader</code>)</li>
- </ol>
- <h3 id="using-the-pre-loader">Using the Pre-loader</h3>
- <p>The main area of interest in the inspector is the 'Tile Pool Entries' list. New entries can be added to the list by simply dragging DunGen assets (<code>Tile</code>, <code>TileSet</code>, <code>Archetype</code>, or <code>DungeonFlow</code>) from your project view onto the list. All Tiles in the asset will be extracted and put into the list.</p>
- <p><strong>Tile Pool Entries</strong></p>
- <p>Each entry in the list has two components:</p>
- <ul>
- <li><strong>Tile:</strong> The Tile prefab we want to add to the pool</li>
- <li><strong>Count:</strong> The number of instances we want to seed the pool with</li>
- </ul>
- <p><strong>Utilities</strong></p>
- <p>For ease of use, there is a 'List Controls' foldout at the top of the inspector which includes some tools for speeding up the process.</p>
- <ul>
- <li><strong>Clear List (Button):</strong> Clears all entries from the list.</li>
- <li><strong>Set All Counts:</strong> Type in a number and press the <strong>Apply</strong> button and the instance count for all tiles in the list will be set all at once.</li>
- </ul>
- <p><strong>Creating Instances</strong></p>
- <p>Clicking the <strong>Refresh Instances</strong> button will prompt you to confirm that you would like to instantiate the specified number of tiles, once you accept, it will update the Tile instances spawned inside your scene to match the chosen instance counts. Pressing the <strong>Clear Instances</strong> button will destroy all spawned Tile instances.</p>
- <div class="admonition note">
- <p class="admonition-title">How Many Tiles Should I Pre-load?</p>
- <p>The ideal number depends on your project's specific needs. A good starting point is to estimate the maximum number of each Tile type you expect to see in your largest possible dungeon configuration. Pre-loading enough to cover this means you might avoid runtime instantiation altogether, but will increase initial scene loading times and memory usage. Insufficient pre-loading means you still gain benefits but might occasionally instantiate new tiles at runtime if the pool runs dry. Experimentation is key to finding the right balance for your target platform and dungeon complexity.</p>
- </div>
- <p>Now, when DunGen generates a new DunGen on this scene, it will automatically pull in all of the Tile instances created by the pre-loader and put them into the pool, ready for use immediately.</p>
- <hr />
- <h2 id="managing-state">Managing State</h2>
- <p>There is a major downside to enabling Tile Pooling to consider. Now that Tiles are reused, they will retain any changes made to them by the player. For example, if the player opens a treasure chest in the boss room, the next time that boss room is needed, the chest will still be open from before.</p>
- <p>This means that any stateful object will either need to be:</p>
- <ul>
- <li>Spawned outside of your Tiles (ideally attached to the Dungeon root so it will be automatically cleaned up).</li>
- <li>Have their state reset when the Tile it's in is returned to the pool.</li>
- </ul>
- <p>You can receive a callback on any object inside a Tile when its containing Tile is <strong>taken from the pool (spawned)</strong> or <strong>returned to the pool (de-spawned)</strong> by implementing the <code>ITileSpawnEventReceiver</code> interface. Implement the following functions:</p>
- <div class="language-C# highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="c1">// Called when the Tile instance containing this component is retrieved from the pool and placed in the dungeon</span>
- </span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="k">void</span><span class="w"> </span><span class="nf">OnTileSpawned</span><span class="p">(</span><span class="n">Tile</span><span class="w"> </span><span class="n">tile</span><span class="p">);</span>
- </span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>
- </span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="c1">// Called just before the Tile instance containing this component is disabled and returned to the pool</span>
- </span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="k">void</span><span class="w"> </span><span class="nf">OnTileDespawned</span><span class="p">(</span><span class="n">Tile</span><span class="w"> </span><span class="n">tile</span><span class="p">);</span>
- </span></code></pre></div>
- <p>Use <code>OnTileSpawned</code> or <code>OnTileDespawned</code> to reset the state of your interactive objects (e.g., close chests, reset enemy spawners, restore breakable objects) before the Tile is potentially reused.</p>
- <hr />
- <p>Tile Pooling can be a powerful option for reducing dungeon generation times, but it requires a more thoughtful approach to designing Tiles with interactive elements.</p>
-
- </article>
- </div>
-
-
- <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script>
- <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
- </div>
-
- <button type="button" class="md-top md-icon" data-md-component="top" hidden>
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg>
- Back to top
- </button>
-
- </main>
-
- <footer class="md-footer">
-
-
-
- <nav class="md-footer__inner md-grid" aria-label="Footer" >
-
-
- <a href="culling.html" class="md-footer__link md-footer__link--prev" aria-label="Previous: Built-in Culling">
- <div class="md-footer__button md-icon">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
- </div>
- <div class="md-footer__title">
- <span class="md-footer__direction">
- Previous
- </span>
- <div class="md-ellipsis">
- Built-in Culling
- </div>
- </div>
- </a>
-
-
-
- <a href="../pathfinding/index.html" class="md-footer__link md-footer__link--next" aria-label="Next: Overview">
- <div class="md-footer__title">
- <span class="md-footer__direction">
- Next
- </span>
- <div class="md-ellipsis">
- Overview
- </div>
- </div>
- <div class="md-footer__button md-icon">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11z"/></svg>
- </div>
- </a>
-
- </nav>
-
-
- <div class="md-footer-meta md-typeset">
- <div class="md-footer-meta__inner md-grid">
- <div class="md-copyright">
-
- <div class="md-copyright__highlight">
- Copyright © Aegon Games Ltd.
- </div>
-
-
- Made with
- <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
- Material for MkDocs
- </a>
-
- </div>
-
- </div>
- </div>
- </footer>
-
- </div>
- <div class="md-dialog" data-md-component="dialog">
- <div class="md-dialog__inner md-typeset"></div>
- </div>
-
-
-
-
- <script id="__config" type="application/json">{"base": "..", "features": ["content.code.annotate", "content.code.copy", "content.tabs.link", "announce.dismiss", "header.autohide", "navigation.footer", "navigation.indexes", "navigation.top", "navigation.tracking"], "search": "../assets/javascripts/workers/search.f8cc74c7.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
-
-
- <script src="../assets/javascripts/bundle.c8b220af.min.js"></script>
-
-
- </body>
- </html>
|