December 14, 2017, 06:50:13 PM

Author Topic: HaxePunk refactor?  (Read 2125 times)


  • Newbie
  • *
  • Posts: 32
    • View Profile
HaxePunk refactor?
« on: October 10, 2014, 11:32:39 AM »
(reposting from

Hey HaxePunkers,

I was lately thinking of a major refactor of the 2.x branch (with breaking changes!), but would like to know where the project is heading and/or if the contributors would help in such an effort before starting to work on it.

My interest in changing the actual structure of HaxePunk is also to address most of the issues filed for the current version. This is the plan, roughly:

  • clean separation of classes and introduction of proper packages
  • abstract source of Graphics so to always have a reference to the underlying BitmapData in both RenderModes (this would help with Pixelmasks)
  • partial rewrite of the collision system
    • add conversion of coords between local and world space (so to fix/clean up offsets handling)
    • remove the _check[] map to improve performance
    • support multiple tags (instead of a single type)
    • consider using a spacial query structure to improve performance (quadtree/rtree/aabbtree/etc.)?
  • replace callbacks with signals
  • clean up Console code (which is kind of messy)
    • add draggable windows/panels
    • make it more customizable (allow the user to decide what to show and where)
    • remove rounded rects?
  • minimal set of features to make it work in html5
  • add screen related classes to handle different resolutions
  • something more I'm forgetting

Maybe this changes can be made directly for the 3.0, but I'm not much familiar with 3D and shaders nor with the changes in the HaxePunk inner workings.

Is this a feasible path to follow? Would you approve/contribute to it?

Share your thoughts.


  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 86
    • View Profile
Re: HaxePunk refactor?
« Reply #1 on: October 10, 2014, 12:56:46 PM »
This all sounds great and has some overlap with my own roadmap before the 3D version was announced. I'd be up for working together and have new features of my own to contribute.

A comment on HTML5, one missing piece is ColorTransform for setting the Image/BitmapText/etc. color property. OpenFL doesn't use ColorTransforms for rendering on HTML5. It seems there's a pull request implementing it ( but with OpenFL focused on the "Next" version I'm not sure whether this will get merged any time soon.


  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: HaxePunk refactor?
« Reply #2 on: October 10, 2014, 02:16:32 PM »

I'm very excited about the HaxePunk refactor, and have been thinking about it since the collision issue was stumbled upon.

All points mentioned in the plan are very appealing to me, particularly those regarding the collision system. I believe that clearing up some of the inconsistencies present there would already be a big step forward. Overall, this refactor will be a substantial undertaking.

I'm eager to lend a helping hand, but my knowledge of HaxePunk / OpenFL inner workings and inexperience working on bigger projects are hurdles I first have to cross. However, I'm supporting the proposed changes and I'll try to be of help whenever I can.


  • Newbie
  • *
  • Posts: 36
  • Hello :(
    • View Profile
    • 384400 kilometers
Re: HaxePunk refactor?
« Reply #3 on: October 13, 2014, 01:39:45 PM »
I really like your proposed changes, the code definitely needs refactoring, I would be willing to aid you wether you decide to branch out or contribute to hxp3, if I can.

the thing I am most unsure with about 3.0 is the complete abandonment of BitmapData / blitting, if I understand it correctly. I still use a lot of the functionality like blendmodes, color and image manipulation (setPixel, getPixel) and bitmap texts.

To be honest I don't have any idea how for example I could realise something like procedurally generated level graphics for a game without flash (openfl) bitmap data.
Also since most of my games have a low-res pixel asthetic the move away from 2d might not be very beneficial for me. It sort of is a bit awkward already with sprite smoothing always on and no easy way to switch it off for the whole game.

Maybe shaders could become very useful but as of right now I can't find any documentation on how they work and how flexible they are and also they appear to be full screen only.

I really wish there would be a way to have the best of both worlds because 3d does seem to be an exciting move forward.

I think when 3.0 rolls around this site also needs a major update (and also stuff like logos and design baselines).


  • Global Moderator
  • Hero Member
  • *****
  • Posts: 581
    • View Profile
    • My website
Re: HaxePunk refactor?
« Reply #4 on: October 13, 2014, 03:44:40 PM »
@VoEC Haxepunk 3.0 won't have blitting, only a opengl/webgl/stage3d renderer.
But you'll still be able to use blendmodes, set/getPixel and draw functions.

Yeah right now shaders are fullscreen only and don't work that well.

3d might not be too useful for a pixel looking game, but lightning could still be useful.

@everyone Tell us what you like/dislike in the engine, the stuff that you really need, the stuff that are annoying/too verbose to use ...