00:00
00:00
MSGhero
Free time is nice time.

Nick @MSGhero

Age 31, Male

Somewhere in the North

Joined on 12/15/10

Level:
17
Exp Points:
2,860 / 3,210
Exp Rank:
20,679
Vote Power:
5.85 votes
Rank:
Police Sergeant
Global Rank:
6,556
Blams:
456
Saves:
937
B/P Bonus:
12%
Whistle:
Normal
Trophies:
10
Medals:
663
Supporter:
11y 11m 17d
Gear:
3

Programming can be fun

Posted by MSGhero - December 3rd, 2021


Last time, I talked about how I was switching game engines to Heaps, from Flixel and OpenFL. I also decided to start using the ECS coding style/paradigm. I'm enjoying it! Who knew you could have fun while coding?


Heaps is really two different game engines: a poorly documented engine that has everything you need, or a poorly documented engine with almost nothing you need but a ton of examples. I think that second option is better, because Flixel is a far better "everything you need" engine.


For instance, there is a default animation class, but I don't find it all that nice to use in a game. Interfacing with it is awkward, and it updates automatically instead of when I want it to. However, it does show you how to draw changing things onto the screen. I can write my own animation code just fine, but I would have no clue how to do lower-level drawing without some good documentation and examples. The docs aren't that good, so we have to take whatever examples we can get. There is a lot of (snarky) help in the Haxe Discord, for better or worse, so I try to take notes when discussions go down.


Some people have mentioned wanting to learn about or try Heaps, so I recommend it only if you're not afraid of going into the source code to figure out how something works, and then rewriting it yourself because it was implemented weirdly. Or having breaking changes pushed to dev because Shiro Games codes differently than you.


Heaps gives me just enough so that I'm not talking directly to your graphics card, but not so much that it would be awful and silly to rewrite parts to be how I want them to be.


Entity component systems (ECS) are a way of organizing your code. It's a bit fussy, but it scales well. Like, a project I'm working on could easily have local multiplayer added, and I'm not even trying to make it happen. Typically, it's a pain in the ass since you tend to code assuming there's only every going to be one player, or you start off knowing there are going to be multiple. Everything is broken up so much that adding a new player is barely any additional code, mostly just saying which controller or keys to use for input.


ECS libraries split up code into data (components), data holders (entities), and operations on that data (systems). It makes sense on paper, but I tried 5 or 6 different libraries (and started to write my own) but never really liked it. I ended up loving "Aidan's ECS" as we call it, which uses a significant amount of black magic to streamline the coding process. It's starting to feel like I'm making a bit of a library on top of it, which is a nice feeling knowing I'll be able to easily reuse code.


I said that it's a bit fussy, and I'm going to see just how fussy in a Haxe game jam coming up. ECS make it hard to write the kind of spaghetti code that brings a game jam game together in a short time, so we'll see what happens. I haven't finished a game using an ECS library yet, so I'm going to need to keep my scope small.


But yeah, it's so easy to modify code and add new features because of how ECS is organized and split up. And I'm not fighting the game engine all the time because there's almost nothing there to fight against. I'm really enjoying it so far.


Tags:

8

Comments

F*ck it, i program in machine languaje

You're either dumb as hell or a god. Maybe both. (I'm kidding)

nice, as a haxeflixel user I'm always interested seeing what people are doing with heaps

I’ll have some cool pics soon enough and maybe a demo

@MSGhero or Neo himself

I didn’t realize we were in the presence of The One

"Or having breaking changes pushed to dev because Shiro Games codes differently than you." - it's true with any kind of library/engine. The only problem I have with heaps is that it's part of the haxe+hashlink+heaps ecosystem.

I love haxe, but everything relies on Shiro games to not fuck it up. I'm not saying they're not doing a good job (especially when they share their tools with us for FREE), but they're too widespread. They have to maintain haxe (the language), hashlink (the VM), and heaps (the library).

About a year ago, when I tried using other game libraries after a rather recent haxe language update, I couldn't even get a "hello world" program to compile, and had to downgrade to an earlier version of haxe (though this is a library issue and not Shiro Games fault). I smacked my head against the wall for days trying to get hashlink to debug my projects before getting linked to a thread on github saying that hashlink debugging flat-out doesn't work on Linux (I'm a user of both Win and Linux). And the documentation of heaps is not the greatest with either almost non-existing docs or everything being in technical jargon (the later part is my own fault for not knowing enough, I guess).

This seems like me venting, but with other languages/libraries/etc I had less struggles because most of the time stuff didn't work because of me and my lack of understanding, and nothing else. If you take a popular language like C# or Java - the languages and runtime environments themselves have separate dedicated teams working on them and they are really mature and robust languages/systems. And when people make libraries for said languages, they only need to maintain their own project. With heaps - they have to not only maintain the library, but the language, and the environment that it is supposed to run in.

I'm currently using heaps and debugging via the javascript debugger, but it's such a pain compared to how uncluttered the hashlink debugging sessions are. But I can't make it work on Linux where I usually do most of my programming. And of course, I can't use any sys libraries, because I'm stuck with JS for debugging.

I can't be mad at them. I think haxe is great. But I am really desperate for everything to just work, you know?

Yeah HL on Heaps is like exponential "one guy holding up the entire tech stack for free." Besides those breaking pushes, I have seen a lot of discussion about future changes in the discord, like others bringing new targets in like mobile and the new Macs and whatnot. But that's why I use the stable releases. There was a time a few years ago when I couldn't compile on the latest release Haxe because I used a basic feature that got broken.

@DiskCrash Not to downplay your concerns, since they are valid, but I wanted to mention that there is indeed a separate organization working on/maintaining the language - the Haxe Foundation (https://haxe.org/foundation/). And while the language creator (and head of Shiro) is in the foundation, the main maintainers for the language work at the foundation full-time (as far as I'm aware)

Making me sign in to my NG account just to chat, but I was curious if you had any follow up to how the Jam went? I've been thinking of tinkering with Heaps to get a distance from Flixel's way of doing things (namely wanting to get back into an ECS sort of vibe I had going with libGDX back in the day). I just recently installed Heaps/HL/Aidan'sECS to give things a try myself by remaking and finishing a jam game to try to learn it all. Was just curious if you had any take-aways with your experience.

I didn't join unfortunately. I had some real life stuff come up, nothing bad but it took away my free time. In general though, I am really enjoying the ecosystem. I just added local multiplayer support in a project, and it really wasn't that much effort since the ECS kinda already sets you up for that.

I do think I would have struggled in the jam if I chose a different genre of game than my current main project. That may just be me, because I tend to spend a good bit of time thinking before I'll create a new system, component, or resource. However, I also think a jam is a good opportunity to get that experience by making a SMALL project. If I had the time, I would have still participated.