[HN Gopher] Murder is a pixel art ECS game engine in C#
       ___________________________________________________________________
        
       Murder is a pixel art ECS game engine in C#
        
       Author : ibobev
       Score  : 235 points
       Date   : 2023-12-09 13:42 UTC (9 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | pjmlp wrote:
       | Looks great!
        
       | xmichael999 wrote:
       | wow!
        
       | mysterydip wrote:
       | When I saw saint11's name with it, I knew it would be good. Their
       | pixel art tutorials are so well presented:
       | http://saint11.org/blog/pixel-art-tutorials/
        
         | runevault wrote:
         | Oh wow I didn't realize this was the same guy. I've seen this
         | tutorial before and the way he lays everything out is
         | fantastic.
        
         | im_down_w_otp wrote:
         | I've never seen this before, but having perused through it for
         | a bit I'm convinced this is the absolute best blog on the
         | entire internet.
        
       | dathinab wrote:
       | Creative names are all fun of fine but this
       | 
       | - is not easy to google
       | 
       | - is quite tasteless, less so if murder is mainly something you
       | see on tv, but for some people murder is sadly much less of an
       | fictional rare thing
       | 
       | it it would be a game, story etc. which has that name and covers
       | that topic it would be fine but naming something pretty unrelated
       | to that murder is just quite a bit of tasteless and unnecessary
       | edge; if it had a flock of crows as a log it would at least be a
       | funny joke
        
         | nkozyra wrote:
         | > is not easy to google
         | 
         | I guess one could have said the same about "unity" or "unreal"
         | or even "Godot" at one point.
        
           | TrueGeek wrote:
           | ".net"
        
             | morkalork wrote:
             | Sounds like the title of a 90s horror b-movie "Murder
             | _.net_ "
        
             | DonHopkins wrote:
             | Which is at least easier to google for than Microsoft COM.
        
           | dathinab wrote:
           | godot is a pretty unique name, tho
        
             | robertlagrant wrote:
             | Apparently hard to search for.
        
             | esrauch wrote:
             | Before the engine I'm sure all ten search results would
             | have been about Waiting for Godot though.
        
         | usrnm wrote:
         | I wonder what you think of other stupid names, like "parsley",
         | "cucumber" or "apple"?
        
         | karmakaze wrote:
         | When I read the title, I was thinking it was like saying "Hell
         | is..." and wondering what would be so bad about making an ECS
         | game engine in C#.
        
         | tomalaci wrote:
         | I think that the name is too generic and popular. You see
         | "murder", the word, in most news outlets, vast majority of
         | movies/games/etc. - any media.
         | 
         | Sure, you have "Unity", "Unreal", "Godot", ".NET" and etc. but
         | I would argue that they are distinct and unique because they
         | have some heavy-weight organizations and popularity behind
         | them. I also think that they are not on the same level of
         | generic use as "murder".
         | 
         | This engine's name, however, will have to compete with the
         | generic "murder" that is already used in various different
         | contexts. Surprisingly, you can still find it as top result if
         | you search "murder engine" so they got that going for them.
         | 
         | Still, would of preferred if it was maybe some variation of
         | "murder" word if they want to stick with that.
        
         | DeIlliad wrote:
         | > - is not easy to google
         | 
         | Nobody is googling "Murder" looking for a game engine and being
         | disappointed that they can't find it. If you search "Murder
         | Engine" this is the first thing that pops up.
         | 
         | > - is quite tasteless, less so if murder is mainly something
         | you see on tv, but for some people murder is sadly much less of
         | an fictional rare thing
         | 
         | I have an immediate family member that was brutally murdered. I
         | also have no problem with the name of the engine. Of the things
         | to take issue with, this seems silly. You would hate LOVE2D
         | which has libraries famously named ANAL and LUBE.
        
           | dathinab wrote:
           | To clarify I find it tasteless and edge, i.e. a bad choice.
           | This doesn't mean I have a problem with it, nor does it mean
           | I'm offended by it or think others would be offended by it or
           | hate it or anything like that.
           | 
           | I also am not sure why you think I would find LOVE2D
           | tasteless. The name has a clear connection to what it names,
           | it paints a clear and positive picture and has a slightly
           | less obvious joke in it onto which they then double down by
           | how they name some of their libraries. That has style and
           | taste.
           | 
           | But murder is lacking all of that, or at least it's too non
           | obvious. This disconnect between the name and what it is/the
           | picture it paints is why I called it tasteless and edgy. It
           | feels like there was either a lack of ideas or it wants to
           | edge on and provoke but the picture this paints isn't
           | beneficial/good for a 2d game engine in any way as far as I
           | can tell. Even comes with a (small) to cause harm and require
           | a renaming later one.
        
             | alex_lav wrote:
             | > To clarify I find it tasteless and edge, i.e. a bad
             | choice. This doesn't mean I have a problem with it, nor
             | does it mean I'm offended by it or think others would be
             | offended by it or hate it or anything like that.
             | 
             | If it doesn't bother you and you don't think it will bother
             | others, how is it tasteless?
             | 
             | > The name has a clear connection to what it names
             | 
             | So Murder Engine is fine then.
             | 
             | The desire to clutch one's pearls in disgust over any
             | little thing is showing up a lot in this thread, I think.
        
               | dathinab wrote:
               | > one's pearls in disgust over any little thing is
               | showing up a lot in this thread,
               | 
               | not really, but I guess arguing with you about it is
               | pointless as you are either ignoring or not understanding
               | the points I am making and instead try to exaggerate
               | things by implying that finding something tastless means
               | much more then it does
        
               | alex_lav wrote:
               | If you're unable to articulate why something is tasteless
               | beyond "because I think it is", it sounds like you're
               | sort of just making things up.
               | 
               | Which is fine. Clutch those pearls. But maybe examine
               | your behavior as well?
        
               | dathinab wrote:
               | except that I did explain, but you just pretend that part
               | doesn't exist
               | 
               | and somehow after I did you started becomming all
               | provocative and manipulative in how you phrased sentences
               | so that it seems I sayed/mean/think things I do no
               | 
               | so idk. by I don't think I'm the person with the problem
               | here
        
         | DonHopkins wrote:
         | At least it's better than "GIMP". ;)
        
           | bdhcuidbebe wrote:
           | Nobody complained about git yet
        
             | DonHopkins wrote:
             | And doesn't a "debugger" imply the existence of a "bugger"?
        
               | furyofantares wrote:
               | That's the programmer
        
         | honeybadger1 wrote:
         | come on
        
         | Mystery-Machine wrote:
         | This is why we can't have nice things.
        
         | blondin wrote:
         | fully agree. this is a very tasteless name. i wouldn't even go
         | as far as the easy to google argument with this.
        
         | osigurdson wrote:
         | Murder murder murder murder. Sorry, you aren't the boss of us.
        
       | skrebbel wrote:
       | Woa, how the hell can C# run on an ECS? It has 2MB of RAM
        
         | clintfred wrote:
         | Not sure if I'm supposed to laugh, groan, or shake my head.
         | Nicely played, sir!
        
           | skrebbel wrote:
           | I like the occasional HN troll as much as the next guy, but
           | I'm afraid that it wasn't a joke. The page has screenshots
           | with big fat pixels and says it's an ECS game engine so I
           | assumed it was, well, a game engine for the ECS. I since
           | learned that ECS has another meaning that I wasn't yet
           | familiar with.
           | 
           | I might've realized this wasn't for the Amiga if I had read
           | the page (or looked at the screenshots) better though.
        
             | maxvu wrote:
             | I think ECS here is "entity-component system", a design
             | pattern that seems related to data-oriented design.
             | 
             | <https://www.gdcvault.com/play/1024001/-Overwatch-Gameplay-
             | Ar...>
        
       | sufficer wrote:
       | What is ECS?
        
         | 6581 wrote:
         | Entity component system.
        
           | lstodd wrote:
           | And here I was thinking it's about Amiga 600
        
             | vardump wrote:
             | Same.
             | 
             | I thought pixel graphics within limitations of Amiga
             | 600/3000 Enhanced ChipSet.
        
             | mortenjorck wrote:
             | The example game graphics that appear to plausibly fit in a
             | 32-color palette did not help my confusion!
        
         | ch71r22 wrote:
         | Guessing Entity Component System - a common game engine
         | architecture
        
         | gentleman11 wrote:
         | A trendy high performance architecture. Unity is trying to
         | popularize it a lot lately
        
           | capableweb wrote:
           | Not just about performance, but about getting a very well
           | decoupled code base as well when using ECS.
        
       | ctoth wrote:
       | Unrelated to the game engine, but I just love how someone
       | unscrupulous could say "the people on that hacker website are
       | discussing murder."
       | 
       | I've been thinking a lot recently about what a dedicated
       | adversary could do with totally innocuous material like this.
        
         | Cpoll wrote:
         | Seems a bit far-fetched, but then again people have taken The
         | Onion articles at face value.
         | 
         | Still, with something this easily debunked, is there much
         | difference between "the people ... discussing murder" and an
         | outright lie?
        
       | tmountain wrote:
       | This looks great! I'm curious if C# game dev has issues with GC
       | pauses.
        
         | neonsunset wrote:
         | GC issues pretty much exist in Unity land only. Other game
         | engines which use vanilla .NET like Stride work without a
         | hitch.
        
           | VHRanger wrote:
           | Does the C# GC have guarantees about when it will/won't run?
           | 
           | Dlangs GC for instance guarantee that it will only run on
           | allocation of new memory so it's possible to architect the
           | game to avoid meaningful pauses
        
             | neonsunset wrote:
             | In .NET, GC is triggered when a user thread runs out of
             | memory in an allocation budget and needs more, similar to
             | what you described [0].
             | 
             | Generally speaking, indefinitely preventing GC from running
             | is not possible (you always end up putting some data on the
             | heap) therefore an optimal strategy is similar to any other
             | language - limiting allocations and reusing memory through
             | object and array pooling. This will ensure that GC pauses
             | are as infrequent and as short as possible. It's important
             | to note that if there is sufficient allocation budget - the
             | GC will _not_ run.
             | 
             | This way, in a well written code the GC may only ever
             | trigger every few hundred frames and only take a
             | millisecond to run. In fact, OSU! has been able to get
             | consistently good frame times even back on .NET Framework.
             | 
             | [0] https://github.com/dotnet/runtime/blob/main/docs/design
             | /core...
             | 
             | [1] https://maoni0.medium.com/dynamically-adapting-to-
             | applicatio...
        
           | runevault wrote:
           | I wonder how much of the extra issues Unity has is because it
           | is a very old version of Mono, since more modern versions of
           | .NET have become so much more performant (especially Core 3.1
           | into 5+). I was sad when .NET 8 came out too late for Godot
           | to fit in the update for Godot 4.2, so I believe they intend
           | to make the update for 4.3.
        
         | gentleman11 wrote:
         | Yes. You have to allocate at the start and use object pooling,
         | in unity and even unreal (unreal has garbage collection too)
        
         | zengid wrote:
         | Yes and here is a really great talk from Miguel de Icaza about
         | some of the history of adding C# to game engines, and why he's
         | excited about using Swift in Godot because he claims that
         | Swift's reference counting avoids the issues of GC pauses.
         | 
         | https://youtu.be/tzt36EGKEZo?si=WNxwcTPGFbJABKez
        
           | pjmlp wrote:
           | Based on his experience with Mono, less so with .NET proper.
           | 
           | Also given the state of Swift outside Apple ecosystem, I
           | guess he only plans to target developers on their platforms.
        
         | unclad5968 wrote:
         | You can write C# to avoid allocations like most other languages
        
         | bob1029 wrote:
         | I've had strong success with trivial object management &
         | explicitly invoking GC on a delay that is some small multiple
         | of the simulation delay. The sweet spot seems to depend on
         | scene content and style of gameplay (how the scene objects are
         | mutated). For Q3A-style scenes and gameplay, it is extremely
         | robust. Very few scene elements change tick by tick, so GC
         | pauses are mostly irrelevant.
         | 
         | More specifically with .NET6+, I am seeing GC pauses measured
         | in the 1~5ms range in my DIY engines when I strategically call
         | GC.Collect() on a rapidly-recurring basis. Another tweak I made
         | was to disable concurrent/server/background GC in the project
         | config. Foreground+workstation GC appears to provide the lowest
         | jitter in this arrangement. My engine's main loop operates on
         | batches of events pulled from a ring buffer abstraction, and if
         | one of those events just so happens to be a scheduled GC, then
         | I deal with it right there in-line on the same thread. I do not
         | attempt to defer it to a GC thread or some other weirdness.
         | 
         | The only strategic options seem to be to either explicitly
         | manage all the memory 100%, or take out the trash as often as
         | possible. You could also entertain the cruise missile GC
         | strategy, but Microsoft has made it nearly impossible to
         | completely disable GC in latest .NET without employing black
         | magic low level DLL hackery. I can definitely see a situation
         | where you don't care about GC because you can just recycle the
         | process between business events, rounds of gameplay, etc.
         | Process.Exit() is a viable GC technique in some domains.
        
           | neonsunset wrote:
           | Cruise missiles can fly for a long time! Now, ballistic
           | ones... Either way, almost spilled the coffee over this haha.
        
       | magicmicah85 wrote:
       | Very nice. The editor is very stylized, I like it. I've always
       | liked monogame because it's performant and cross platform, though
       | I've never made huge games with it, just a demo here and there
       | when I get the itch.
        
       | gentleman11 wrote:
       | What is monogame ?
        
         | haunter wrote:
         | https://monogame.net/
        
           | gentleman11 wrote:
           | But is it widely used? Stable? Popular? Really nice to use?
           | Actively developed? Is it infrastructure that other higher
           | level tools build on, or is it like unity?
        
             | misschresser wrote:
             | Celeste, Stardew Valley, Bastion are some famous games
             | built on it.
        
             | starkparker wrote:
             | Yes.
        
             | actuallyalys wrote:
             | It's a reimplementation of Microsoft's popular XNA
             | framework that was used for a number of successful games.
             | Monogame itself has been around for a while and my
             | impression is that it's a mature and stable project. I
             | would put it in between libraries like SDL that are often
             | used as infrastructure and full engines like Unity.
        
       | cowboyscott wrote:
       | Itch page (with downloads) of a jam game made with the framework:
       | https://saint11.itch.io/neo-city-express
       | 
       | edit: Impressive for a 72 hour jam game. Great art, writing, and
       | mechanically interesting in a way that I wasn't expecting.
        
       | DiggyJohnson wrote:
       | Very cool project.
       | 
       | Man I hate to make this sort of comment, but is this a good name
       | for this engine? I'd hate for a demo to get pushed down because a
       | YouTube / Google algorithm doesn't like it.
        
         | thuuuomas wrote:
         | Sounds like a good reason to promote the merits of your own
         | project, instead of the tools you use.
        
         | pvg wrote:
         | _I hate to make this sort of comment_
         | 
         | Easier to just not make it, especially since there's a
         | (equally-better-never-made) subthread about it.
        
         | dazaidesu wrote:
         | ehhh its a cute name playing off of the "murder" of crows
         | theme, I like it, makes the theme feel cohesive. Also I don't
         | get the focus on making sure you have the perfect SEO for every
         | side project, seems like a good way to not get anything done.
        
         | PcChip wrote:
         | I feel like I'm the only one here that actually agrees with you
        
       | skitter wrote:
       | New game engines and ECS frameworks are cool to see. Taking a
       | look at the ECS part, Bang, here's an example of a component
       | abridged/adapted from their Ludum Dare entry:
       | internal readonly struct CarComponent : IComponent {
       | public readonly float Speed = 100f;             [Slider(1,20f)]
       | public readonly float Mass = 1;             public CarComponent()
       | {}         }
       | 
       | and of a system:                   [Filter(typeof(CarComponent),
       | typeof(AgentImpulseComponent))]
       | [Filter(ContextAccessorFilter.NoneOf,
       | typeof(DisableAgentComponent), typeof(CarEngineStoppedComponent)
       | )]         internal class CarMoverSystem : IFixedUpdateSystem {
       | public void FixedUpdate(Context context) {
       | foreach (var e in context.Entities) {                     var car
       | = e.GetComponent<CarComponent>();
       | Vector2 startVelocity = e.TryGetVelocity()?.Velocity ??
       | Vector2.Zero;                     var result =
       | DoSomeCalculations(car, startVelocity);
       | e.RemoveFriction();                     e.SetVelocity(result);
       | }             }         }
       | 
       | Looks a bit like DOTS (but I haven't really tried that one
       | either). A system is a class, and which interface it implements
       | determines when it runs. Haven't seen yet where systems are get
       | added to the game / how systems of the same kind get ordered. I'm
       | also curious how a system that does multiple different querries
       | (e.g. one for cars and one for obstacles) looks like.
       | 
       | Bang seems to use source code generators - unlike the generic
       | GetComponent<T> above, TryGetVelocity, RemoveFriction and
       | SetVelocity seem to be generated based on the existence of the
       | Velocity and Friction components. I'm not sure why that is, maybe
       | to cache the component id?
       | 
       | This isn't an archetype-based framework, instead each entity
       | stores a dictionary of component id => component and each system
       | tracks what entities match (also, each entity stores hooks for
       | e.g. when a component gets added, which is used update which
       | systems know about this entity). I don't know how good that's for
       | performance, but for plenty of games performance isn't as
       | important as ease of development.
       | 
       | Also looks like changes are applied immediately. Does this mean
       | that if a system add/remove a component to an entity that affects
       | whether the entity matches the systems filter, it depends on the
       | entity id whether the system processes the entity the same tick?
        
       | Xeamek wrote:
       | Since engine is targetting pixel art, isn't ECS a bit of an
       | overkill...?
       | 
       | And yes, technically artstyle has nothing to do with game
       | architecture.
       | 
       | But in practice, most games of this style are pretty small, and
       | thus don't really have any real performance requirements, so
       | ecs'ing everything is overengineering compared to oop-style,
       | coupled architecture, no?
       | 
       | Also related: https://youtu.be/JxI3Eu5DPwE
        
         | TillE wrote:
         | Hugely popular little indie game Vampire Survivors, for
         | example, requires some thoughtful optimization to have a
         | zillion objects on screen without lagging to death. ECS isn't
         | the _only_ answer, but it is a valid one.
        
         | mattgreenrocks wrote:
         | I find ECS easier to think about and use. It's effectively
         | controlled mutation.
        
         | skitter wrote:
         | One of the commonly mentioned performance advantages of ECSs is
         | the structure of arrays style, which Murder isn't using, so I'm
         | guessing that they're using ECS less for performance reasons
         | and more because they favor the programming style.
        
       | freecodyx wrote:
       | C sharp is pleasure to read
        
       | TheGrkIntrprtr wrote:
       | saint11 mentions on his about page: "Murder Engine: 2D Pixel art
       | C# ECS Game Engine made by Isa! I usually help on the render and
       | physics side of it."
       | 
       | Isa: https://isadorasophia.com/projects/
        
       | owenpalmer wrote:
       | Way to go team, you're killing it
        
       ___________________________________________________________________
       (page generated 2023-12-09 23:00 UTC)