Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / In order not to burden the processor, which is better to do

Author
Message
metamorpho
8
Years of Service
User Offline
Joined: 17th Oct 2016
Location: Planet Earth
Posted: 27th Apr 2019 12:54
In order not to burden the processor, which is better to do:

to make sprite invisible?
SetSpriteVisible(r_fait5,0)

or lead off the visible area of the screen?
SetSpritePosition(r_fait5,-2000,-2000)


Does the render draw what is behind the visible area of the screen?
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 27th Apr 2019 12:59 Edited at: 27th Apr 2019 13:00
Technically setting the sprite to be invisible is slightly faster than moving it off screen but the difference is absolutely tiny in real terms.

In the AppGameKit engine the sprite is first checked if it is visible or not....if its not then no further time is spent on it. if it is visible then a test is done to compute if any part of it is on screen =GetInScreen() and if it computes the sprite is not visible on the screen it isnt drawn. So technically, making it invisible is slightly faster.
metamorpho
8
Years of Service
User Offline
Joined: 17th Oct 2016
Location: Planet Earth
Posted: 27th Apr 2019 13:17
Bengismo, thanks !!!!
ApkGames.Guru
11
Years of Service
User Offline
Joined: 25th Oct 2013
Location: England, UK
Posted: 27th Apr 2019 20:57
@metamorpho - Personally, I've not noticed any performance degregation using either method, visible = 0 or putting out of range of the visible screen. I've used both and both are just as good without causing any issue.
PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 27th Apr 2019 21:01
When it comes to a massive amount of sprites, you'll clearly see that invisible sprites are faster than out-of-range sprites


PSY LABS Games
Coders don't die, they just gosub without return
metamorpho
8
Years of Service
User Offline
Joined: 17th Oct 2016
Location: Planet Earth
Posted: 28th Apr 2019 14:43
ApkGames.Guru, PSY, thanks !!!!
Jerry McGuire
7
Years of Service
User Offline
Joined: 25th Mar 2017
Location:
Posted: 3rd May 2019 01:43
Great, I had the same question!
AppGameKit 2018.10.10

iMac Book Pro, MacOS 10.14, Xcode 10.1;
iPhone 6, iOS 12; iPad (3rd gen), iOS 9.35; iPad Pro 12'9 (2nd gen), iOS 12.

Dell Precision T7400, Windows 7 Professional 64bit, Visual Studio Community 2017;

Login to post a reply

Server time is: 2024-11-22 21:42:20
Your offset time is: 2024-11-22 21:42:20