XCode PNG files makes the game slow

Macspayne2017
Level 1 - Speck of dust
Posts: 12
Joined: 10 May 2020, 16:55

XCode PNG files makes the game slow

Unread post by Macspayne2017 » 25 Jul 2020, 01:09

Greetings everyone,

I am a game designer and in the very near future, I will have my first iOS game launched to the App Store.

However it turns out, after testing on iPhone 6 (which is cleared with a 10 step guide to ensure it runs fast), that the game is buggy and runs slow - as soon too many graphic items(boss fights) are on the screen at the same time.

My game is being developed in XCode.

Any tips and tricks on how the code should be build to overcome this type of bug?

Best regards

Ken

User avatar
JesperSB
Level 28 - Kraken
Posts: 281
Joined: 31 Aug 2017, 13:08
Location: Hvidovre
Contact:

Re: XCode PNG files makes the game slow

Unread post by JesperSB » 25 Jul 2020, 06:29

Is it because You are using it like a transparent picture.?

Else try to change the format to Jpg.
Load it in paint, and save it in jpg.


It might be something more stupid.
In my game I had a call for writing on the screen, when you touch a door, or searchable objects.
But when you have a call for each door, and you have a city, with 20 house, with 2 doors each, and 3-4 other objects inside the house...

When I enclose my call, I got 50% faster Fps.

Just a Hypnotist making games and writing books.

Latest Game (Skyrim ala RPG)...
https://store.steampowered.com/app/1078 ... RuneChild/

User avatar
jonaz.dk
Site Admin
Posts: 4106
Joined: 04 Mar 2008, 22:24
Location: DK
Contact:

Re: XCode PNG files makes the game slow

Unread post by jonaz.dk » 25 Jul 2020, 10:15

Without knowing anything about your project at all.

Is it built on an existing game engine?
Could you post a screenshot or movie of when it is really bad with performance?
Are you using Vulkan or Metal? Not totally up to date with this. But you should read up on it. As there can be dramatic performance improvements to gain.

But generally you probably could do a number of things to help performance and memory stability.
Limit the amount of draw calls on the screen and memory usage of the artwork and assets.

- JPG is great for large background images without transparency. Scale them to half resolution if possible.
- In code/design scale down the number of assets on the screen. Perhaps you have a 1000s of different, large, alpha blending materials?! That could be bad.
- Not having images that are a higher resolution then they need to be.
- Not having images that have a higher color depth then they need to be.
- Use a spritesheet packer of sorts. Have PNG images that is being used in the power of 2. Eg. 2048*2048
Haven't tried this.. but might help: https://www.codeandweb.com/free-sprite-sheet-packer
- You can compress/optimize the final PNG sprite sheets even further. Using your artpackage or there are also some online PNG optimizes that does a good job. This will usually come at the expense of some reduced visual quality.
- Also loading more images to memory than is needed could be an issue.
- Also if you have a lot of audio. Make sure to trim and compress it properly as well. And load/stream it when necessary.

Macspayne2017
Level 1 - Speck of dust
Posts: 12
Joined: 10 May 2020, 16:55

Re: XCode PNG files makes the game slow

Unread post by Macspayne2017 » 25 Jul 2020, 11:10

Thank you for your fast answers, Jesper and Jonas. Really helpful. I have forwarded this to the coder.

My job is graphics and game design, while he is doing the Xcode.

I will continue this thread if I can answer the questions of course.

Macspayne2017
Level 1 - Speck of dust
Posts: 12
Joined: 10 May 2020, 16:55

Re: XCode PNG files makes the game slow

Unread post by Macspayne2017 » 28 Jul 2020, 10:29

Just to round this up, thank you again for your knowledge.

Downloading ready-made PNG files (from craftpix.net, since I mainly try to make games within the RPG genre) were too big and many of the files were never "Trimmed". So removing the extra space inside for example 1 x picture could reduce its size from 100% to 25%.

Yeahh, sometimes small stuff makes a big difference.

User avatar
jonaz.dk
Site Admin
Posts: 4106
Joined: 04 Mar 2008, 22:24
Location: DK
Contact:

Re: XCode PNG files makes the game slow

Unread post by jonaz.dk » 28 Jul 2020, 10:46

Awesome! Happy you guys got it running! :)

By all means!.. You are very welcome to share more about your project when it's ready.

Macspayne2017
Level 1 - Speck of dust
Posts: 12
Joined: 10 May 2020, 16:55

Re: XCode PNG files makes the game slow

Unread post by Macspayne2017 » 28 Jul 2020, 11:54

Thank you Jonaz :-)

User avatar
jonaz.dk
Site Admin
Posts: 4106
Joined: 04 Mar 2008, 22:24
Location: DK
Contact:

Re: XCode PNG files makes the game slow

Unread post by jonaz.dk » 04 Aug 2020, 09:46

Oh yeah just on another note. You wrote in another thread that you are developing in Unity. In case of that. I'm sure you already found sprite slicing and the sprite sheet editor useful.
In Unity and UE the image formats are reprocessed to internal formats. So Eg. Using lossy JPG's for source images would be a BAD idea! As you you would loose some upper limits for visual quality control.

For image data heavy projects you could go enable crunch compression on each image. That could have a dramaric effect on file size and loading speeds.
It will cost a bit on visual quality. So use the srttings with care.

Macspayne2017
Level 1 - Speck of dust
Posts: 12
Joined: 10 May 2020, 16:55

Re: XCode PNG files makes the game slow

Unread post by Macspayne2017 » 25 Aug 2020, 22:09

Anyone wants to play my game to see the perfomance, I can invite to try to my game, I just need your email address (iPhones only).

Post Reply