The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
October 09, 2024, 09:38:34 am
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  General UQM Discussion (Moderator: Death 999)
| | |-+  iPhone port almost complete, some Q's maybe someone can help with...
« previous next »
Pages: [1] 2 Print
Author Topic: iPhone port almost complete, some Q's maybe someone can help with...  (Read 8996 times)
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
iPhone port almost complete, some Q's maybe someone can help with...
« on: October 19, 2009, 09:18:08 pm »

Hi all,

Through more effort than I expected, I have UQM running on an iPhone 3G OS 2.2.1 at full speed 95% correctly... there are some minor issues that are really nagging me.  I'm wondering if anyone has an ideas.

-The planets in solar system view are all blue.  When you enter planetary orbit, the planets all render correctly.  The colormaps are loading, I verified this...
-The probe that comes to you when you first enter earth orbit never comes

There are also a miriad of other minor graphical problems I havn't been able to check out yet...

Here's a screenshot of what I'm looking at... does anyone know where I should be looking in the code to diagnose this?

http://lh6.ggpht.com/_k-wHEeIeuS4/Sty7EgPfQCI/AAAAAAAAAFI/N_-Y7O9upSQ/Picture%204.png
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #1 on: October 20, 2009, 12:35:57 am »

Good to hear that there is another port in progress.

The planet pictures are actually just different files. The colour maps don't come in here.
Am I right that when you say you enter planetary orbit, you actually mean that you just enter the "inner view" with the planet and its moons, and that you didn't actually "touch" the planet so that you can scan it (which is referred to in the game as "orbiting"), and then left again?
Have you touched the .ani files at all? And what version of UQM are you using? Plain 0.6.2, or some SVN version?
As for the Ur-Quan probe, I can imagine that this happens when the game cannot find the data files for it. Could you post the terminal output? Or it may have something to do with the time keeping. Do the other events run alright (like the Slylandro probes appearing in HyperSpace?).
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #2 on: October 20, 2009, 02:30:35 am »

Thanks for the reply... The content pack is unmodified I'm using the 0.6.0 content pack... The source is 0.6.2 and I downloaded it from the web site, not SVN.

The "inner" orbit you speak of, actually renders correctly.  For earth, the moon is grey, the station is there, and the earth is red.  Any more zoomed out views result in all the planets being blue.  Like the screenshot I posted.

The hyperspace encounters work perfectly.

As for the probe, there is an exception during it's load, but I don't know why it happens.  Here's the output:

   'probe.lst' -- 47 bytes
   'probe/promicon.ani' -- 24 bytes
   'probe/probe.cod' -- 1 bytes
Trying to get undefined resource 00000000

This occurs because the load_ship function is passing in a 0 for load resource.  The 0 comes from the ship pointer->ship_info->ship_icons which is always 0.  However the rest of the "race data" appears to be there... I just assumed this was normal.  The texture: probe/promicon.0.png is loading correctly.
Logged
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #3 on: October 20, 2009, 02:58:41 am »

UPDATE: I ran a build in windows, and that unable to load resource problem occurs there too.  That can't be the problem.

It is important to note that none of the ogg files are working currently due to libogg for iphone being completely unusable.  All other sounds are ok.  I wonder if the timing is based on the audio?
Logged
Angelfish
Enlightened
*****
Offline Offline

Posts: 568



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #4 on: October 20, 2009, 09:40:34 am »

I'm wondering.. What happens when you enter another system instead of Sol? Could you try planetary orbit in a few of the planets in other systems aswell?
Logged
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #5 on: October 20, 2009, 07:42:33 pm »

Other systems same deal, all the planets are blue
Logged
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #6 on: October 20, 2009, 10:57:38 pm »

UPDATE:

Turns out the planet color bugs was a problem with the implementation of SDL_Image on iPhone.  In short, the implementation of SDL_Image on iPhone was shortsighted and the images were loaded without palettes.  I fixed this bug and tons of graphical problems went away. Fonts now draw correctly etc...

The only two problems left now that i can see are the Ur-Quan probe encounter in the beginning of the game, it still doesn't occur.  And the "sound waves" that draw in the purple grid when aliens talk to you aren't drawing.
Logged
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #7 on: October 21, 2009, 04:03:16 am »

Everything is fixed and working now.

My only problem is the Ur-Quan probe not coming out... it's frustrating... everything is loading and setting up correctly, it just never happens.
Logged
superbutcherx
*Many bubbles*
***
Offline Offline

Posts: 116



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #8 on: October 21, 2009, 06:32:26 pm »

UPDATE:

Turns out the planet color bugs was a problem with the implementation of SDL_Image on iPhone.  In short, the implementation of SDL_Image on iPhone was shortsighted and the images were loaded without palettes. 


Hi!

