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

Have you seen https://github.com/HaxeExtension/extension-iap? Do you think this would cover it?

1 Like

Hi, very nice. Will check it!!! Thank you!

Hi,

I have some code based on “DisplayingABitmap”. It looks like the following.

package;

import openfl.display.Bitmap;
import openfl.display.Sprite;
import openfl.events.MouseEvent;
import openfl.filters.ColorMatrixFilter;
import openfl.Assets;

class Main extends Sprite {

	static var PF_FILTER_BLACK_WHITE : ColorMatrixFilter = new ColorMatrixFilter([1 / 3, 1 / 3, 1 / 3, 0, 0, 1 / 3, 1 / 3, 1 / 3, 0, 0, 1 / 3, 1 / 3, 1 / 3, 0, 0, 0, 0, 0, 1, 0]);

	private function onMouseOver(event: MouseEvent) {
		cast(getChildAt(0), Sprite).getChildAt(0).visible = !cast(getChildAt(0), Sprite).getChildAt(0).visible;
		cast(getChildAt(0), Sprite).getChildAt(1).visible = !cast(getChildAt(0), Sprite).getChildAt(1).visible;
	}

	public function new () {
		super ();
		var bitmap1: Bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));
		bitmap1.visible = true;
		var bitmap2: Bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));
		bitmap2.visible = false;
		var bitmap3: Bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));
		bitmap3.visible = true;
		var sprite: Sprite = new Sprite();
		sprite.buttonMode = true;
		sprite.addChild(bitmap1);
		sprite.addChild(bitmap2);
		sprite.addChild(bitmap3);
		sprite.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
		sprite.addEventListener(MouseEvent.MOUSE_OUT, onMouseOver);
		sprite.filters = [PF_FILTER_BLACK_WHITE];
		addChild(sprite);
		sprite.x = (stage.stageWidth - sprite.width) / 2;
		sprite.y = (stage.stageHeight - sprite.height) / 2;
	}
	
	
}

So sometimes the sprite disappears when hovering over it or leaving it with mouse pointer. On Safari/MacOSX it always disappears if switching to another application window or changing desktop and switching back after that. Or after opening/closing the console pane in the browser window.

I have a workaround for this in my code now. So I have no hurry. Thought you might be interested anyways.

Many thanx and

Best regards
Andreas

Hi,

I get compilation errors when trying to compile the sample application. Any hints?

Andreass-Air:sample andreas$ openfl build android
**Error:** **Could not find haxelib "extension-iap", does it need to be installed?**
Andreass-Air:sample andreas$ haxelib install extension-iap
Downloading extension-iap-1,2,2.zip...
Download complete : 2153411 bytes in 1.1s (1847.4KB/s)
Installing extension-iap...
Current version is now 1.2.2
Done
Andreass-Air:sample andreas$ openfl build android
/usr/local/lib/haxe/lib/extension-iap/1,2,2/extension/iap/android/IAP.hx:10: characters 7-23 : Type not found : openfl.utils.JNI
Andreass-Air:sample andreas$ ls
README.md application.xml assets bin certificates openfl-readme.txt src
Andreass-Air:sample andreas$ openfl build android application.xml
**Error:** **You must have a "project.xml" file or specify another valid project file when using the 'build' command**
Andreass-Air:sample andreas$ openfl build application.xml android
/usr/local/lib/haxe/lib/extension-iap/1,2,2/extension/iap/android/IAP.hx:10: characters 7-23 : Type not found : openfl.utils.JNI
Andreass-Air:sample andreas$

Many thanx and

Best regards
Andreas

Hi,

Ok. Fixed it by manually compile master branch and using install.sh.

Many thanx and

Best regards
Andreas

Sorry about that,

You should be able to use haxelib dev extension-iap path/to/your/git/repository and lime rebuild extension-iap ios to rebuild the binaries

Hi,

short question. I can not get the example to work regarding payment. I can click a package to buy but then nothing happens. The console states:

I/trace   (13326): Store.hx:145: IAP: Available: true
I/trace   (13326): Store.hx:156: initFailed
...
I/trace   (13326): Store.hx:101: gold_x_1k
I/trace   (13326): Store.hx:382: PURCHASE WITHOUT IAP - productID: gold_x_1k

Which Android API level do I need to use? I have a FireOS tablet. Maybe its too outdated. Hmm. Which android version is required?

Many thanx and

Best regards
Andreas

Hi,

Ok. Seems like my tablet is to old as Google Pay was introduced in 2015/2016. My tablet is from 2014 if I remember right.

Update: Android 5 is required. My tablet has 4.x.

Many thanx and

Best regards
Andreas

I haven’t tried this in a long time, but I think there is something you may need to do on your account to make sure that purchasable items are set up, then devices may need to run in a special sandbox in order for your demo items to be available to “buy.”

Also, I believe that Amazon devices lack Google Play Services, so purchasing there must be done using another API. I thought I heard of a company that added Amazon support to extension-iap, though, but didn’t contribute it back. I could try and hunt it down if you need it

1 Like

Hi,

I will try to get a plain Android tablet. No need to support Amazon Fire tablets I guess. Would be nice still. But not required for now.

I will come back to you If I have problems with a ordinary Android tablet.

Many thanx and

Best regards
Andreas

Hi,

Regarding disappearing display object containers I have this bug at multiple places and there is one I know I cannot solve on my own.

Any help is highly appreciated. I also think that this bug is kind of new.

Many thanx and

Best regards
Andreas

Hi,

is there any way/chance to get focus out event with text fields working?

textField.addEventListener(FocusEvent.FOCUS_OUT, focusOutEvent);

