Guide to implementing 2D platformers (2012)

(higherorderfun.com)

190 points | by Tomte 706 days ago

4 comments

  • rob74 703 days ago
    One other example of the "bitmask" type of platformer (although you probably wouldn't call it a "platformer", at least not a "jump'n'run" game, as far as the genre is concerned) is Lemmings. The levels of the original Lemmings games are definitely not saved as bitmaps (at 120 levels, that would have far exceeded the capacity of an Amiga floppy), and they're not tile-based either. AFAIK the levels (https://www.mobygames.com/game/amiga/lemmings/screenshots/ga...) were created by repeating certain graphical elements (e.g. the columns in the screenshot are vertical repetitions of one element, the capitals of the columns are another element), and the Lemmings would simply walk on the top side of the image that resulted when composing all these elements (which could be placed freely). Slopes were tackled by looking left and right if the neighbouring pixel was > X pixels higher than the one the Lemming was standing on. If yes, the Lemming would turn around, if no it would walk on, following the slope. This way it was also relatively easy to make the environment destructable (by digging or exploding) and constructable (by building stairs).
    • hibikir 703 days ago
      The tools that were used to make Lemmings were shown in a 2019 GDQ talk, called Classic Game Postmortem: Lemmings [1]. The editor, and how fast the loop was between tweaking a level a little bit and being able to try it again, are pretty impressive. The talk also goes through the wonders of high quality low pixel animation.

      [1] https://www.youtube.com/watch?v=ybs5FR-uUNI

    • layer8 703 days ago
      While not a platformer, another example of a non-tiled, non-bitmap game is the Last Ninja series on the C64. At the start of each level you can see the graphics being built up by drawing/painting operations.
    • seclorum_wien 703 days ago
      >that would have far exceeded the capacity of an Amiga disk

      Simple bitmaps for game-mechanics/level design goes back to the 8-bit era.

      Bitmaps with colour bytes that indicate level/enemy/goal hit points tend to compress rather well, since a lot of the bit-space is 00's, and .. anyway .. Amiga is legitimately viewed as one of the birthplaces of interesting compression for these kinds of reasons ..

  • henning 703 days ago
    In 2022, there are mechanics people will want for your game to feel good. This will vary from game to game, but I think most games will want coyote time and jump buffering. https://twitter.com/maddythorson/status/1238338574220546049
    • teddyh 703 days ago
      They write that all this is in the player’s favor, but it all gets nullified and even negated when levels are designed with these factors in mind: For expert players, the levels are no more difficult than they would be if the levels had been designed without most of these fudges, and for less experienced players, the fudges are effectively undocumented cheat codes which they nevertheless need to learn in order to get good at the game.
      • bscphil 702 days ago
        > it all gets nullified and even negated when levels are designed with these factors in mind

        I have played Celeste 100% multiple times and have probably 250-300 hours in the game total. To the best of my knowledge, there is no movement in the official game that requires a fudge. It is very carefully designed in that regard. If you have a single counterexample I would be interested in seeing it.

        However, three clarifications are needed here:

        * I have played difficult modded levels (or the randomizer) which sometimes do seem to rely on the fudges. This isn't that surprising as the levels are typically designed by and for expert players.

        * There are cases where the fudge provides negative value, but not because it is required. In Chapter 1, the game actually tries to teach you this; moving platforms will still give you their whole momentum if you're slightly late on jumping off of them (i.e. they've technically stopped moving). In some cases, you don't want their momentum because it will throw you into some spikes. There's a room in Chapter 1 where almost everyone gets thrown into the spikes the first time by getting unexpected momentum. These cases are rare, however.

        * There are cases where the "leading edge" and "trailing edge" of the fudge are not properly balanced. For example, with the momentum fudge mentioned above once again. When you jump off a moving block, you get momentum depending on how fast it's moving. It will be fastest toward the end of its movement. However, if you are jumping 1 frame after the animation has ended, you will get 100% of the momentum. So if you're struggling to get enough momentum to complete a jump, you will actually do better if you try to do it slightly too late rather than slightly too early. The fudge still isn't required but it can be helpful to lean on it in these specific cases.

        • teddyh 702 days ago
          > To the best of my knowledge, there is no movement in the official game that requires a fudge. It is very carefully designed in that regard.

          Very well then, I stand corrected. It was not my intention to accuse Celeste specifically; I was referring to these kinds of fudges in general. I’m sorry for my careless wording.

      • pharrington 702 days ago
        In general, said "fudges" compensate for both human imprecision and computer system inconsistency (ie, lag). It feels really bad to fall off a ledge your brain told you you were standing on, and it feels really bad to think a game ate your input when you attempt an action mere frames before the action is allowed.
      • henning 703 days ago
        No, they're little affordances to make a challenging game approachable by more people.
        • teddyh 703 days ago
          Only if the levels were not designed with these affordances in mind, which I assume they were.
          • henning 703 days ago
            Celeste's challenge does not derive from executing individual moves, it's about chaining them together in clever, fun ways. Please list what platformers/software you work on so I can avoid using them.
            • teddyh 702 days ago
              Restating your claim is not an argument.
              • pharrington 702 days ago
                "Only if the levels were not designed with these affordances in mind, which I assume they were."

                Unless you can name even one level that requires coyote jumps or input buffering, I assume you literally do not know what you're talking about regarding Celeste.

                Bad games can use literally any mechanic as a crutch to compensate for bad level design. Quality-of-life mechanics at worse will just make an already bad game as bad as it was, and most of the time only serve to make the game better.

                • teddyh 702 days ago
                  > I assume you literally do not know what you're talking about regarding Celeste.

                  This is true; I do not. This is because I was not referring to Celeste in particular, but games with these kinds of fudges in general, and I was careful to point out that my criticism was only applicable when levels were designed to take advantage of these kinds of fudges. If the levels of Celeste, specifically, are not so designed, then what I wrote is not applicable to Celeste.

    • DANK_YACHT 703 days ago
      I first played Maddy's games as a kid, starting with Jumper. She is an absolutely amazing level designer. I remember seeing Celeste and thinking, "Wow, that looks just liker Jumper." Lo and behold, they were made by the same person. She's clearly been refining her list of tricks over the last 18 years, but the real magic in her games is her level design. Jumper has no atmosphere, but it just as fun as Celeste.
    • greggman3 703 days ago
      That's a good list, and especially with animation illustrating them, of the types of things games will do to make something feel good.
  • oneoff786 703 days ago
    I thought this was pretty solid

    > In many games, your character will play an animation before actually performing the action you requested. However, on a twitchy action-based game, this will frustrate players – DON’T DO THAT! You should still have leading animations for things such as jumping and running, but if you care about how the game responds, make those cosmetic only, with the action taken immediately regardless of the animation.

    Interesting take. I feel like there’s an unexplored niche of 2D action platform era that do the opposite of this. Yeah a jump startup anim wouldn’t work well for Mario. But a more combat heavy one could be cool. Especially if you had quite a few jumping options. Somewhere between a sluggish super smash bros and dark souls. Something with deep character state management and directional parrying / dodges.

    Salt and sanctuary is an interesting title that tries to do 2D dark souls but I feel like it’s just an over simplified outcome. Iframe dodge rolls work well in 3D because you have a 360 range of directions and need to pick between getting out of range for follow ups or dodging into attacks to avoid lagging hit boxes. In 2D you get just 2 directions and it seems a bit too easy imo.

    • uxp100 703 days ago
      Prince of Persia is what I can think of that has (sometimes huge) wind up animations for jumping. And it feels ok once you get used to it, but really feels very different than any other platformer. But there is more than just a big animation there, I think the jumps are also quantized to a grid in some way, such that a range of button press timings will all result in the same on screen behavior.
      • oneoff786 703 days ago
        Yeah it’s the first type listed in the article. Prince of Persia has your location tracked discretely by fairly large tiles. The animation may suggest otherwise but your location isn’t actually smoothly tracked at all.
        • AlecSchueler 703 days ago
          See the first Tomb Raider also for a 3D version of this. She only ever moves by full tiles.

          Makes it quite cool once you get used to the grid as you can reason logically about certain jumps etc.

          • gzalo 702 days ago
            Even the DOS version allows smooth continuous motion: https://youtu.be/EC_8ljpgySM?t=914

            Are you talking about the map elements is composed of elements aligned to a grid? It's likely that was done on purpose to simplify computing collisions

            • AlecSchueler 702 days ago
              I'm not seeing the smooth continuous motion you're talking about in that video. Every motion leads to hear being placed onto a specific tile, she can never be between tiles.

              You can see the developer talking about the design in this video, as well as additional comparisons from the narrator on the PoP influence:

              https://youtu.be/eeMFdrIrdZY?t=2040

              Prince of Persia was one of the main influences in the game's mechanics and the grid system is an intentional emulation of the grid system from the earlier game.

              The animations are smooth but they are always tied to the grid.

              • gzalo 701 days ago
                The climbing and jumping animations are tied to the grid. But not the walking ones. This is not what happens in other games like Prince of Persia or Oddworld.

                I agree that she is only in one tile at a time (her position is defined one position in the middle of both feet) But she doesn't just move by full tiles. You can perform step that are fractions of tiles, and combining that with the rotation angles (which are continuous), that must mean that you can be in any place of a specific tile (I.e, each square of the grid has infinite positions). Just tested it in TR1 demo, by rotating and walking backwards slowly, you can go to any place of the grid, and even have some feet in the air. See for example: https://imgur.com/a/0YLbV6C

        • uxp100 703 days ago
          Ah right, with some particularly large tiles.
      • teddyh 703 days ago
        Both the movement and control scheme of Prince of Persia was copied exactly by a little-known 3D platformer called… Tomb Raider. It’s too bad that not many modern games follow these movement and control schemes, and odd too, since both games were hugely successful. Even Assassin’s Creed was originally envisioned as a Prince of Persia game, IIRC.
    • hakmad 703 days ago
      > Somewhere between a sluggish super smash bros and dark souls. Something with deep character state management and directional parrying / dodges.

      While it doesn't feature jumping and is a Metroidvania with some character customisation (not too deep though), Unworthy [0] is a pretty good fit for the 2D Dark Souls genre. The animations come out a lot quicker than the actual attack but they feel really heavy and powerful. A lot of people complain that it's relatively easy because you can just dodge/roll behind and enemy and smack them but I've found it to be fairly hard (I'm not good at these kinds of games but they're really fun :D).

      [0] - https://store.steampowered.com/app/613190/Unworthy/

    • pjc50 703 days ago
      Reminds me of the extensive discussion of "animation cancelling" in Genshin Impact. You can't accelerate the start of an attack, but you can cancel the animation between that and the next one, and this is apparently quite important for some characters.
      • rednab 703 days ago
        Genshin [borrowed that mechanic from/was inspired by] another genre, namely fighting games¹).

        And you got to admit, some (boss) fights in Genshin feel like they could come straight out of Soulcalibur.

        So yeah, leading animations can definitely be a fun and interesting gameplay element, especially if you throw in cancels.

        ¹) https://streetfighter.fandom.com/wiki/Cancel

      • hakmad 703 days ago
        For Claymore characters it's usually quite helpful to hit either 3 or 4 times (I don't exactly remember) and then dash to the side to prevent waiting ages for the animation of the final attack to complete, otherwise you wouldn't be able to start attacking again.
    • makecheck 703 days ago
      Not limited to games, either; “pre-animation” makes regular software feel sluggish too. Having actions taken immediately is critical.
      • oneoff786 703 days ago
        For sure.

        It’s also worth noting you can do gameplay timing mechanics without locking behind animations. Many fighting games feature characters with charge archetypal control schemes where you need to hold certain inputs for a time but they don’t necessarily have any visible effect on the character while they’re held.

        But on the other hand some start up lag can make a game feel very tense which can be great.

        Elden ring subtly does this thing where bosses react to taking damage, so if you hit them with a light attack it will appear as though their attack patterns have no openings because they respond quickly. But in reality many of them are open for a good few seconds if you just wait and charge up a satisfying blow.

        Not many good examples of start up jumping lag… maybe… SSX Tricky comes to mind?

        • bluefirebrand 703 days ago
          I think the biggest thing with start up lag on animations is that it has to be communicated very clearly to the player that it's happening, and have a reason to happen. Otherwise people will blame it on the input device, or their system hardware, or just plain think it's a buggy or poorly designed game.

          I think that winds up making it a lot harder to pull off.

    • danielvaughn 703 days ago
      For sure. From Software games are the antithesis of this rule and they work great. I love how you have to wait until the exact right time to dodge or block, otherwise the character will adjust their attack, just like in real life. The wind up animation turns the combat into a dance.
    • Pulcinella 703 days ago
      Out of This World/Another World and Flashback both have pretty heavy “animation priority” platforming. I like them, but they are rather sluggish to the point where they make Dark Souls look like Devil May Cry.
  • scvalex2 703 days ago
    Web archive link: https://web.archive.org/web/20220523080006/https://higherord...

    (the website seems down to me)