this post was submitted on 06 Aug 2023
4 points (100.0% liked)

Haxe

123 readers
1 users here now

Welcome to the (unofficial) Haxe community!

In their own words, "Haxe is an open source high-level strictly-typed programming language with a fast optimizing cross-compiler." Mostly it's been used to create a lot of really cool indie games, like these:

Honestly I'm a pretty novice programmer myself, but I'm moderating this community anyway because it needed one. If you have experience with Haxe and are willing to moderate, please let me know and I'll promote you!

A bunch of game engines are written for Haxe, including:

There's even Stencyl, a gamedev tool built on Haxe that has a GUI and requires little to no coding. Including a block-based coding interface if you're into that sort of thing.

I'll add more resources here as they occur to me or people suggest them!

founded 1 year ago
MODERATORS
 

I'm back with another noob support question, despite me being a moderator and this being a very small community atm. As far as efficiency/optimization is concerned, what's the best approach to making a really big open world, and then how do I actually implement it?? My stack:

  • OS: Windows 10
  • IDE: VSCode
  • Game engine: Haxe Flixel
  • Pixel art: PixiEditor
  • Map making: LDtk

I know how to just make one huge level, that's easy enough, but I've heard that might be inefficient memory-wise? I tried setting up multiple levels in LDtk, and importing each level into its own FlxTilemap. But then I couldn't figure out how to get more than one tilemap to actually display? Only the first one I add shows up. Maybe the second one is loaded but just hidden underneath it, but if so, how do I tell a FlxTilemap where it should show up? They seem to default to (0,0) and I didn't any method to change that. Or maybe you can just only have one tilemap in any given scene at a time? Would it be better to use the render method of the LDtk api instead of a FlxTilemap? I heard FlxTilemap is more efficient because it batch renders everything, whereas the LDtk api renders each tile as its own sprite.

One last question. When I switched from Ogmo to LDtk, suddenly I couldn't compile to Neko anymore. I get an Uncaught exception - std@module_read erorr. I can test the game in HTML5, but it's slower, and also for some reason the browser keeps caching old versions of the game so I have to clear everything to see any changes.

Places I've looked for answers so far:

Maybe the answer is actually in these sources, but I'm too much of an amatuer to see it? Either way, I'd really appreciate some advice!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago

UPDATE: Ok, I'm just unbelievably oblivious...

Sooo, Flixel tilemap objects do have ".x" and ".y" location parameters. You can literally just myMap.x = 5 or whatever! I didn't see it in the documentation for FlxTilemap because it inherits it from FlxBaseTilemap, which inherits it from FlxObject, which... is really obvious in retrospect. And LDtk levels that you pull into Haxe also have those exact same fields, so you can just point one to the other.

Also, you can add all the tilemap objects to a FlxGroup and just call "add" and "collide" and stuff on that. It will pass everything along to each map. I'm pretty sure the appropriate way to go about this would be to use a loop to do something like this:

  • Iterate through each LDtk level.
  • Pull the IntGrid layer from that level.
  • Create a FlxTilemap using that data.
  • Set its position.
  • add it to the FlxGroup.

I can't figure out how to actually do that though, mostly because everything seems to need to be referenced by name? Like I can't just go intGrid = level[i] where i is my iterator. Instead I have to go like intGrid = level_name.intGrid_layer_name.json.intGridCsv as far as I know?