{"author_link":"\/users\/invader","author_name":"invader","author_uid":"invader","comments":[],"epoch":1587677637,"event":"LD46","format":"md","ldjam_node_id":207463,"likes":3,"metadata":{"p_key":"144571","p_author":"invader","p_authorkey":"1010718","p_urlkey":"360984","p_title":"Accidental JetPack in Station Keeping","p_cat":"LDJam ","p_event":"LD46","p_time":"1587677637","p_likes":"3","p_comments":"0","p_status":"WAYBACK","us_key":"1010718","us_name":"invader","us_username":"invader","event_start":"1587081600","event_key":"77","event_name":"Ludum Dare 46"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD46","removed_author":false},"_superparent":176557,"_trust":6,"author":10718,"body":"Some functionality is intentional and some can *emerge by an accident*.\n\nThis is a story of jetpack in [Station Keeping](https:\/\/ldjam.com\/events\/ludum-dare\/46\/station-keeping).\n\nI've never intended to have a *jetpack* in the game. The initial design has turbolift to move cosmonauts between station levels.\n\n![station-v3.jpg](\/\/\/raw\/ed9\/2\/z\/32dbf.jpg)\n\nThen, I've introduced a bug in jump implementation. So my fast-prototyped jump code looked something like this:\n\n```\nis jump key pressed?\n    is Hero vertical speed = 0?\n        set Hero vertical speed = JUMP SPEED\n```\n\nAt this point, I didn't want to involve collision detection with tiles and just assumed, that the hero can jump only when vertical speed is zero. The problem is, the vertical speed could be zero not only when the player is on the ground. It is also zero for a very short time when the gravity takes over and starts moving the body back downwards\n\n\nSo, instead of jump, I've implemented an air-jump. The player can jump off the thin air now. *Add to that a particle effect and you'll have a jetpack*.\n\n![sequence-2.gif](\/\/\/raw\/ed9\/2\/z\/32dca.gif)\n\n*Now, why do I need a turbolift?* The player already can move between station levels.\nSo I've increased the jump threshold to be in the range of -0.1 to 0.1 and postponed the turbolift implementation for later into the jam.\n\n\nAs all jammers know, the time passes faster than you realize. I've never managed to implement an actual turbolift. All I've got is a last-minute jet-pack particle effect. It was the only thing, that can justify why a character *jumps of thin air*.\n\n\nBut even that was not without a glitch. The character vertical speed is near zero all the time you hit the ceiling. That creates weird-looking bursts of energy, originating somewhere in the middle of character sprite.\n\n![sequence-1.gif](\/\/\/raw\/ed9\/2\/z\/32dcb.gif)\n\nWell... No time to fix. I've packaged the game and pushed the archive to itch.io.\n\n\nOnly when the first feedback started to appear on the page, I've realized the actual problem.\n\n\nFloating-point calculation and variable delta-time make some things hard to accurately predict. And on some machines, the jetpack didn't work as expected and just created rare sparks with no lift to the character. It resulted in players falling down at the bottom of the space station and not able to get out.\n\n\nSo it was not a jetpack after all. *Just a bug with a particle effect :smiley:.* Kind of a bummer. It breaks the gameplay.\n\n\nOnly on the second day after the jam I've realized the gravity of the problem and created a patch that fixes the jetpack mechanics. And finally, it feels right.\n\n```\nreduce the jetpack pulse timer\nis jetpack pulse timer < 0?\n        increase vertical speed\n        reset the jetpack pulse timer\n```\nIt is a pulsating jet-pack. It has quite different feel than permanent jets I've implemented in other games.\n\n![sequence-3.gif](\/\/\/raw\/ed9\/2\/z\/32dda.gif)\n\nNow I'm happy, that players won't be stuck at the bottom level of the space station :smile:","comments":0,"created":"2020-04-23T20:35:48Z","files":[],"files-timestamp":0,"id":207463,"love":3,"love-timestamp":"2020-04-23T22:36:48Z","meta":[],"modified":"2020-04-23T22:36:48Z","name":"Accidental JetPack in Station Keeping","node-timestamp":"2020-04-23T21:33:57Z","parent":202542,"parents":[1,5,9,176557,202542],"path":"\/events\/ludum-dare\/46\/station-keeping\/accidental-jetpack-in-station-keeping","published":"2020-04-23T21:33:57Z","scope":"public","slug":"accidental-jetpack-in-station-keeping","subsubtype":"","subtype":"","type":"post","version":628273},"node_metadata":{"n_key":"207463","n_urlkey":"360984","n_parent":"202542","n_path":"\/events\/ludum-dare\/46\/station-keeping\/accidental-jetpack-in-station-keeping","n_slug":"accidental-jetpack-in-station-ke","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"10718","n_created":"1587674148","n_modified":"1587681408","n_version":"628273","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/46\/station-keeping\/accidental-jetpack-in-station-keeping","text":"Some functionality is intentional and some can *emerge by an accident*.\n\nThis is a story of jetpack in [Station Keeping](https:\/\/ldjam.com\/events\/ludum-dare\/46\/station-keeping).\n\nI've never intended to have a *jetpack* in the game. The initial design has turbolift to move cosmonauts between station levels.\n\n![station-v3.jpg](\/\/\/raw\/ed9\/2\/z\/32dbf.jpg)\n\nThen, I've introduced a bug in jump implementation. So my fast-prototyped jump code looked something like this:\n\n```\nis jump key pressed?\n    is Hero vertical speed = 0?\n        set Hero vertical speed = JUMP SPEED\n```\n\nAt this point, I didn't want to involve collision detection with tiles and just assumed, that the hero can jump only when vertical speed is zero. The problem is, the vertical speed could be zero not only when the player is on the ground. It is also zero for a very short time when the gravity takes over and starts moving the body back downwards\n\n\nSo, instead of jump, I've implemented an air-jump. The player can jump off the thin air now. *Add to that a particle effect and you'll have a jetpack*.\n\n![sequence-2.gif](\/\/\/raw\/ed9\/2\/z\/32dca.gif)\n\n*Now, why do I need a turbolift?* The player already can move between station levels.\nSo I've increased the jump threshold to be in the range of -0.1 to 0.1 and postponed the turbolift implementation for later into the jam.\n\n\nAs all jammers know, the time passes faster than you realize. I've never managed to implement an actual turbolift. All I've got is a last-minute jet-pack particle effect. It was the only thing, that can justify why a character *jumps of thin air*.\n\n\nBut even that was not without a glitch. The character vertical speed is near zero all the time you hit the ceiling. That creates weird-looking bursts of energy, originating somewhere in the middle of character sprite.\n\n![sequence-1.gif](\/\/\/raw\/ed9\/2\/z\/32dcb.gif)\n\nWell... No time to fix. I've packaged the game and pushed the archive to itch.io.\n\n\nOnly when the first feedback started to appear on the page, I've realized the actual problem.\n\n\nFloating-point calculation and variable delta-time make some things hard to accurately predict. And on some machines, the jetpack didn't work as expected and just created rare sparks with no lift to the character. It resulted in players falling down at the bottom of the space station and not able to get out.\n\n\nSo it was not a jetpack after all. *Just a bug with a particle effect :smiley:.* Kind of a bummer. It breaks the gameplay.\n\n\nOnly on the second day after the jam I've realized the gravity of the problem and created a patch that fixes the jetpack mechanics. And finally, it feels right.\n\n```\nreduce the jetpack pulse timer\nis jetpack pulse timer < 0?\n        increase vertical speed\n        reset the jetpack pulse timer\n```\nIt is a pulsating jet-pack. It has quite different feel than permanent jets I've implemented in other games.\n\n![sequence-3.gif](\/\/\/raw\/ed9\/2\/z\/32dda.gif)\n\nNow I'm happy, that players won't be stuck at the bottom level of the space station :smile:","title":"Accidental JetPack in Station Keeping","wayback_source":[]}