Direct comparison of medium sized game Flash/AS3 vs. OpenFL/Haxe + Issues

We just need a small reproduction case of things not rendering unless you mouse over, or other forms of interaction. We have caching in our object rendering/position that appears to be wrong somehow, but I can’t say I’ve seen this issue in other projects, so anything we could do to have something on hand to reproduce this would really help :slight_smile:

1 Like

Hi,

No big deal. Its late here already. I will try to provide a small test app for you tomorrow!!!

BTW: Do you openfl guys have something like bounties? Just asking for now.

Best regards
Andreas

Hi,

i have isolated a test for you which still shows the issue. How to hand over?

Best regards
Andreas

You can post here, make a new post, an issue on Github or PM me, whatever works best for you

It is an 1.5MB archive. I do not know how to upload files here.

Thanks for the PM, email sent

1 Like

Sent mail back with test application a while ago. Hope you received it and that it runs. And that it shows the issue.

Ok. This error seems to be somewhere in my software stack as @singmajesty has tested on Flash target which I didn’t :slight_smile:

There it failed too.

Hi,

I have a form here in the game where I have 3 openfl.text.TextField elements.
2 of them are not working. They are not accepting input and do not show cursor when using html5 target.
The 3rd one is working.

I have extracted a little test case and tested flash platform and html5.

Flash does accept input while not showing the cursor though.

Any help is highly appreciated.

Best regards
Andreas

Hi,

another short question. Did you implement graphics.beginBitmapFill(). I have one XFL asset using this fill.
So I implemented it. Was not that hard though. But looks wrong.

Should look like:
31

But Looks like:
44

Did you also implemented the graphics.beginBitmapFill() matrix?

Related XFL commits:

Any ideas?

I can try to build a test case for you, if interested.

Best regards
Andreas

Hmm. In an isolated test it works. Sorry for the noise. Will check this.

Hi,

short question. Our browser game uses 700-1200 mega bytes of memory when running. Any chance to reduce this a lot?

Flash uses less than 200MB for the same game.

And I am still wondering why TextField is sometimes not accepting input.

Best regards
Andreas

One thing you might try, using -Dcanvas should not require GPU textures, which reduces memory use. Similarly, it is possible to try using bitmapData.disposeImage (), which should cause OpenFL to dispose the software texture when possible, so that only the GPU texture is kept. This also reduces the amount of memory needed, but means you cannot read or write the pixels anymore

1 Like

Hi,

bitmapData.disposeImage() does help indeed. After GC was run (I guess) the game takes a bit less or bit more than 500MB.

How is audio handled? We have some audio tracks running. Do they live extracted in memory too?
Can I save some memory here too somehow?

Best regards
Andreas

It’s possible that they do… we rely on Howler.js for sound, but perhaps for some tracks (such as background music) it would possible to force HTML5 audio (instead of web audio) which may reduce memory use

1 Like

Hi,

thank you! I might try that.

Another question. Is there a way to limit FPS to 30.0? Would be a good way to save some CPU and GPU usage.

Best regards
Andreas

Yes, you should be able to use stage.frameRate = 30; at runtime or use <window fps="30" /> in your project, but be aware that uses a timer on HTML5, and not requestAnimationFrame, so it may not be as smooth. I believe that we should avoid drawing if nothing is dirty, so you may also be able to skip frames in your logic (without reducing the frame rate) to also reduce the frequency of rendering

1 Like

Hi,

I just tried and CPU usage dropped to 40-60% from 70-100% without seeing any issues.
Thank you. Yes some more improvements would be nice. Memory and CPU usage are a bit high with our game using OpenFL.

I will try later to use bitmap caching with Shapes again because this raised FPS a lot (while having some artifacts). Maybe I can invalidate cached bitmaps on setting dimension or scale or something.

Many thanx.

Best regards
Andreas

1 Like

I think using vectors and cacheAsBitmap is likely to cause performance / memory issues because graphics are rendered into canvases. If you can, you should try converting complex vectors in the FLAs into bitmaps.

1 Like

Hi,

I have a short question about alpha. Seems like alpha of a tree are multiplied down the hierarchy.

So If I have the following alpha as tree
0.5
1.0
0.5

I guess OpenFL has the following alpha when rendering the last node:
0.25 (0.5 * 1.0 * 0.5)

Actually It seems like its different in flash
If I have:
0.5
1.0
0.5

The alpha for rendering should then be the same for each node without multiplying.
0.5
1.0
0.5

What do you think? Am I wrong? Is OpenFL wrong here?
Because I have such situation in our code and the part of the screen has transparency on node 2 where it should not.

Best regards
Andreas