Show HN: I made a 2D game engine in Dart

(bullseye2d.org)

90 points | by joemanaco 5 days ago ago

39 comments

  • sgt 21 hours ago ago

    This is promising. I just did a review of some of the code and the premise of the platform, this is clearly not your first rodeo in gaming. I wish you luck! I might consider sponsoring as well.

  • _stillmind 19 hours ago ago

    I haven't used Flame engine, but I know it already exists as a way to make games in Dart. So, if someone like me is curious about making a game in Dart, it would be nice to know the pros/cons of using this versus using Flame. Maybe remaking Flame's Klondike tutorial, or one of the others, using Bullseye to help show the distinct advantages that this engine brings over other solutions? It's not very obvious to me when this would be the right choice for me over Flame.

    Nevertheless, it's cool to see something new come to the scene for game dev in Dart. Thanks for making this!

    • joemanaco 19 hours ago ago

      I don't have looked into Flame too much, but I would say the main difference is that Flame builds on top of Flutter while right now Bullseye2D only builds on the web package.

      Flame offers more out-of-the-box features, while with Bullseye2D you have to build many things yourself, but it doesn't force you into a predefined structure as much. The API is more prodcedural style, making it relatively quick to learen in its entirety, without too much "magic" happening under the hood.

      I think for most people Flame would be the better choice (it is also been around longer, which means better support...), however, I really love extremly simple approaches. I also believe it has advantages when you tailor your systems and architecture to your own requirements. Lots of stuff in 2D Game Development is also extremly simple (so often having to deal with a complex physics module or rendering pipeline or entity component system is contraproductive).

  • devrandoom a day ago ago

    The Boing game doesn't work mobile, is that by design?

    • joemanaco 20 hours ago ago

      I ported this game from the Book "Code The Classics" which was written in Python/PyGame. It should be relativley easy to add mobile touch inputs to it, but I didn't have time for that yet.

      • stpedgwdgfhgdd 20 hours ago ago

        Probably worth it as most people read HN on tablet or phone.

        What is potentially a problem is the lack of training material for AI agents to generate games on top of this platform.

        • lionkor 17 hours ago ago

          You can just read the documentation and write code, there's really no need for AI here. Your argument sounds a bit like "What is a problem is that I cant enjoy my hourly whisky while driving". Maybe the problem isn't the platform :)

        • bovermyer 15 hours ago ago

          Anecdotally, I never use HN on mobile devices. I don't have access to data for HN device usage. Do you?

          "Training material for AI agents?" The lack of such is not a problem. AI agents are an adversary for many, not a target.

  • leecommamichael a day ago ago

    > An easy-to-use, high-performance 2D game library for Dart.

    This is one of those things you say to interest people. To put their concerns to rest that it might not be able to make the game they want. It doesn't really mean anything. No absolute measurements or relative comparisons.

    • ghurtado a day ago ago

      Surely this isn't the first time you see software that claims high performance and speed without any hard benchmarks attached.

      You can benchmark an algorithm or a small piece of code, but for something like a game library, the definition of what is "fast" and what isn't is too dependent on context to be meaningful.

      That doesn't mean that the statement is useless: it tells me that this is, at least partially, one of the goals of the library.

      • Joel_Mckay a day ago ago

        For most folks I think they use an fps score while not sacrificing aesthetic quality or game play experience.

        i.e. The engine is considered lower quality if it is laggy, generates DLSS chowder, or glitches up on some hardware.

        The people responsible for shader cache performance get a lot of grief given the performance hit in unpredictable play contexts is often very noticeable.

        The Unreal devs made it look deceptively easy. =3

        https://www.youtube.com/watch?v=pWS8Mg-JWSg

    • 21 hours ago ago
      [deleted]
    • nurettin a day ago ago

      To me it just means that they are satisfied with their work. Enough to announce success and joy.

  • voidUpdate 20 hours ago ago

    > Writing games is fun again

    Was it not before? The only parts I've not enjoyed in the past has been working with a team that didn't pull their weight. What part of this makes it fun again?

    • joemanaco 20 hours ago ago

      Yes, maybe it's a stupid thing to say. My thought was that the simplicity of the API takes out a lot of the complexity of it compared to engines with complex structures, entity hierarchies, event systems and features that need to fit a wide range of genres. Especially if you want to make something simple or just a prototype.

      • voidUpdate 19 hours ago ago

        Probably better to say "Writing games is simple again" or something then. Though engines like unity or unreal would make 3d games a lot simpler to make than this, so it's only some kinds of games

        • joemanaco 19 hours ago ago

          You're right. I fixed it ;)

  • Alifatisk 15 hours ago ago

    Cool project, its very refreshing to see Dart lang being highlighted like this. It definitely deserves it.

    I feel like the music player example has lots of potential for other things, not just for games. https://bullseye2d.org/bullseye2d-demos

  • munificent a day ago ago

    This is so cool! I love it.

    • joemanaco 20 hours ago ago

      Thanks. Hearing that from someone who works on Dart and wrote two books I’ve read makes the compliment really special to me :)

  • socalgal2 a day ago ago

    I hope this isn't off topic. What is the draw of Dart? In other words, what does it claim to do special or emphasize over other langauges? Like if you were going to try to convince someone they should give Dart a try, what reasons would you give?

    • freitzzz a day ago ago

      I would say that the best benefits are:

      - Cross Compilation (even wasm and js) out of the box - Simple concurrency model, similar to NodeJS - Ability to use it on a popular cross platform framework (flutter) - Hot reload capibilities (has JIT and AOT mode) - Strong developer tool chain

      All of these are built on top of a language that has a pretty syntax and supports many language paradigms.

      The biggest con is the (weak) package ecosystem and community.

      • sgt 21 hours ago ago

        I think it's also important generally speaking - not just Dart/Flutter, but really any language ecosystem, to not blindly start adding packages. You'll end up with conflicts and Dart is no exception. Sometimes it is sensible to vendor a library into your own source code tree, or just build it yourself ("Own it").

      • Alifatisk 15 hours ago ago

        When making bullet points, I think you have to add a empty line in-between each point so it gets rendered as a list

    • IshKebab 21 hours ago ago

      The language is a little nicer than Typescript (though not in all ways), the performance is better and the tooling is excellent. Even better than Go's. And it can be AoT compiled to a self-contained binary or transpiled to Javascript.

      The LSP server in particular is amazingly fast and reliable - better than Java IDEs. It's practically instant from typing something to seeing the squiggles update. C++, Rust, Go, Typescript etc. don't come close.

      Obviously there are downsides: relatively tiny ecosystem, sometimes weird syntax (why is a match expression and match statement different??), this very annoying issue that I see remains unsolved after 5 years: https://github.com/dart-lang/language/issues/1188

    • sgt 21 hours ago ago

      Having developed Flutter apps for a few years now (albeit not full time), I have to say that Dart is simply a pleasure to work in. The language - at least - doesn't hold you back at all. I guess it's kinda like Java should have been.

    • nmfisher 16 hours ago ago

      Off the top of my head:

      - Properly cross platform (including first-class JS/WASM interop)

      - AOT & cross compilation

      - Hot reload

      - Static typing with many nice features (generics, extension types, enhanced enums, etc)

      - Expressive without being overly verbose

      - Well-supported by the language & SDK teams (i.e. it's not dead)

      - Easy build/package system

      The only things I really feel are missing are (1) union types and (2) access modifiers like protected/friend.

      • Alifatisk 15 hours ago ago

        When coming from TS to Dart, the lack of union types was a huge bummer. But I saw a discussion somewhere that you can achieve something close with sealed classes to model union types combined with exhaustive pattern matching, but Idk.

        Another user hinted at this package https://pub.dev/packages/extension_type_unions, have you seen it before?

        Also it's worth noting that sum types can be achieved with Dart 3!

        • nmfisher 2 hours ago ago

          I'm a heavy user of exhaustive pattern matching with sealed classes, definitely a great feature. You can achieve the same outcome as union types, but it's a lot more leg work, e.g.:

          ```

          sealed class MyParam {}

          class Bar extends MyParam { String val; }

          class Baz extends MyParam { int val; }

          void foo(MyParam param) {

            switch(myParam) { 
          
                case Baz(val: final val):
          
                case Bar(val: final val):
          
            }
          
          } ```

          compared to:

          ```

          void foo(Bar | Baz myVar) {

              switch(myVar) { 
          
                  case Bar:
          
                  case Baz:
          
              }
          } ```

          I hadn't seen the extension_type_unions package, though, I'll check it out.

    • isoos a day ago ago

      Modern, but sane syntax (readable), good defaults (strong typing, null safety...), good-enough runtime performance, good APIs and tooling out of the box, cross-platform (also hot-reload on some, AOT). The list goes on, what specifics do you care about more?

    • 999900000999 16 hours ago ago

      Dart/Flutter imo is basically a better React Native.

      It doesn't have 30 years of JavaScript legacy code.

      The problem is Google cut significant funding to Flutter, it's not clear if it'll be supported for much longer.

      I've built several toy apps in flutter for myself and friends. I like Flutter. But Google's lack of commitment is concerning.

      Dart itself feels like a safer Typescript. The tooling is just better.

      • socalgal2 4 hours ago ago

        If Flutter didn't exist would Dart be worth looking into? ATM It sounds like Dart w/Flutter) is good for "making native apps" and that maybe doesn't excel outside that niche?

      • Alifatisk 15 hours ago ago

        > The problem is Google cut significant funding to Flutter

        Just to be clear, Google slashed teams across their entire organization, not just the Flutter / Dart team. So it wasn't like Google targeted the Flutter / Dart project

        > it's not clear if it'll be supported for much longer

        > Google's lack of commitment is concerning

        I had similar feelings. When looking this up, it showed that Google continues to actively develop and invest in Flutter, with regular updates, new features, and performance improvements being released for both Flutter and the Dart language.

        The official Flutter roadmap has been updated through 2025

        https://www.reddit.com/r/FlutterDev/comments/1jrz4cd/googles...

        • 999900000999 14 hours ago ago

          I understand that, I still don't know if I trust Google here.

          To be fair, I can get things done much faster in flutter than in other frameworks.

          I did build a small Kotlin project though, I might switch to Kotlin Multiplatform if something happens with Flutter.

  • rcore 12 hours ago ago

    Great project! I always love seeing new game engines, and it’s even better that it’s in Dart.

  • zxexz a day ago ago

    I really hate to be that guy, but I don't see a single screenshot/demo on the main page.

    • niekiepriekie 19 hours ago ago

      Well, it does seem a bit hidden and the demo's are a bit simple. The Pong demo doesn't seem to work on safari desktop (When playing, the ball stops after 0.2 s . But he! You have to start somewhere.

      Good luck!

    • rodnim 21 hours ago ago

      Click "Showcase" in the main top menu.