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


#163

Hi,

same problems with openfl-dev.

hxcpp: 3.4.64 [3.4.188]
lime: 5.5.0 5.6.0 5.7.0 5.8.2 6.0.1 6.2.0 6.3.1 6.4.0 7.0.0 [7.1.1]
openfl: 6.1.2 6.2.0 6.2.1 6.5.0 7.0.0 7.1.2 8.0.2 8.2.2 8.4.1 8.5.1 [dev:/Users/andreas/Development/pixelracoons/openfl]

Many thanx and

Best regards
Andreas


#164

We did update Freetype, which resolved text layout issues with certain fonts. Any chance this was broken before, and is fixed now? Are they SWF text or created dynamically?


#165

“Any chance this was broken before, and is fixed now?” - I do now exactly know what you mean.
The font is rendered OK in Adobe Animate and was rendered before OK in OpenFL/our game. Now its broken. Hmm.
These textfields are generated by XFL definitions.

Have a look here if interessted


#166

Still looks okay in the Flash target, I guess? Is it only one font, or all fonts? Sorry about this, not sure there’s an easy way to isolate this?


#167

Hi,

I will try to see If my code is wrong or come up with some tests. So I will come back to you next week.

Many thanx and

Best regards
Andreas


#168

Hi,

I did lots of tests and came to the following conclusion.
There seems to be some offset of the font on Y on Android only, no matter what I have tried.
In HTML5 it works! In Flash it works! In Android not.

Cant test MacOS target as compiling seems to be broken on Mojave.

Andreass-Air:pirates_hp_code_hx andreas$ openfl test macos
Creating /Users/andreas/Development/pixelracoons/pirates_hp_code_hx/Export/macos/obj/obj/darwin64/__pch/haxe/hxcpp.h.gch...
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
/usr/local/lib/haxe/lib/hxcpp/3,4,188/include/hxcpp.h:19:13: fatal error: 'typeinfo' file not found
   #include <typeinfo>
            ^~~~~~~~~~
1 warning and 1 error generated.
Error: Could not create PCH

Could not test Neko as it also gives an error:

Andreass-Air:pirates_hp_code_hx andreas$ openfl test neko
Called from ? line 1
Called from ApplicationMain.hx line 30
Called from ApplicationMain.hx line 145
Called from lime/utils/Preloader.hx line 204
Called from lime/utils/Preloader.hx line 350
Called from lime/utils/Preloader.hx line 247
Called from lime/_internal/macros/EventMacro.hx line 101
Called from ApplicationMain.hx line 128
Called from openfl/display/Preloader.hx line 54
Called from openfl/display/DisplayObject.hx line 940
Called from openfl/display/DisplayObject.hx line 1333
Called from openfl/display/DisplayObject.hx line 1262
Called from a C function
Called from openfl/events/EventDispatcher.hx line 443
Called from openfl/display/Preloader.hx line 301
Called from openfl/display/Preloader.hx line 248
Called from openfl/display/DisplayObject.hx line 940
Called from openfl/display/DisplayObject.hx line 1333
Called from openfl/display/DisplayObject.hx line 1262
Called from a C function
Called from openfl/events/EventDispatcher.hx line 443
Called from openfl/display/Preloader.hx line 117
Called from lime/_internal/macros/EventMacro.hx line 101
Called from ApplicationMain.hx line 131
Called from ApplicationMain.hx line 179
Called from openfl/display/Stage.hx line 1836
Called from ApplicationMain.hx line 230
Called from ApplicationMain.hx line 303
Called from a C function
Called from ApplicationMain.hx line 326
Called from a C function
Called from HomePage.hx line 56
Called from openfl/containers/ScrollPane.hx line 10
Called from a C function
Called from openfl/containers/ScrollPane.hx line 17
Called from a C function
Called from openfl/containers/BaseScrollPane.hx line 38
Called from a C function
Called from openfl/core/UIComponent.hx line 28
Called from a C function
Called from openfl/display/XFLSprite.hx line 32
Called from a C function
Called from xfl/symbol/Sprite.hx line 24
Called from xfl/symbol/Shared.hx line 213
Called from xfl/symbol/Symbols.hx line 182
Called from xfl/symbol/Symbols.hx line 290
Called from a C function
Called from openfl/controls/ScrollBar.hx line 19
Called from a C function
Called from openfl/controls/ScrollBar.hx line 58
Called from openfl/core/UIComponent.hx line 126
Called from openfl/controls/ScrollBar.hx line 240
Uncaught exception - Invalid operation (-)

I currently have no idea instead of digging the OpenFL/Android source for rendering text.

Many thanx and

Best regards
Andreas


#170

@andreasdr Perhaps a newer HXCPP release version would compile properly for macOS? Otherwise, you could try the Neko target, but it’s a bit tricky, it does NOT initialize integer/float values with 0, instead they are null. Thus you get errors like Invalid operation (-) because it is doing something like 200 - null and doesn’t know what to do (and does not resolve as if it were 0, like JavaScript)

Is this only specific to one font? Does it occur with just a basic TextField?