I need this at several places. This would be amazing.

I guess doing this for text fields is not that hard as e.g. the cursor disappears if clicking somewhere else. In this place the event could be fired. Just a simple idea.

Many thanx and

Best regards
Andreas

Focus events were recently improved, but if this still is not working, then we may have to write a small sample and run some tests

1 Like

Hi,

just in the moment I updated to latest lime and OpenFL. The issue still remains.
If you need a example I can try to set it up tomorrow.

Many thanx and

Best regards
Andreas

Hi,

any news here?

I have a crash in a Android debug build of our game. Do you have any idea? It seems like it happens randomly. Maybe out of memory or something. I have no idea. Please see attached the log:

01-27 10:53:00.118  8524  8565 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 8565 (SDLThread), pid 8524 (s.piratefantasy)
01-27 10:53:00.306  8717  8717 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-27 10:53:00.307  8717  8717 F DEBUG   : Build fingerprint: 'Lenovo/LenovoTB-X304F/X304F:8.1.0/OPM1.171019.026/S001014_181113_ROW:user/release-keys'
01-27 10:53:00.307  8717  8717 F DEBUG   : Revision: '0'
01-27 10:53:00.307  8717  8717 F DEBUG   : ABI: 'arm'
01-27 10:53:00.307  8717  8717 F DEBUG   : pid: 8524, tid: 8565, name: SDLThread  >>> com.pixelracoons.piratefantasy <<<
01-27 10:53:00.307  8717  8717 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
01-27 10:53:00.307  8717  8717 F DEBUG   : Cause: null pointer dereference
01-27 10:53:00.307  8717  8717 F DEBUG   :     r0 0000002c  r1 00000000  r2 00000000  r3 00000000
01-27 10:53:00.307  8717  8717 F DEBUG   :     r4 00000001  r5 0000ffff  r6 c4260c68  r7 c0f0046c
01-27 10:53:00.307  8717  8717 F DEBUG   :     r8 00000000  r9 c4261038  sl 00000000  fp c426100c
01-27 10:53:00.307  8717  8717 F DEBUG   :     ip c4260730  sp c4260c08  lr c612f098  pc c612f054  cpsr 20030010
01-27 10:53:01.451  8717  8717 F DEBUG   : 
01-27 10:53:01.451  8717  8717 F DEBUG   : backtrace:
01-27 10:53:01.452  8717  8717 F DEBUG   :     #00 pc 01b2b054  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so ((anonymous namespace)::DebuggerTrap()+52)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #01 pc 01b2b094  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (CriticalGCError(char const*)+48)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #02 pc 01b32b68  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (LocalAllocator::ExitGCFreeZone()+48)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #03 pc 01b333f0  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (hx::ExitGCFreeZone()+48)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #04 pc 01b25244  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (gc_exit_blocking+4)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #05 pc 000c08a0  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/liblime.so
01-27 10:53:01.452  8717  8717 F DEBUG   :     #06 pc 000c2b40  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/liblime.so
01-27 10:53:01.452  8717  8717 F DEBUG   :     #07 pc 000bfcb0  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/liblime.so
01-27 10:53:01.452  8717  8717 F DEBUG   :     #08 pc 019ed164  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (lime::_internal::backend::native::NativeApplication_obj::exec()+1460)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #09 pc 019dde6c  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (lime::app::Application_obj::exec()+116)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #10 pc 019dc0d4  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (ApplicationMain_obj::create(Dynamic)+5672)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #11 pc 019da390  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (ApplicationMain_obj::main()+156)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #12 pc 01b1f768  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (__hxcpp_main+32)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #13 pc 01b1f658  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/libApplicationMain.so (hxcpp_main+40)
01-27 10:53:01.452  8717  8717 F DEBUG   :     #14 pc 00467af0  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/lib/arm/liblime.so (Java_org_libsdl_app_SDLActivity_nativeRunMain+508)
01-27 10:53:01.453  8717  8717 F DEBUG   :     #15 pc 000027f1  /data/app/com.pixelracoons.piratefantasy-ZfeDh1lqnew6jVoixe80OA==/oat/arm/base.odex (offset 0x2000)

I will test soon if this happens on iOS too. Unfortunately MacOS builds are broken currently too as there seem some misbehavior with window management or something.

It should look like.

Many thanx.

Best regards
Andreas

I also see this in the log.

01-27 11:55:45.962  6328  6348 E libEGL  : validate_display:92 error 3008 (EGL_BAD_DISPLAY)
01-27 11:55:53.328  6328  6348 E Lime    : Lime set onCallback 0xce4fee58
01-27 11:55:53.343  6328  6328 E Lime    : Lime onCallback 0xce4fee58
01-27 11:55:53.352  6328  6348 E HXCPP   : Critical Error: GCFree Zone mismatch
01-27 11:55:53.353  6328  6348 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 6348 (SDLThread), pid 6328 (s.piratefantasy)

The dev version of Lime has a new version of SDL that should fix the Mojave issue

It might also work better for GC, I’m not sure, are there native extensions active when it crashes on android?

Hi,

I did not activate anything special. I can test dev version of lime today and report if my issues are fixed.

Many thanx and

Best regards
Andreas

Hi,

Lime dev version + Mac OS build of our game does have the (initial) reshaping working, but there are other issues like missing graphics and wrong positioned display objects and such, but its a dev version so I guess I do not need to care.

Many thanx and

Best regards
Andreas

Did you update GIT submodules, and perform a clean rebuild?

When we change dependencies (such as an SDL version) it usually requires an openfl rebuild mac -clean