Tuesday, December 2, 2008

Touch Fighter 2 source code



A 2 week, 10,000+ lines coding done by Apple to demonstrate the graphics and audio capabilities of the iPhone for gaming.
YouTube: iPhone SDK Demo - Touch Fighter

The link may only be for Tech Talk attendees or ADC Member but if it works for you, enjoy.

Here is the link to download.
https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?fileID=24200

.
.
.

14 comments:

Anonymous said...

Thanks for providing this link! I tried to get the source before but since I was not a paid ADC member I couldn't get hold of it. :-(

However, now when I tried I managed to get the code because I'm about to attended the Tech Talk Show! :-)

Unknown said...

it did not work for me there where bunch of errors please help me

javacom said...

Is the error related to build & go to simulator or device ?

Is it linker error ?

TC said...

Builds clean for the simulator, but I get a bunch of link errors if I try to build for device.

Building target “TouchFighter2” of project “TouchFighter” with configuration “Debug” — (20 errors)
cd "/Users/trey/Code/iPhone Projects/TouchFighter"
setenv IPHONEOS_DEPLOYMENT_TARGET 2.0
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.0 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk "-L/Users/trey/Code/iPhone Projects/TouchFighter/build/Debug-iphoneos" "-F/Users/trey/Code/iPhone Projects/TouchFighter/build/Debug-iphoneos" -filelist "/Users/trey/Code/iPhone Projects/TouchFighter/build/TouchFighter.build/Debug-iphoneos/TouchFighter2.build/Objects-normal/armv6/TouchFighter.LinkFileList" -mmacosx-version-min=10.5 -Wl,-dead_strip -miphoneos-version-min=2.0 -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework Foundation -framework MediaPlayer -framework OpenGLES -framework SystemConfiguration -framework UIKit -framework OpenAL -o "/Users/trey/Code/iPhone Projects/TouchFighter/build/Debug-iphoneos/TouchFighter.app/TouchFighter"
ld warning: in /Library/Frameworks//OpenAL.framework/OpenAL, file is not of required architecture
Undefined symbols:
"_alSourcePlay", referenced from:
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
"_alSourceUnqueueBuffers", referenced from:
SoundEngineEffect::ClearSourceBuffers() in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
"_alcGetProcAddress", referenced from:
alBufferDataStaticProc(int, int, void*, int, int)in SoundEngine.o
alcMacOSXMixerOutputRateProc(double)in SoundEngine.o
"_alcMakeContextCurrent", referenced from:
OpenALObject::Initialize() in SoundEngine.o
"_alSourcef", referenced from:
SoundEngineEffect::SetPitch(float) in SoundEngine.o
SoundEngineEffect::SetLevel(float) in SoundEngine.o
"_alSourcei", referenced from:
SoundEngineEffect::AttachFilesToSource() in SoundEngine.o
SoundEngineEffect::SetLooping(unsigned char)in SoundEngine.o
"_alSourceStop", referenced from:
SoundEngineEffect::Start() in SoundEngine.o
"_alSourceQueueBuffers", referenced from:
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
"_alcCreateContext", referenced from:
OpenALObject::Initialize() in SoundEngine.o
"_alcDestroyContext", referenced from:
OpenALObject::Teardown() in SoundEngine.o
"_alListener3f", referenced from:
OpenALObject::SetListenerPosition(float, float, float)in SoundEngine.o
"_alSource3f", referenced from:
SoundEngineEffect::SetPosition(float, float, float)in SoundEngine.o
"_alGenSources", referenced from:
SoundEngineEffect::SoundEngineEffect(char const*, char const*, char const*, unsigned char)in SoundEngine.o
"_alDeleteSources", referenced from:
SoundEngineEffect::~SoundEngineEffect()in SoundEngine.o
"_alcCloseDevice", referenced from:
OpenALObject::Teardown() in SoundEngine.o
"_OBJC_CLASS_$_CAEAGLLayer", referenced from:
__objc_classrefs__DATA@0 in EAGLView.o
"_alGenBuffers", referenced from:
SoundEngineEffect::LoadFileData(char const*, void*&, unsigned long&, unsigned int&)in SoundEngine.o
"_alGetSourcei", referenced from:
SoundEngineEffect::ClearSourceBuffers() in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
"_alGetError", referenced from:
SoundEngineEffect::LoadFileData(char const*, void*&, unsigned long&, unsigned int&)in SoundEngine.o
SoundEngineEffect::LoadFileData(char const*, void*&, unsigned long&, unsigned int&)in SoundEngine.o
SoundEngineEffect::AttachFilesToSource() in SoundEngine.o
SoundEngineEffect::ClearSourceBuffers() in SoundEngine.o
SoundEngineEffect::ClearSourceBuffers() in SoundEngine.o
SoundEngineEffect::SetLooping(unsigned char)in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::SetPitch(float) in SoundEngine.o
SoundEngineEffect::SetPosition(float, float, float)in SoundEngine.o
SoundEngineEffect::SetLevel(float) in SoundEngine.o
OpenALObject::Initialize() in SoundEngine.o
OpenALObject::Initialize() in SoundEngine.o
OpenALObject::Initialize() in SoundEngine.o
OpenALObject::SetListenerPosition(float, float, float)in SoundEngine.o
"_alcOpenDevice", referenced from:
OpenALObject::Initialize() in SoundEngine.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
"_alSourcePlay", referenced from:
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
"_alSourceUnqueueBuffers", referenced from:
SoundEngineEffect::ClearSourceBuffers() in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
"_alcGetProcAddress", referenced from:
alBufferDataStaticProc(int, int, void*, int, int)in SoundEngine.o
alcMacOSXMixerOutputRateProc(double)in SoundEngine.o
"_alcMakeContextCurrent", referenced from:
OpenALObject::Initialize() in SoundEngine.o
"_alSourcef", referenced from:
SoundEngineEffect::SetPitch(float) in SoundEngine.o
SoundEngineEffect::SetLevel(float) in SoundEngine.o
"_alSourcei", referenced from:
SoundEngineEffect::AttachFilesToSource() in SoundEngine.o
SoundEngineEffect::SetLooping(unsigned char)in SoundEngine.o
"_alSourceStop", referenced from:
SoundEngineEffect::Start() in SoundEngine.o
"_alSourceQueueBuffers", referenced from:
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
"_alcCreateContext", referenced from:
OpenALObject::Initialize() in SoundEngine.o
"_alcDestroyContext", referenced from:
OpenALObject::Teardown() in SoundEngine.o
"_alListener3f", referenced from:
OpenALObject::SetListenerPosition(float, float, float)in SoundEngine.o
"_alSource3f", referenced from:
SoundEngineEffect::SetPosition(float, float, float)in SoundEngine.o
"_alGenSources", referenced from:
SoundEngineEffect::SoundEngineEffect(char const*, char const*, char const*, unsigned char)in SoundEngine.o
"_alDeleteSources", referenced from:
SoundEngineEffect::~SoundEngineEffect()in SoundEngine.o
"_alcCloseDevice", referenced from:
OpenALObject::Teardown() in SoundEngine.o
"_OBJC_CLASS_$_CAEAGLLayer", referenced from:
__objc_classrefs__DATA@0 in EAGLView.o
"_alGenBuffers", referenced from:
SoundEngineEffect::LoadFileData(char const*, void*&, unsigned long&, unsigned int&)in SoundEngine.o
"_alGetSourcei", referenced from:
SoundEngineEffect::ClearSourceBuffers() in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
"_alGetError", referenced from:
SoundEngineEffect::LoadFileData(char const*, void*&, unsigned long&, unsigned int&)in SoundEngine.o
SoundEngineEffect::LoadFileData(char const*, void*&, unsigned long&, unsigned int&)in SoundEngine.o
SoundEngineEffect::AttachFilesToSource() in SoundEngine.o
SoundEngineEffect::ClearSourceBuffers() in SoundEngine.o
SoundEngineEffect::ClearSourceBuffers() in SoundEngine.o
SoundEngineEffect::SetLooping(unsigned char)in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
SoundEngineEffect::SetPitch(float) in SoundEngine.o
SoundEngineEffect::SetPosition(float, float, float)in SoundEngine.o
SoundEngineEffect::SetLevel(float) in SoundEngine.o
OpenALObject::Initialize() in SoundEngine.o
OpenALObject::Initialize() in SoundEngine.o
OpenALObject::Initialize() in SoundEngine.o
OpenALObject::SetListenerPosition(float, float, float)in SoundEngine.o
"_alcOpenDevice", referenced from:
OpenALObject::Initialize() in SoundEngine.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (20 errors)

