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.

iOS and MacOS / Launch Images disappear before app has chance to load - xcode 5.1.1

Author
Message
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 18th Apr 2014 00:10
So in Wordspionage I have it set up so that it will show the xcode/iOS launch image and then replace it with an image loaded by AppGameKit so that it is fairly seamless loading.

However, with my new game, I'm doing the same thing, but I get a black screen on iOS for a split second before the AGK-loaded images show up. It's really poor.
I tried adding sleep() to the Obj C method for didFinishLaunchingWithOptions
so that it will sleep for 3 seconds after App.Begin() is called, but it didn't help. The launch image is shown for longer, but I still get a black screen for a split second before AppGameKit can load up the replacement images (one 178kb image and one 31kb image). The images are so small it really makes little sense.

It's really ugly.

Is there a way that I can delay the iOS launch image to wait to disappear until my loading is done?

I hope Gekko is listening

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Apr 2014 04:39
Nothing actually displays from App::Begin() and calling the Sync command has no affect there.

Are you using a state engine sort of thing in App::Loop()?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 18th Apr 2014 06:25
It's all t1, so no not really.
There's just those 2 images loaded before the 1st sync() call. So really not much going on yet other than all of the interpreter initiation.
I know nothing is displayed by App.Begin(), but when the iOS app hits didFinishLaunchingWithOptions is when the view is initialized and the launch image is dismissed. I was basically hoping that adding a small delay after App.Begin() I would be able to hold the launch image open a little longer.

So now I have 2 choices as I see it:
Write AppGameKit code in core.m that loads and displays the second splash screen and then repurpose a t1 command to hide it later (messy).
OR
Figure out how to properly add an image (or subview?) to UntitledViewController that I can later dismiss by repurposing an AppGameKit t1 command.

I understand how to add the image to the view with drag/drop editing of the UntitleViewController, but I'd really need to do something more programmatic, like load the properly sized launch image.
I have no idea how to reference the launch image or really how to create a subview with that image that I can later dismiss. I'm getting pretty handy at repurposing AppGameKit commands, but I really don't know much about obj c.

Any ideas on how to do something like that programmatically?

in pseudo it would be something like this:
didFinishLaunchingWithOptions
would contain code to create a subview of UntitleViewController that would display the launch image that corresponds to the correct device (could just check dimensions)
then
I could repurpose one of the t1 commands that I don't use to actually dismiss the image.
I'm confident I can do the repurposing, but I need to know the obj c commands to create and dismiss the subview.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Apr 2014 04:31
It wasn't clear that you are in Tier 1 (you referenced methods that appeared to be from the Tier 2 template.

Have you tried doing two Sync() calls? The app works with two display buffers. I had a similar issue and was able to fix it with two Sync() calls to make sure the active display buffer was updated.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Apr 2014 06:28
Yeah I tried that with Wordspionage back when I first encountered the issue. Just tried it with this game and no difference (tried adding up to 4 sync commands).
Launch image displays for 2-3 seconds and then a black screen for about half a second and then the program's first images are shown.
What seems to be happening is that App.Begin() really needs to be done before didFinishLaunchingWithOptions is called. Because it seems like that starts up and takes a couple seconds to initiate and loads the bytecode, but iOS wants to dismiss the launch image as soon as didFinishLaunchingWithOptions is called.

I am mixing t1 and t2 at this point. T1 can't solve the issue on it's own and AppGameKit is very slow to load on iOS (about 5 secs on average on an iPhone 4). So I need an intermediary between the iOS launch image and when the t1 app is actually able to display images.

Without this it is really difficult to make my apps look professional.

So all of this really needs to be done at the t2 level but I will likely need a t1 command call to dismiss the viewController / subview once the t1 app is at a point that it has loaded an image and is ready to display.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Apr 2014 06:53
If I get the chance this weekend, I will try to look at the iOS glue code (the stuff that ties the AppGameKit library to the iOS stuff) and see if I can figure out where it is possible to delay the load image dismissal.

It will be somewhere in one of the files in the Classes subdirectory within the Xcode project directory.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Apr 2014 07:00
Thanks!!
Or if you could tell me how to create a subview of UntitledViewController with an image I can later dismiss with the call of a T1 command that would rock.
I think that even if we do delay somewhere in ApppInitCode or Begin that the problem will still exist because iOS dismisses that launch image as soon as didFinishLaunchingWithOptions is called.
I'll work on it too as it's one thing that really really bothers me with AGK.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Apr 2014 21:03
I have actually attempted to not mess with the glue stuff, other than to fix an orientation issue that was later adopted by TGC.

As for making changes that you can access from T1, that is tricky.

In theory, you can rewrite parts of the glue code to take over a command that you think you aren't using. But I haven't tried and would be nervous about unintended consequences.

It is definitely something I don't have the time to investigate.

How big is the byte code file being generated?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Apr 2014 21:21
The bytecode is small at 3.95mb
I've messed with the "glue" by replacing contents of commands in the AGKCommandsTable.cpp

I did it to integrate Chartboost ads and it works 100% ok.

I only seem to be able to replace the single line that has the AppGameKit function call. You can't add multiple lines for reasons unknown to me. If you do then there's some really bad behavior.

I don't really need any help with altering the glue to repurpose T1 commands. I understand that part.

What I need help with is how to add an image programmatically to the UntitleViewController and then later remove it. I read stuff for about 2 hours last night and tried multiple things. None of them worked. The only way I could get an image to show with the UntitleViewController was to manually add it via drag-drop in the XIB interface. And if I do that there doesn't seem to be a way to reference it.