I'm having the exactly same problem on my macbook build! Only all my planets are in beautiful cyan...


A friendly soul pointed me to this thread's direction and now I'm looking for solution.

What did you exactly change in the SDL_image sources? I've fiddled around a bit with xcode, tried to move the /* Load the palette, if any */ subroutine a bit upper in the IMG_png.c source, but that didn't help. I don't have a clear idea of what I'm doing so could you perhaps nudge me into the right direction here...?
Logged
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #9 on: October 21, 2009, 07:54:25 pm »

First of all congrats on getting a MacOS build to at least get to that point, I can't even get one to successfully compile :-)

There were two problems with the planets being cyan, the first was the colormaps not loading correctly. If you see this in your output: "BUG: XFormPLUT(): no current map" you have that problem.

This is because the BYTE type in the source is loosely defined.  It has to be unsigned, or the colormap indicies passed into the SetColormap() function will be negative numbers most of the time.  Setting BYTE to unsigned causes a ton of compiler warnings because the  code also treats strings and characters as BYTEs, and you shouldn't pass unsigned bytes into string functions typically.  But for the most part it seems to be working anyway for me.

The second problem was in the SDL_Image source, there were two LoadPNG functions, one was overwriting the other.  The one in question was using Objective-C to load the PNG into a CGImage and then converting that CGImage into a SDL surface.   However the CGImage had no palette as the iPhone objective-c load routines remove it.

I removed this load function, and compiled in libpng, this caused the LoadPNG function to actually load it correctly (Even if a bit slower) and the planets all became the right color. 

I hope this helps.
Logged
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #10 on: October 21, 2009, 10:18:04 pm »

Update I have the probe working now!!! Hooray!

The iPhone project will enter final testing now, get a few more optimizations (Although it seems to be running very close to full speed to me).  I'll then submit it to the App store for the general public, and release the source for the iPhone developers amongst you.
Logged
superbutcherx
*Many bubbles*
***
Offline Offline

Posts: 116



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #11 on: October 21, 2009, 10:57:32 pm »

Great job! I got to tell my Iphone-wielding friends right away.

I, on the other hand, have not been as successful.

I figure my problems aren't caused by the BYTE problem since there is no XformPLUT... output in the debug information printed during game (and neither in compilation messages).

So it should be that SDL_image then. I found the two functions, other was in IMG_imageIO.c and the other in IMG_png.c. After deleting the Objective-C style loadPNG code in IMG_imageIO.c I had to add libpng source files and headers to the xcode project as well as zlib sources and headers (libpng seems to want something from there). Then the whole thing would compile into a SDL_image_framework.

But it doesn't work... After flashing the screen and changing to lower resolution the whole shebang crashes with
"We've loaded the Kernel
VideoDecoder_Load: Unknown file type
   'lbm/title.ani' -- 20 bytes
Bus error"

First of all, there was that #ifdef LOAD_PNG in the IMG_png.c that prevents compiling the file... I found no way to circumvent it so I just defined LOAD_PNG before that. I guess it would be actually defined if the libpng was correctly included?

Which brings me to my second point: I included pretty much all the c- and h-files from the libpng source into the SDL_image xcode project. (and after that, the zlib ones). Would there be a smarter way to do this with fewer included files?

I also tried without adding anything from libpng but it would not show any graphics then (error messages about trying to draw NULL frame or something)


So, it seems the loadPNG isn't functioning correctly. Any ideas?
(Sorry for this thread hijacking novella...)
Logged
Cupcakus
Zebranky food
*
Offline Offline

Posts: 12



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #12 on: October 21, 2009, 11:03:52 pm »

Make sure you put InitPNG() somewhere...  my guess is that is what is missing.  If you don't the structure that holds all the function pointers for loading a PNG never gets filled, and the app will crash on the first PNG it tries to load.  I think I haphazardly just stuck it as the first line in LoadPNG() but it probably should be put somewhere better.
Logged
superbutcherx
*Many bubbles*
***
Offline Offline

Posts: 116



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #13 on: October 21, 2009, 11:38:06 pm »

Oh boy... oh wow... WOW!

Man! You're the Man!!!

That really did the trick!
Gone is the bad old cyan, I'm gazing at a sparkling plethora of small spheres in colors, colors, colors! (And haven't even taken my medication yet...)

I put the initPNG in the same spot. Not gonna move it if it doesn't give any trouble.

I reckon this epic battle could be worth writing a howto about.
Logged
Angelfish
Enlightened
*****
Offline Offline

Posts: 568



View Profile
Re: iPhone port almost complete, some Q's maybe someone can help with...
« Reply #14 on: October 21, 2009, 11:53:21 pm »

Nice to see this, the iPhone port if it appears in the apple store might attract a lot of new players to UQM and the Star Control Universe Smiley
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!