{"author_link":"\/users\/choo","author_name":"Choo","author_uid":"choo","comments":[],"epoch":1696539736,"event":"LD54","format":"md","ldjam_node_id":381666,"likes":19,"metadata":{"p_key":"203601","p_author":"Choo","p_authorkey":"1279507","p_urlkey":"438188","p_title":"The Stretch Tech of Stretchmancer!","p_cat":"LDJam ","p_event":"LD54","p_time":"1696539736","p_likes":"19","p_comments":"0","p_status":"WAYBACK","us_key":"1279507","us_name":"LDJam user 279507","us_username":"279507","event_start":"1695945600","event_key":"117","event_name":"Ludum Dare 54"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD54","removed_author":false},"_superparent":371459,"_trust":2,"author":279507,"body":"# :joystick: [Play Stretchmancer in your browser](https:\/\/ldjam.com\/events\/ludum-dare\/54\/stretchmancer)\n\n![LOyZqY.gif](\/\/\/raw\/3d3\/44\/z\/5fd05.gif)\n\nIn stretchmancer you use your powers to warp the world around you. Can't squeeze through a tight gap? No problem - touch your magic little gecko hand against a wall to stretch the world along that axis.\n\n![K0pRrt.gif](\/\/\/raw\/3d3\/44\/z\/5fcfc.gif)\n\n\nTo keep with the theme **Limited Space** when you stretch along an axis the other dimensions shrink. There's always the same amount of space but it's how you use it that counts! But how to achieve that in a game engine?\n\n## Maths!\nSpace is about volume. The volume of a box is: width x height x depth. \n\n**v = w.h.d**\n\nWe want volume to remain constant as we stretch in one dimension - multiplying it by a scale value (**s**). This means we care about the multipliers for the other dimensions.\nTo keep things straight forward lets say the other dimensions scale down the same amount each (**c**):\n\n**s.w.c.h.c.d = v**\n\nWe know this volume is the same as the original volume so substituting in **v = w.h.d** we get:\n\n**s.c^2.w.h.d = w.h.d**\n\nEliminate and rearrange:\n\n**c = sqrt(1\/s)**\n\nThat's the value that can adjust the other axes and produce:\n\n![Animation2.gif](\/\/\/raw\/3d3\/44\/z\/5fcfd.gif)\n\n## Stretchy Spaces!\nNow 3D game engines tend to support scale in their transform systems. We can group objects under a single scalable parent and they'll inherit the scale themselves. Neat!\n\nThough what if the player capsule is standing on something that scales? If we don't inherit the scale the floor will slide from underneath us. But we don't want to be a child of the group as we'll scale our size with it.\nThe trick is to apply the scale to the player's position only, not the player's scale.\n\nIn fact this trick can be used on anything that wants to ignore the scale of the world but keep its relative position. Notice how the blue blocks (compactonium floaters!) don't change size as the level scales but do adjust position. Now we can have lots of little scalable islands that all track their positions with each other (no sliding!). Tasty puzzle ingredients to torture our Agora hero with!\n\n![Animation.gif](\/\/\/raw\/3d3\/44\/z\/5fcfe.gif)\n\n# :frog: [Give the game a go!](https:\/\/ldjam.com\/events\/ludum-dare\/54\/stretchmancer)\n\n","comments":8,"comments-timestamp":"2023-10-06T11:22:50Z","created":"2023-10-05T20:33:45Z","files":[],"files-timestamp":0,"id":381666,"love":19,"love-timestamp":"2023-10-11T13:29:39Z","meta":[],"modified":"2023-10-11T13:29:39Z","name":"The Stretch Tech of Stretchmancer!","node-timestamp":"2023-10-07T12:54:36Z","parent":380416,"parents":[1,5,9,371459,380416],"path":"\/events\/ludum-dare\/54\/stretchmancer\/the-stretch-tech-of-stretchmancer","published":"2023-10-05T21:02:16Z","scope":"public","slug":"the-stretch-tech-of-stretchmancer","subsubtype":"","subtype":"","type":"post","version":1188345},"node_metadata":{"n_key":"381666","n_urlkey":"438188","n_parent":"380416","n_path":"\/events\/ludum-dare\/54\/stretchmancer\/the-stretch-tech-of-stretchmancer","n_slug":"the-stretch-tech-of-stretchmance","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"279507","n_created":"1696538025","n_modified":"1697030979","n_version":"1188345","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/54\/stretchmancer\/the-stretch-tech-of-stretchmancer","text":"# :joystick: [Play Stretchmancer in your browser](https:\/\/ldjam.com\/events\/ludum-dare\/54\/stretchmancer)\n\n![LOyZqY.gif](\/\/\/raw\/3d3\/44\/z\/5fd05.gif)\n\nIn stretchmancer you use your powers to warp the world around you. Can't squeeze through a tight gap? No problem - touch your magic little gecko hand against a wall to stretch the world along that axis.\n\n![K0pRrt.gif](\/\/\/raw\/3d3\/44\/z\/5fcfc.gif)\n\n\nTo keep with the theme **Limited Space** when you stretch along an axis the other dimensions shrink. There's always the same amount of space but it's how you use it that counts! But how to achieve that in a game engine?\n\n## Maths!\nSpace is about volume. The volume of a box is: width x height x depth. \n\n**v = w.h.d**\n\nWe want volume to remain constant as we stretch in one dimension - multiplying it by a scale value (**s**). This means we care about the multipliers for the other dimensions.\nTo keep things straight forward lets say the other dimensions scale down the same amount each (**c**):\n\n**s.w.c.h.c.d = v**\n\nWe know this volume is the same as the original volume so substituting in **v = w.h.d** we get:\n\n**s.c^2.w.h.d = w.h.d**\n\nEliminate and rearrange:\n\n**c = sqrt(1\/s)**\n\nThat's the value that can adjust the other axes and produce:\n\n![Animation2.gif](\/\/\/raw\/3d3\/44\/z\/5fcfd.gif)\n\n## Stretchy Spaces!\nNow 3D game engines tend to support scale in their transform systems. We can group objects under a single scalable parent and they'll inherit the scale themselves. Neat!\n\nThough what if the player capsule is standing on something that scales? If we don't inherit the scale the floor will slide from underneath us. But we don't want to be a child of the group as we'll scale our size with it.\nThe trick is to apply the scale to the player's position only, not the player's scale.\n\nIn fact this trick can be used on anything that wants to ignore the scale of the world but keep its relative position. Notice how the blue blocks (compactonium floaters!) don't change size as the level scales but do adjust position. Now we can have lots of little scalable islands that all track their positions with each other (no sliding!). Tasty puzzle ingredients to torture our Agora hero with!\n\n![Animation.gif](\/\/\/raw\/3d3\/44\/z\/5fcfe.gif)\n\n# :frog: [Give the game a go!](https:\/\/ldjam.com\/events\/ludum-dare\/54\/stretchmancer)\n\n","title":"The Stretch Tech of Stretchmancer!","wayback_source":[]}