# Facebook instant game (HTML5 iOS) problem (SOLVED)

**URL:** <https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461>\
**Category:** Bugs\
**Created:** [August 6, 2018, 11:48am UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461 "2018-08-06T11:48:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincent.barabus](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/v/8e8cbc/32.png) [@vincent.barabus](https://forum.defold.com/u/vincent.barabus)\
**Post date:** [August 6, 2018, 11:48am UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/1 "2018-08-06T11:48:45Z")

</div>

We are develop a game for Facebook instant games platform.

Instances on PC, Mac and Android have no problems.

Instance on iOS have a problem: game objects do not releases it`s resources after destroying.

Watch the video…

[![](https://i.ytimg.com/vi/dmaMgTZRVic/hqdefault.jpg "Defold HTML5 iOS problem") ](https://www.youtube.com/watch?v=dmaMgTZRVic)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [August 6, 2018, 2:05pm UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/2 "2018-08-06T14:05:36Z")

</div>

It’s starting to lag right?

Are you deleting game objects that goes off screen? Check profile to confirm instance count.

Is the gun moving vertically or the coins etc? Ie is gun y position constantly increasing or staying around 0?

---

<div class="post-metadata">

**Author:** ![vincent.barabus](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/v/8e8cbc/32.png) [@vincent.barabus](https://forum.defold.com/u/vincent.barabus)\
**Post date:** [August 6, 2018, 3:00pm UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/3 "2018-08-06T15:00:20Z")

</div>

> It’s starting to lag right?

Yes.

> Are you deleting game objects that goes off screen?

Yes.

> Is the gun moving vertically or the coins etc?

The gun moving vertically, the gun y position constantly increasing.

> Check profile to confirm instance count.

We recorded a video with profiler…

[![](https://i.ytimg.com/vi/4tWEJzS8BHc/hqdefault.jpg "Defold HTML5 iOS problem.") ](https://www.youtube.com/watch?v=4tWEJzS8BHc)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [August 6, 2018, 3:20pm UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/4 "2018-08-06T15:20:07Z")

</div>

In general, the further you get away from origin (0,0,0), due to floating point precision you’ll lose accuracy. Check this post for more info: [Floating point precision](https://forum.defold.com/t/floating-point-precision/11247)

So, for infinite runners it’s a good idea to make the character “stand still” and instead let the objects animate towards the character.

Also, for the same reason, you might lose precision in rendering too, so you might need to use `midp`, or even `highp` precision in the shaders.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [August 6, 2018, 3:23pm UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/5 "2018-08-06T15:23:11Z")

</div>

By looking at the profiler video, nothing really stands out. The numbers seem to remain constant.

Q: At what coordinate is the gun at the end of the video?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [August 6, 2018, 8:11pm UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/6 "2018-08-06T20:11:52Z")

</div>

The lag is most definitely due to the loss of precision. I’ve seen it multiple times before. Changing to highp in the shadr will help, but a more permanent solution is to let the gun stay still and move everything else.

---

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [August 6, 2018, 9:04pm UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/7 "2018-08-06T21:04:41Z")

</div>

Parent everything in the world to a root object, then move it downward. Chunk world segments like this with each segment parented to its own root GO.

Keep the gun vertically stationary more or less.

---

<div class="post-metadata">

**Author:** ![vincent.barabus](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/v/8e8cbc/32.png) [@vincent.barabus](https://forum.defold.com/u/vincent.barabus)\
**Post date:** [August 7, 2018, 7:20am UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/8 "2018-08-07T07:20:10Z")

</div>

Looks like you are right. Is is a precision problem.

But why this problem is only on iOS devices? Is this problem of iOS Safari?

---

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [August 7, 2018, 1:38pm UTC](https://forum.defold.com/t/facebook-instant-game-html5-ios-problem-solved/26461/9 "2018-08-07T13:38:55Z")

</div>

Different devices have different ways of handling the rendering. You would see similar issues with other game engines most likely.

You will eventually see similar issues on other devices the further objects are away from world origin. Nearly all modern big games have the world moving around the player rather than the player moving around the world.
