{"id":348,"date":"2012-12-10T21:42:54","date_gmt":"2012-12-11T03:42:54","guid":{"rendered":"http:\/\/elysianshadows.com\/2012\/12\/elysian-physics-sandbox-part-1\/"},"modified":"2012-12-10T21:42:54","modified_gmt":"2012-12-11T03:42:54","slug":"elysian-physics-sandbox-part-1","status":"publish","type":"post","link":"http:\/\/elysianshadows.com\/updates\/elysian-physics-sandbox-part-1\/","title":{"rendered":"Elysian Physics Sandbox Part 1"},"content":{"rendered":"\n<p><span style=\"color: #cc99ff;\"><strong>Combining Terrain and Object Layer Collision Primitives<\/strong><\/span><br \/>After I got all of the collision primitives implemented within the Engine, I decided to go ahead and implement an &#8220;optimization&#8221; of sorts. So since we have two layers, each containing an object and terrain layer, each tile location technically requires two collision passes (since terrain and objects can both have independent solidity types). This is pretty damn wasteful. So I began the painstaking endeavor of creating a 20&#215;20 LUT for combining Tile::COLLIDER_TYPEs. I was able to narrow it down to an arithmetic function (spatial complexity, it&#8217;s constant time) by being a little clever with indexing and using a jump table\/switch statement. It&#8217;s still a fucking beast, though.<\/p>\n<p>We are now supporting every non-angled type that Chrono Trigger supports, and then some. Here is the COLLIDER_TYPE enumeration for now&#8230; More angles on the way.<\/p>\n<p>[code] enum COLLIDER_TYPE {<br \/>COLLIDER_NONE, COLLIDER_FULL,<br \/>COLLIDER_HALF_E, COLLIDER_HALF_N, COLLIDER_HALF_W, COLLIDER_HALF_S,<br \/>COLLIDER_QUAD_SE, COLLIDER_QUAD_NE, COLLIDER_QUAD_NW, COLLIDER_QUAD_SW,<br \/>COLLIDER_L_SE, COLLIDER_L_NE, COLLIDER_L_NW, COLLIDER_L_SW,<br \/>COLLIDER_QUADS_SE_NW, COLLIDER_QUADS_SW_NE,<br \/>COLLIDER_45DEG_SE, COLLIDER_45DEG_NE, COLLIDER_45DEG_NW, COLLIDER_45DEG_SW,<br \/>COLLIDER_MAX<br \/>} colliderType;[\/code]<\/p>\n<p>Since we are now dynamically combining the terrain and object layers for a single collision pass, we had to support a few other combinations that Trigger didn&#8217;t bother with. Namely quadrant collision with two diagonal corner solidity.<\/p>\n<p>Due to the sheer magnitude of the combination function, this is going to need some serious testing from Tyler&#8230; It&#8217;s possible that I may have accidentally screwed up a few tile combinations. Not a big deal, but we need to test the living shit out of this&#8230;<\/p>\n<p><span style=\"color: #cc99ff;\"><strong>Toggling Solidity in Gamma<\/strong><\/span><br \/>For the sake of debugging physics, I have added more layer toggles. In addition to toggling the rendering of each layer with buttons 0-4, you can now use buttons 5-7 for solidity toggles:<br \/>5 &#8211; Toggle Render Terrain Solidity<br \/>6 &#8211; Toggle Render Object Solidity<br \/>7 &#8211; Toggle Render Combined Solidity<\/p>\n<p>A few things to note. This is for the &#8220;current layer.&#8221; So if the player is on layer 1, it&#8217;s rendering layer 1 solidity. If he&#8217;s on layer 2, it&#8217;s rendering layer 2 solidity. Toggling Combined solidity disables independent Terrain\/Object solidity for the sake of sanity.<\/p>\n<p>A useful application of this would be to toggle Terrain, then toggle Object. Since it&#8217;s blue and transparent, you can see the overlap regions. Then when you switch to &#8220;combined,&#8221; you should be able to see the geometry properly combine itself into a single layer.<\/p>\n<p>Anyway, the physics sandbox area I have been creating has grown quite a bit more complex. I also threw several more entities in there to really stress test the engine and physics algorithms. Stacking shitloads of entities does indeed work, and collision resolution is correct. It can start to get a bit jittery when you chain a bunch of shit together, but the resolution is still correct. This is a very common issue with impulse-based physics engines (ESPECIALLY with stacked objects being affected by gravity), and I will wait to address it until we&#8217;re further along in development, since it is quite stable and still completely accurate. Just making you gents aware that it&#8217;s on the backlog&#8230;<\/p>\n<p><strong><span style=\"color: #cc99ff;\">Exposing Tile Collider Primitives to ESTk<\/span><\/strong><br \/>I&#8217;m still not done with this, and Tyler is going to be helping me. As with other &#8220;selectables,&#8221; tile attributes are to be modified within the SelectionView. Unfortunately Qt&#8217;s default property representation within its views only supports booleans (checkboxes), integers (spinboxes), and strings (line edits). I had to create a relatively complex new Qt Delegate within the Toolkit (I will spare you the details) to represent tile collider types (its an enumeration). It will show up as a string name and an icon.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-347\" src=\"http:\/\/elysianshadows.com\/updates\/wp-content\/uploads\/2012\/12\/esdevphyz2.png\" alt=\"\" width=\"879\" height=\"549\" width=\"1280\" height=\"800\" srcset=\"http:\/\/elysianshadows.com\/updates\/wp-content\/uploads\/2012\/12\/esdevphyz2.png 1280w, http:\/\/elysianshadows.com\/updates\/wp-content\/uploads\/2012\/12\/esdevphyz2-300x187.png 300w, http:\/\/elysianshadows.com\/updates\/wp-content\/uploads\/2012\/12\/esdevphyz2-1024x640.png 1024w\" sizes=\"auto, (max-width: 879px) 100vw, 879px\" \/><\/p>\n<p>Tyler is going to have to draw 20 little 16&#215;16 icons for this field and the DropDown menu. The angel is just a placeholder.<\/p>\n<p>But anyway, this already fully works. You can change the attributes for each object and tile, lay them ontop of each other, then see the resulting collision layer within the Engine.<\/p>\n<p>Once we finish implementing the icons, I am going to also give the Toolkit the ability to render the solidity layers. There will be an option for enabling it within SheetView (so you can see per-tile) and one for enabling it within MapView (so that you can see it on the map for your current layer).<\/p>\n<p><strong><span style=\"color: #cc99ff;\">Toolkit Default\/Startup Tile Layer<\/span><\/strong><br \/>When the Toolkit started up or levels were changed, the default layer was always Object 2. This started to piss me off so much when I began really using it closely with the engine, since Tile 1 is the main layer that you will probably be editing&#8230; Modified this behavior.<\/p>\n<p><strong><span style=\"color: #cc99ff;\">Tyler<\/span><\/strong><br \/>Tyler, if you want to get a head start on icon production, have a look at Engine\/assetio\/include\/elysian_tile.hpp. We will need one for each entry into the Tile::COLLIDER_TYPE enumeration.&nbsp;Just name them whatever they&#8217;re called in the enum with a .png extension. 16&#215;16 as usual. I would make them blue and transparent (since we&#8217;re rendering it as blue in the Toolkit and Engine).<\/p>\n<p>Anyway, I&#8217;m excited as shit for this next update. All we need after we expose all this shit to the Toolkit is to properly handle Z ordering and implement layer-swapping (ladders, stairs, ropes, etc), and the &#8220;exploration\/environment&#8221; portion of the engine is 100% go. Explore your levels in-game as you make them&#8230; It will be time to focus on gameplay.<\/p>\n<p class=\"readmore\"><a href=\"http:\/\/forums.elysianshadows.com\/viewtopic.php?f=48&amp;t=8403\">DISCUSSION TOPIC<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been pretty busy over here at Studio Vorbis dual wielding the Engine and Toolkit this last week. In the interest of not destroying you guys with a 10 page article that nobody winds up reading when I&#8217;m done with all of this, I will be posting updates iteratively. As you should know, I am continuing my work with the physics sandbox. It is actually complete for the most part. Or at least as far as I am willing to take it at this point in the project. Full collision support for every layer, every important tile collider type implemented, mass aggregate physics working. The rest will come later (when everybody is off of their asses and working), so that I will not be halting all progress to implement a few very time consuming corner cases.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-346\" src=\"http:\/\/elysianshadows.com\/updates\/wp-content\/uploads\/2012\/12\/esdevphyz1.png\" alt=\"\" width=\"909\" height=\"568\" width=\"1280\" height=\"800\" srcset=\"http:\/\/elysianshadows.com\/updates\/wp-content\/uploads\/2012\/12\/esdevphyz1.png 1280w, http:\/\/elysianshadows.com\/updates\/wp-content\/uploads\/2012\/12\/esdevphyz1-300x187.png 300w, http:\/\/elysianshadows.com\/updates\/wp-content\/uploads\/2012\/12\/esdevphyz1-1024x640.png 1024w\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" \/><\/p>\n","protected":false},"author":1,"featured_media":346,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[53,56,57,13,31,51,52,54,55,19],"class_list":["post-348","post","type-post","status-publish","format-standard","hentry","category-underlying-technology","tag-2d-physics","tag-collider","tag-delegate","tag-elysian-shadows","tag-engine","tag-indie-game-dev","tag-physics","tag-rigid-body","tag-tile-collision","tag-toolkit"],"_links":{"self":[{"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/posts\/348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/comments?post=348"}],"version-history":[{"count":0,"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/posts\/348\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/media\/346"}],"wp:attachment":[{"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/media?parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/categories?post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/elysianshadows.com\/updates\/wp-json\/wp\/v2\/tags?post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}