{"author_link":"\/users\/coleslaughter","author_name":"ColeSlaughter","author_uid":"coleslaughter","comments":[],"epoch":1544092116,"event":"LD43","format":"md","ldjam_node_id":136340,"likes":5,"metadata":{"p_key":"126493","p_author":"ColeSlaughter","p_authorkey":"1013882","p_urlkey":"342613","p_title":"What is the most egregious thing in your game?","p_cat":"LDJam ","p_event":"LD43","p_time":"1544092116","p_likes":"5","p_comments":"0","p_status":"WAYBACK","us_key":"1013882","us_name":"ColeSlaughter","us_username":"coleslaughter","event_start":"1543536000","event_key":"71","event_name":"LD 43"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD43","removed_author":false},"_superparent":120415,"_trust":10,"author":13882,"body":"I'm sure we're all familiar with the fact that in a game jam setting, some corners just HAVE to be cut in order to make the deadline.  This often results in some pretty hilarious shortcuts that are just plain horrifying to anyone trying to make something decent, extensible, and optimized.\n\nSo I figure I'd use this opportunity to air some dirty laundry and talk about my biggest shame in my team's game, [Serial Dater](https:\/\/ldjam.com\/events\/ludum-dare\/43\/serial-dater)\n\nIn Serial Dater, you use various powers to dig into a potential suitor's psyche and determine whether they are safe to date, or actually a serial killer.  One of those powers is a supernatural seduction that tasks the player with typing various flirt words to get the date to confess their deepest, darkest secret.\n\n![seduction.png](\/\/\/raw\/a36\/3\/z\/1f387.png)\n\nAs you type out a word, it highlights in green until the word is completed.  If that word was the date's weakness, then they'll confess their secret.\n\nHow this was accomplished wounds me to my core.\n\nFirst of all, recognizing the specific key stroke a player makes in Unity when ANY key is hit was not as easy as I thought.  There is no \"Get pressed key value\" function that I was aware of.  So instead, I had this pretty little list of valid keycodes:\n![keyCodes.png](\/\/\/raw\/a36\/3\/z\/1f389.png)\n\nThen, every frame I looped through all of those keycodes to see if any of them were pressed.\n\n![update.png](\/\/\/raw\/a36\/3\/z\/1f38c.png)\n\nAs you can imagine, the most common case was that the player wasn't typing ANYTHING.  And yet this loop STILL executed 26 time per frame.  Not great.\n\nBut not the worst thing, I guess?  I mean, at least the rest of the code looks fine.  For example what about the code that determines if a correct character is pressed?  Well...\n\n![forLoop.png](\/\/\/raw\/a36\/3\/z\/1f391.png)\n\n...Oh what the fresh hell is this.\n\nThis is game jam code if I've ever seen it.  SUPER specific conditional statements that are easy to break if even the slightest thing is changes elsewhere in the game.  Impossible to read or follow without focusing super hard just to figure out what one loop iteration does.  This is the pile of vomit that is quietly concealed by a large, conspicuous rug with a sticky note that says \"do not remove.\"\n\nHow about the text highlighting, you may ask?  Surely that was simple.  Perhaps some rich text tags or TextMeshPro functions?\n\nA reasonable person would assume that.\n\nIn a game jam scenario, reason is sometimes thrown out the window.\n\nBecause I was string-parsing to determine if a correct word was being typed, any sort of rich text tag tomfoolery was thrown out the window.  Also, while technically possible to accomplish per-character shading in TextMeshPro, the documentation for how to do so is downright *abysmal* to the point where I just came up with a faster solution:\n\n![flirtText.png](\/\/\/raw\/a36\/3\/z\/1f39b.png)\n\nJust have a child TextMeshPro object with an empty string inside, and type green text on top of the word that the player is typing.  Perfect.  What could possibly go wrong?  Except for maybe dynamic font sizes, variable movement speeds, auto-orientation issues, and unpredictable kerning?\n\nThis is EASILY the aspect of the game that ate up the most of my time, and the amount of corners I cut made it some of the ugliest stuff in the game's source code.  But hey, it works, and that's all that matters!\n\n(At least as long as I'm okay with rewriting everything if I want to expand anything in the future...)\n\nHow about y'all?  What sorts of massive shortcuts did you have to take in order to make sure you had something shippable by the end of the weekend?","comments":9,"comments-timestamp":"2018-12-06T19:26:42Z","created":"2018-12-06T10:04:57Z","files":[],"files-timestamp":0,"id":136340,"love":5,"love-timestamp":"2018-12-06T21:13:23Z","meta":[],"modified":"2018-12-06T21:13:23Z","name":"What is the most egregious thing in your game?","node-timestamp":"2018-12-06T10:28:36Z","parent":124227,"parents":[1,5,9,120415,124227],"path":"\/events\/ludum-dare\/43\/serial-dater\/what-is-the-most-egregious-thing-in-your-game","published":"2018-12-06T10:28:36Z","scope":"public","slug":"what-is-the-most-egregious-thing-in-your-game","subsubtype":"","subtype":"","type":"post","version":409298},"node_metadata":{"n_key":"136340","n_urlkey":"342613","n_parent":"124227","n_path":"\/events\/ludum-dare\/43\/serial-dater\/what-is-the-most-egregious-thing-in-your-game","n_slug":"what-is-the-most-egregious-thing","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"13882","n_created":"1544090697","n_modified":"1544130803","n_version":"409298","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/43\/serial-dater\/what-is-the-most-egregious-thing-in-your-game","text":"I'm sure we're all familiar with the fact that in a game jam setting, some corners just HAVE to be cut in order to make the deadline.  This often results in some pretty hilarious shortcuts that are just plain horrifying to anyone trying to make something decent, extensible, and optimized.\n\nSo I figure I'd use this opportunity to air some dirty laundry and talk about my biggest shame in my team's game, [Serial Dater](https:\/\/ldjam.com\/events\/ludum-dare\/43\/serial-dater)\n\nIn Serial Dater, you use various powers to dig into a potential suitor's psyche and determine whether they are safe to date, or actually a serial killer.  One of those powers is a supernatural seduction that tasks the player with typing various flirt words to get the date to confess their deepest, darkest secret.\n\n![seduction.png](\/\/\/raw\/a36\/3\/z\/1f387.png)\n\nAs you type out a word, it highlights in green until the word is completed.  If that word was the date's weakness, then they'll confess their secret.\n\nHow this was accomplished wounds me to my core.\n\nFirst of all, recognizing the specific key stroke a player makes in Unity when ANY key is hit was not as easy as I thought.  There is no \"Get pressed key value\" function that I was aware of.  So instead, I had this pretty little list of valid keycodes:\n![keyCodes.png](\/\/\/raw\/a36\/3\/z\/1f389.png)\n\nThen, every frame I looped through all of those keycodes to see if any of them were pressed.\n\n![update.png](\/\/\/raw\/a36\/3\/z\/1f38c.png)\n\nAs you can imagine, the most common case was that the player wasn't typing ANYTHING.  And yet this loop STILL executed 26 time per frame.  Not great.\n\nBut not the worst thing, I guess?  I mean, at least the rest of the code looks fine.  For example what about the code that determines if a correct character is pressed?  Well...\n\n![forLoop.png](\/\/\/raw\/a36\/3\/z\/1f391.png)\n\n...Oh what the fresh hell is this.\n\nThis is game jam code if I've ever seen it.  SUPER specific conditional statements that are easy to break if even the slightest thing is changes elsewhere in the game.  Impossible to read or follow without focusing super hard just to figure out what one loop iteration does.  This is the pile of vomit that is quietly concealed by a large, conspicuous rug with a sticky note that says \"do not remove.\"\n\nHow about the text highlighting, you may ask?  Surely that was simple.  Perhaps some rich text tags or TextMeshPro functions?\n\nA reasonable person would assume that.\n\nIn a game jam scenario, reason is sometimes thrown out the window.\n\nBecause I was string-parsing to determine if a correct word was being typed, any sort of rich text tag tomfoolery was thrown out the window.  Also, while technically possible to accomplish per-character shading in TextMeshPro, the documentation for how to do so is downright *abysmal* to the point where I just came up with a faster solution:\n\n![flirtText.png](\/\/\/raw\/a36\/3\/z\/1f39b.png)\n\nJust have a child TextMeshPro object with an empty string inside, and type green text on top of the word that the player is typing.  Perfect.  What could possibly go wrong?  Except for maybe dynamic font sizes, variable movement speeds, auto-orientation issues, and unpredictable kerning?\n\nThis is EASILY the aspect of the game that ate up the most of my time, and the amount of corners I cut made it some of the ugliest stuff in the game's source code.  But hey, it works, and that's all that matters!\n\n(At least as long as I'm okay with rewriting everything if I want to expand anything in the future...)\n\nHow about y'all?  What sorts of massive shortcuts did you have to take in order to make sure you had something shippable by the end of the weekend?","title":"What is the most egregious thing in your game?","wayback_source":[]}