else Heart.Break() Attack and Vine

We’ve covered else Heart.Break() before, so I feel I need not dwell on what it is. But wait! What if you’ve somehow missed those previous posts? Hmm.

function Heart.Break() {
if (gameFamiliar == true) {
Recommendation = “Skip the next paragraph”;
else {
Recommendation = “Keep reading, intrepid reader!”;
// Feel free to critique my code. I am no professional, my friends.

else Heart.Break() is billed as “a game about friendship, love and technology in a place where bits have replaced atoms.” It’s an RPG with the emphasis on exploration and experimentation, inviting you to tinker with computers and objects throughout the game world and converse with a variety of well-rounded NPCs.

In this latest trailer (okay, it’s not a Vine, but I couldn’t resist the pun) we see hero Sebastian breaking into and out of a factory. I don’t entirely understand everything he’s doing for much of the video, but if you read my horrible JavaScript that fact may not surprise you. What is evident from this gameplay video are the game’s charming visuals and just how interactive many parts of its world are. It looks like else Heart.Break() is a game that RPG fans could really sink into.

There’s a nice moment where Sebastian runs into a locked door, and rather than search around for a keycard or what have you, he hacks a nearby computer and inerts a password into the code. Terribly insecure programming, but hey, it worked out for Sebastian! I also rather like the bit at about the two minute mark where a computer tells him it loves him. But is it true love, or but a simulacrum spat out by a cold, calculating corporate machine? I suspect we’ll all have to play the game to find out the truth. Who knows, we might even learn something about code along the way.

An aside: is Sebastian wearing an orange beanie hat or is it some kind of cyber-do? Hack your thoughts into the comment mainframe!


  1. LogicalDash says:

    anything == true is poor style, you should just if gameFamiliar {

    seems like Recommendation is a plain ol’ variable name, but it’s capitalized like it’s a class?

    There’s no indentation and somehow you got smart quotes in your code which won’t work much of anywhere. Probably because you typed that in a word processor and not a text editor.

    • Kitsunin says:

      But if you use
      if gameFamiliar{
      then gameFamiliar could be ‘what are you talking about’ and it would still be interpreted as true, whereas == true ensures that the value is true, and not merely something which interprets as true.

      • Chalky says:

        Maybe in javascript, but in the vast majority of languages “variable == true” is redundant.

        • Kitsunin says:

          Hmm, well I’m somewhat familiar with Python (what I thought this code looks most like) which treats everything except a 0, false, none, and empty containers as true, and Ruby which iirc treats everything except false and nil as true. Do other languages simply give an error after an “if variable”, and variable isn’t true or false?

          Maybe it’s a difference between higher and lower level languages, but considering that entire trinity seems to follow a similar method, that’s far from ubiquitous.

          • Chalky says:

            Depends whether the langauge is typed/untyped, but most would error if you tried to set an arbitrary string into a boolean variable, either at compile time or (if it’s weakly typed at) run time when it attempts to cast it. I have no experience with python but google tells me it’s strongly typed so as long as you declare gameFamiliar as a boolean you shouldn’t be able to get into a situation where it contains an arbitrary string.

            To be honest, if you intended it to be a boolean and you somehow used the wrong variable, I’m not sure using “== true” really saves you since then your code always evaluates to false. Code is pretty broken by that point anyway :)

          • Faxmachinen says:

            I don’t know whose socks you guys have been smoking, but that code looks nothing like Python – which, by the way, is not strongly typed – and “== true” is also redundant in JavaScript. Not that the “function Heart.Break()” construct is legal JavaScript anyway, but that may be the author’s fault as it’s not legal in any other language that I know of either.

      • kalzekdor says:

        That’s not true in any language. if (var) will always behave the same as if (var == true). What you’re thinking of is the identity comparison, or if (var === true)

    • sandineyes says:

      anything == true is not poor style. Since ‘true’ is a reserved word in most common languages, I’d imagine any decent compiler would generate the exact same code whether you do if (anything == true) or if (anything).

      • LogicalDash says:

        I didn’t say it wouldn’t *work*, it’s just less readable this way. Not a big deal in toy code like this, but in big projects you want to avoid using any needless operators for much the same reason you avoid needless words when writing essays.

      • arisian says:

        The main advantage of doing `if (var)` over doing `if (var == true)` is that you don’t run the risk of introducing a nasty typo-bug by leaving out one of the `=` symbols. New programming students often make this mistake, and then have a hard time debugging it, because `(var = true)` both assigns a new value to var and returns true, regardless of the value of var coming in.

    • darkhog says:

      No, WordPress is adding smart quotes and there’s no way to stop it.

      Anyway, your code won’t compile since variable Recommendation isn’t declared.

    • simulacrum says:

      Your code quality tool should recommend you just use the ternary operator instead:

      var recommendation = gameFamiliar ? "Skip the next paragraph" : "Keep reading, intrepid reader!";

      Except you probably don’t want to assign to a variable but return it from the function. You also don’t want gameFamiliar being stored in global state because that would limit reuse and is generally poor practice, so you might want to add it as a parameter to the function. Something like this:

      function heartBreak(gameFamiliar) {
      return gameFamiliar ? "Skip the next paragraph" : "Keep reading, intrepid reader!";

      • LionsPhil says:

        I have rarely known a circumstance where my colleagues or tools have called for more ternary operators. I only use them because I had a sordid dalliance with functional programming.

    • FriendlyFire says:

      Far more important is that I know very few languages where a dot in a function name is valid. Being the go-to scope operator, you’d probably want to wrap the function in a class or object called Heart.

  2. Chalky says:

    I really like the look of this game, but is it just me or are the speech bubbles complete out of place with the rest of the art style? It’s a very strange choice.

  3. GameCat says:

    Does it have a soundtrack by Tom Waits?

  4. Nyoro says:

    You forgot to declare the Recommendation variable D:

    Also always use lower case names for variables.

  5. cylentstorm says:

    Okay, the Tom Waits reference hooked me, but thanks for reminding me about this game. As a fan of Double Fine’s rough-around-the-edges-but-still-cool game mechanics in Hack ‘n’ Slash, color me intrigued.

  6. bonuswavepilot says:

    Looks like it might be worth a go! The example of a nested loop on that floppy Sebastian found was terrible though… it was technically a nested loop, but there was nothing in it that made the nesting necessary – that one instruction would have run infinitely exactly the same with just one of those loops…

  7. fahrenheit451 says:

    Well by and large the most critical error in your code would be the missing access modifiers in your function declaration line, and the false syntax of the word function. Also the dot within the games title would have to be removed for the purposes of code writing as it would necessitate referencing data within an external class. In addition a few common conventions were were broken including the miscapitalization of the Recommendation variable (as a local instance variable the standard naming convention would be to start with a lowercase letter such as the gameFammilar variable) and your lack of tabbing on lines within code blocks. With these modifications this code could be acceptable as a method within a larger class file; however, as a run-time program this would not be acceptable. Missing still are the declarations and initialization code for the two instance level variables used, along with the line of code to call the method so that the code runs. In addition to this a class would have to be made to contain this code, and a static void Main(string[] args) method to call Heart.Break() on execution. Finally, the namespace declaration and imported code would have to be added. At this point the code would be runnable, but another useful addition would be adding a line to print the result of the recommendation variable using the Console.WriteLine() function. Here is a revised version of the code ready to be compiled:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace Project1
    public static class CleverPostOpening
    static bool gameFamiliar;
    static String recommendation;

    static void Main(string[] args)
    gameFamiliar = true;
    recommendation = “”;



    static void HeartDotBreak()
    if (gameFamiliar == true)
    recommendation = “Skip the next paragraph”;
    recommendation = “Keep reading, intrepid reader!”;
    // Feel free to critique my code. I am no professional, my friends.

    • GirlzRKool says:

      recommendation = this.gameFamiliar ? “Skip…” : “Keep reading…”;

      Edit: Forgot how deeply I hate syntactic discussion… And also forgot c#. Please ignore + blame on beer. Tnx

    • Premium User Badge

      Harlander says:

      Yeahhh, Allman style 4 life

  8. bill says:

    I was going to compliment you on the pun in the headline, but you should never explain your puns – that takes all the fun out of them!

  9. RARARA says:

    I wish the LCD screens were blocky CRT monitors, snce everything else feels very retro (floppies and CLI).

    Other than that, this looks like something special.

  10. Big Murray says:

  11. PizzaRollExpert says:

    In JavaScript (which is what you mentioned that you where using) you can only assign normal variables using the function name function declarations, not properties of objects.

    The capitalization of Heart.Break doesn’t make much sense either, as only constructors begin with uppercase letters and properties never do so, but this is a reference to the games title which is presumably referencing some other language, so I’ll let it slide.

    You are using double equals instead of triple equals to compare to true. You can probably just use if (gameFamiliar) because gameFamiliar will probably never be anything other than a boolean or undefined, but even if it could have other truthy values that you don’t want to accept, you need to use triple equals or type coercion will make the comparison true anyway.

    Recommendation should use a lowercase r since it is not a constructor. I assume that it is declared somewhere outside the function (otherwise the function wouldn’t actually do anything), so I won’t complain about a lack of variable declaration.

    Finally, you haven’t indented your code.

    This is what it should look like:

    Heart.Break = function() {
      if (gameFamiliar) {
        recommendation = "Skip the next paragraph";
      } else {
        recomendation = "Keep reading, intrepid reader!";