So again, all I really need help with is programatically adding a subview with image to the untitledviewcontroller and dismissing it later. Dismissing the image would need to be contained in its own method so I can call it from a single line via the command definition in the glue.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Apr 2014 22:15
I can't help with programatically adding a subview. I haven't worked with the Apple stuff enough to do that. Sorry.

Cheers,
Ancient Lady
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Apr 2014 22:44
No worries!
Maybe someone else will chime in.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 21st Apr 2014 20:23
So I played with a bunch of apps and many of them exhibit a similar issue. Even the almighty Angry Birds. So I guess I'm OK with it if they are. I do wish I could overlay the launch image on a view until I programatically dismiss it though. Funny how iOS has lots of silly little issues like this, but Android my apps load before you can blink.

JohnnyMeek
10
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 6th May 2014 14:21
I noticed this on my apps too. I think it might be iOS version dependent.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 6th May 2014 20:26
Yes, this only occurs in iOS.
The problem is that the AppGameKit openGL engine is initialized at the same time as the launch image removal. So there's a second or so of black screen. There's 2 ways to fix it: either set up a new UIimage subview that replicates the launch image (or even a loading spinner) OR AppGameKit needs to call App.begin() and let it send back a signal before the didFinishLoadingWithOptions method gets called.
Fortunately even some large developers also have this issue so I feel I can let it slide. It really is the lack of performance of openGL on iOS. There's no reason it should take as long as it does on iOS. Android can boot an AppGameKit app in a second. iOS takes a minimum of 4 seconds...

JohnnyMeek
10
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 7th May 2014 16:27
I meant iOS version as in 5.0 - 7.1 etc

I have an ipad 1 with iOS 5 that seems to behave differently to my iPAD air with iOS 7.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th May 2014 20:24
Yeah, my 3GS shows it a little longer than my inter's 4. I think it's more of a hardware issue though than an os version.

xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 11th May 2014 19:54 Edited at: 11th May 2014 19:58
Can you explain me better what happen?
I didn't understand very well.

Also tell me if Tier 1 or 2.

Long life to Steve!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 11th May 2014 19:59 Edited at: 11th May 2014 20:01
Launch image -> black screen for 0.5 - 1.0 seconds -> AppGameKit can draw first image.
I'd like to get rid of the black screen by adding a UIimageView of the launch image that I can programmatically dismiss once I know AppGameKit has drawn something to screen.

T1, but I can repurpose AppGameKit commands as needed.

xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 11th May 2014 20:12
Hmmm, i never coded with T1.
In T1 i wouldn't know how to share the properties of the UntitledViewController to call it from basic.
Is impossible i think.

I do it in c++.
With C++ and Tier 2 you can do everything you want.

Long life to Steve!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 11th May 2014 20:13
Most of the mods would be in didFinishLaunchingWithOptions. Show me what you'd propose with T2 and I can likely modify it for t1.

xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 12th May 2014 00:27
Well you can do this in the didfinishload:

- Init an image view
- Set the image you want to the image view
- Use the untitledviewcontroller reference to add the subimage (don't use self, it doesn't work, you need a reference to the appdelegate)
- tag the image view with a number (for example 123)
- release the imageview
- when you want to delete the view delete the view with tag 123

You can see how to do reference to delegates in my template in this section

Long life to Steve!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 12th May 2014 19:57
Yes, that's pretty much how I thought to do it, but I don't know enough obj-c to make it work. I think I was using self to try to create the subview before. Would you be able to toss together a quick code example of what to add to didFinishLaunchingWithOptions and a method to dismiss the view?

xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 13th May 2014 02:12
You have all you need in my template in this section.
Try to search all my post, and you will find my template with reference and view managing via tag.

Long life to Steve!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 13th May 2014 02:37
Found it. Thanks. Looks like you've got a ShowHUD that will translate over to what I need once I skim it down a bit.

xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 13th May 2014 17:50
Ah yes, my ShowHUD is because Apple reject apps that lose time to load things.
They want the user see something is moving and loading.

ShowHUD need agk::Sync() to be applied/removed as it is based on the DRAW of the app_delegate.

How do you find my template ?
I think my template is great for coders that wanna pass from Tier 1 to Tier 2!!

OBJ C is really easy and have all kind of functions that works always great!

Long life to Steve!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 13th May 2014 20:18
Quote: "Ah yes, my ShowHUD is because Apple reject apps that lose time to load things."
That's exactly my concern. I'll likely remove AppGameKit commands out of it though and make it so that it uses the same launch image that was already being shown by iOS. That way the user notices nothing. The delay itself is minuscule and many non-AGK apps (even Angry Birds) does the same.

To find threads:
If you click on user's name you can see a list of their threads. Also for yourself there is a button in the upper left of the forum next to a dropdown that says "My Threads" GO...

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 5th Jun 2014 02:41 Edited at: 9th Jun 2014 23:24
Finally I figured out how to do this for Tier 1. It took a while to track down the moment between the initial launch image and when AppGameKit finally starts running the bytecode.
In UntitledViewController.m under the awakFromNib method add the following lines at the end of the method (though you'll need to modify them for your assets):


What I'm doing here is I'm setting a gray background and then overlaying my splash image on top of it. All of the code is pretty straight forward and is the same you'd do in Tier 1 BASIC to load and set up sprites for display. Just make sure they have a depth lower than anything else in your game so all the other sprites overlay them. I'll add a better method where the sprites are deleted after they're no longer needed later, but this works great for my purposes.

(edited for derp removal )

Login to post a reply

Server time is: 2024-04-19 16:17:11
Your offset time is: 2024-04-19 16:17:11