#171

Hi,

i have managed to get the game running again with “macos” target. Updating HXCPP was also involved. Thank you.

On “macos” target the fonts are rendered like on Android. Means a few pixel too low.

Is there any specific font I should test?

Many thanx and

Best regards
Andreas


#172

Try doing openfl create project TextFieldTest, adding in a font and add a basic TextField, and see if the positioning on that seems wrong compared to other targets. If so, that would make a really easy test for us to look at. If not, then perhaps it’s something trickier


#173

Hi,

I found some kind of origin for my font rendering error.
Before I was including fonts like so, as my fonts are in Assets/fonts

<assets path="Assets/fonts" rename="fonts" embed="true" />

After changing this to the following it works 100%!

<assets path="Assets" rename="assets" />
<assets path="Assets/fonts" rename="fonts" embed="true" />

So what is wrong with my first approach? I guess when only including “Assets/fonts” the font is ignored or processed differently or maybe the MacOSX default is taken. I have no idea.

Any hint is highly appreciated.

Many thanx and

Best regards
Andreas


#174

Hmm, strange, I’m not sure how embedding all assets would affect the position of a font render. Hmm


#175

Hi,

I double checked. So I have made a build that is not working in terms of font rendering(including “Assets/fonts” instead of complete asset path) and a second one, that works, including everything. Please see attached a build diff.

Andreass-Air:font-test3 andreas$ diff -u ../../../Documents/build_not_working.txt ../../../Documents/build_working.txt
--- ../../../Documents/build_not_working.txt	2018-11-08 13:20:38.000000000 +0100
+++ ../../../Documents/build_working.txt	2018-11-08 13:20:18.000000000 +0100
@@ -485,8 +485,8 @@
  - src/lime/graphics/opengl/ext/OES_texture_half_float.cpp 
  - src/lime/graphics/opengl/ext/OES_texture_float_linear.cpp 
  - src/lime/graphics/opengl/ext/OES_texture_float.cpp 
- - src/lime/graphics/opengl/ext/OES_texture_3D.cpp 
  - src/lime/graphics/opengl/ext/OES_surfaceless_context.cpp 
+ - src/lime/graphics/opengl/ext/OES_texture_3D.cpp 
  - src/lime/graphics/opengl/ext/OES_stencil4.cpp 
  - src/lime/graphics/opengl/ext/OES_stencil1.cpp 
  - src/lime/graphics/opengl/ext/OES_standard_derivatives.cpp 
@@ -527,8 +527,8 @@
  - src/lime/graphics/opengl/ext/EXT_texture_type_2_10_10_10_REV.cpp 
  - src/lime/graphics/opengl/ext/EXT_texture_storage.cpp 
  - src/lime/graphics/opengl/ext/EXT_texture_rg.cpp 
- - src/lime/graphics/opengl/ext/EXT_texture_format_BGRA8888.cpp 
  - src/lime/graphics/opengl/ext/EXT_texture_filter_anisotropic.cpp 
+ - src/lime/graphics/opengl/ext/EXT_texture_format_BGRA8888.cpp 
  - src/lime/graphics/opengl/ext/EXT_texture_compression_s3tc.cpp 
  - src/lime/graphics/opengl/ext/EXT_texture_compression_dxt1.cpp 
  - src/lime/graphics/opengl/ext/EXT_shadow_samplers.cpp 
@@ -545,8 +545,8 @@
  - src/lime/graphics/opengl/ext/EXT_multi_draw_arrays.cpp 
  - src/lime/graphics/opengl/ext/EXT_map_buffer_range.cpp 
  - src/lime/graphics/opengl/ext/EXT_discard_framebuffer.cpp 
- - src/lime/graphics/opengl/ext/EXT_debug_label.cpp 
  - src/lime/graphics/opengl/ext/EXT_debug_marker.cpp 
+ - src/lime/graphics/opengl/ext/EXT_debug_label.cpp 
  - src/lime/graphics/opengl/ext/EXT_color_buffer_half_float.cpp 
  - src/lime/graphics/opengl/ext/EXT_color_buffer_float.cpp 
  - src/lime/graphics/opengl/ext/EXT_blend_minmax.cpp 
@@ -749,8 +749,11 @@
  - src/Reflect.cpp 
  - src/__ASSET__OPENFL__fonts_aquilinetwopf_ttf.cpp 
  - src/__ASSET__OPENFL__fonts_gabriola_ttf.cpp 
+ - src/__ASSET__OPENFL__assets_fonts_aquilinetwopf_ttf.cpp 
  - src/openfl/text/Font.cpp  [haxe,release]
- - src/__ASSET__manifest_default_json.cpp 
+ - src/__ASSET__OPENFL__assets_fonts_gabriola_ttf.cpp 
+ - src/__ASSET__assets_fonts_aquilinetwopf_ttf.cpp 
+ - src/__ASSET__assets_fonts_gabriola_ttf.cpp 
  - src/__ASSET__assets_assets_pf_homepage_assets_pf_homepage_xfl.cpp 
  - src/__ASSET__assets_assets_pf_homepage_mobilesettings_xml.cpp 
  - src/__ASSET__assets_assets_pf_homepage_domdocument_xml.cpp 