javacom said...

You have to highlight the TouchFighter2 in the Targets Section in XCode and then Press command-I to bring up the Target "TouchFighter2" Info

Then add the OpenAL.framework in the Linked Libraries Box at the bottom.

TC said...

I'd already made sure that OpenAL.framework was included. Oddly enough, even though the OpenAL.framework was included (and I even tried using the absolute path), it appears to have been picking up an out-of-date version from /Library/Frameworks during the build.

I renamed that one to OpenAL.framework.hidden and I was off to the races. Very odd. Must have been put there by something else.

Thanks for the link and the feedback.

Vince said...

I was able to get Touchfighter2 up and running with iPhone OS 2.2.1. After adding the OpenAL framework, thanks javacom;)

I was wondering if anyone was able to get the multiplayer to work...

Cuddlephish.com dev Team

Anonymous said...

Is there any way to get this software to install on an iPhone device. We can't really test it's accelerometer responses on the iPhone Simulator since we can't manage the simulator's orientation states, save absolute portrait and absolute landscape states, which does us almost no good.

Unknown said...

TC, i have been getting the same tons of linker errors when trying to build anything using OpenAL. I'm kind of confused as to your solution to fix the problem. what exactly did you do?

Thanks!

javacom said...

Just relink the OpenAL.framework to the Project build Target.

In XCode, there is a bug that if you add a framework to the project, it might only appear in the Project Directory on the left hand side window, but, actually, it is not linked when building the target.

To correct the error, you have to do these
(1) highlight the TouchFighter2 in the Targets Section
(2) Press command-I to bring up the Target "TouchFighter2" Info
(3) add the OpenAL.framework in the Linked Libraries Box at the bottom

This will ensure the target has the linked framework OpenAL.framework when linking.

Troy Tucker said...

Has anyone got Touch Fighter 2 to compile on 3.0 or 3.1? I don't even have OS 2.0 and when I attempt a build it for 3 or 3.1, it blows... with alot of FXMLTree issues. I looked all over the web for any information on this, but found zip.

Troy Tucker said...

Anyone get this to run on 3.1.2?

Mark said...

Are they any links to this that work as Apple have removed it from the link provided. Please email me at mark-hughes-91@hotmail.co.uk if you know of one that works.

Thanks

Mark

Anonymous said...

Can someone please send me the source code at hsshergill@yahoo.com since it is not available on website anymore.
Thank you in advance.