@@ -911,8 +914,8 @@
  - src/resources/__res_41.cpp  [optim-none]
  - src/resources/__res_42.cpp  [optim-none]
  - src/resources/__res_43.cpp  [optim-none]
- - src/resources/__res_44.cpp  [optim-none]
  - src/resources/__res_45.cpp  [optim-none]
+ - src/resources/__res_44.cpp  [optim-none]
  - src/resources/__res_46.cpp  [optim-none]
  - src/resources/__res_47.cpp  [optim-none]
  - src/resources/__res_48.cpp  [optim-none]
@@ -942,13 +945,12 @@
  - src/resources/__res_72.cpp  [optim-none]
  - src/resources/__res_73.cpp  [optim-none]
  - src/resources/__res_74.cpp  [optim-none]
- - src/resources/__res_75.cpp  [optim-none]
 Creating /Users/andreas/Development/pixelracoons/font-test3/Export/macos/obj/obj/darwin64/__pch/runtime/hxcpp.h.gch...
 
 Compiling group: runtime
 xcrun --sdk macosx clang++ -D_CRT_SECURE_NO_DEPRECATE -DHX_UNDEFINE_H -c -fvisibility=hidden -stdlib=libc++ -Qunused-arguments -O2 -I/usr/local/lib/haxe/lib/hxcpp/4,0,4/include -DHX_MACOS -m64 -Wno-parentheses -Wno-null-dereference -Wno-unused-value -Wno-format-extra-args -Wno-overflow -Wno-bool-conversion -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=331(haxe) ... tags=[haxe]
- - src/hx/Boot.cpp 
  - src/hx/Anon.cpp 
+ - src/hx/Boot.cpp 
  - src/hx/CFFI.cpp  [haxe,static]
  - src/hx/Date.cpp 
  - src/hx/gc/GcCommon.cpp  [haxe,gc]
@@ -1001,4 +1003,4 @@
  - Random.cpp 
  - Socket.cpp 
 Link: ApplicationMain
-Andreass-Air:font-test3 andreas$ openfl test macos -clean

One can see some differences that maybe make the difference. Maybe someone can look into this issue as I can not include the whole asset path in our game.

My project.xml

<?xml version="1.0" encoding="utf-8"?>
<project>
	<window fps="30" />
	<meta title="Pirate Fantasy Homepage" package="" version="1.0.0" company="Pixel Racoons GmbH" />
	<app main="HomePage" path="Export" file="Pirate Fantasy HomePage" />
	<source path="Source" />
	<haxelib name="openfl" />
	<config:android target-sdk-version="19" />
	<!-- <assets path="Assets" rename="assets" /> If included font rendering works! -->
	<assets path="Assets/fonts" rename="fonts" embed="true" />
	<assets path="Assets/localisation" rename="localisation" embed="true" exclude="*.ods" />
	<assets path="Assets/assets/assets_pf_homepage" rename="assets/assets_pf_homepage" embed="true" exclude="/bin" />
</project>

Many thanx and

Best regards
Andreas


#176

Hey, I think I found the issue

I don’t know how this happens (I’d appreciate if someone does find why) but somehow in OpenFL fonts, there’s a case where you can get an OpenFL font with a src property (which holds the native font reference) without any of the font measurements. The only places I can see src assigned in Lime call __initializeSource right away, which sets all these values. Otherwise there’s an internal __copyFrom.

Try this: https://github.com/openfl/openfl/commit/b4bbcbe3d8975c49d47ad1bc03cc33a3ce258e17


#177

Hi,

just tested it. Means I applied your commit to openfl master branch and rebuild my test app.
The fonts are working properly this way. Hope this fix finds its way into next openfl release.

Many thanx and

Best regards
Andreas


#178

Hi,

I have a new issue popping up. DisplayObjects(Containers) will disappear on mouse over if ColorMatrixFilter is applied.

I can make videos if you want it.

It sounds a bit strange. I thought I might have an error in my code, but actually it does nothing relevant at all. It also happens If I do not register MOUSE_OVER events on those objects. And I have this issue on multiple different code places.

Any help is highly appreciated.

Many thanx and

Best regards
Andreas


#179

This is with the latest development versions?

I tried to reproduce this with a simple sample (object with filter, MouseEvent.MOUSE_OVER added) but it seems to work fine, does anything happen in the MOUSE_OVER events that changes the objects or the hierarchy in some way?


#180

We had these bugs with transparency too, but after a BitmapData with ColorMatrixFilter applied was copied over another BitmapData.


#181

Hi, I will try to set up a test case tomorrow. Many thanx so far.


#182

We’re also trying to work on expanding unit testing to catch more of these moving forward, but it’s tough :slight_smile:


#183

Hi,

I want to implement Google Pay into our Android version of our app.
Do you have any hints how to mix Android Java code with Haxe code?

Did a quick search but found nothing feasible.

Many thanx and

Best regards
Andreas