Game Development Community

dev|Pro Game Development Curriculum

Adding ChartBoost Ad Network to your iTorque 2D Game

by Michael Cozzolino · 01/06/2013 (11:32 am) · 3 comments

ChartBoost Ad Network Integration for iTorque 2D.

This is an area that iTorque 2D has lacked. Monetizing through ads. There are a couple of resources with iAds but they have their problems. Plus as far as I understand iAds isn't making anyone rich. Scott Wilson-Billing pointed me to ChartBoost and I found it dead easy to add and wanted to share. He is having success with it.

My Apps
itunes.apple.com/us/artist/michael-cozzolino/id367780489


Ok here is what you need to do.

*Disclaimer
I used iTorque 2D 1.5 This is not the Open Soource Version or the final release of the paid version of iTorque 2D

Download the ChartBoost API

help.chartboost.com/downloads/ios

* I used version 3.0.7 Since I am not supporting iOS 6 at this point. If you are supporting iOS 6 you need to download the latest API of ChartBoost. You also need to make the changes in iTorque 2D that works with iOS 6. I have yet to do this so you are on your own on that task. Itegration of ChartBoost "should" be the same otherwise though.

Watch the ChartBoost integration video here



Go to TGBAppDelegate.mm

Your -(void)applicationDidBecomeActive() Function should look like this:
YOU NEED TO GET THE VALUES FOR YOUR APP SIGNATURE AND APP ID FROM CHARTBOOST ADD PLUG THEM IN. *** SEE VIDEO

- (void)applicationDidBecomeActive:(UIApplication *)application {

if(!_iPhoneTorqueFatalError)

{

_iPhoneGameBecomeActive();

        

        Chartboost *cb = [Chartboost sharedChartboost];

        //App Integration of ChartBoost

        cb.appId = @"APP_ID"; // Video shows you how to get this Value
	
	    cb.appSignature = @"APP_SIGNATURE"; // Video shows you how to get this Value
        

        // Begin a user session

        [cb startSession];

        

        // Show an interstitial

        [cb showInterstitial];

 

        

#if defined(_USE_SOCIAL_NETWORKING)

        socialNetworkingManager->socialNetworkingBecameActive();

#endif //_USE_SOCIAL_NETWORKING

}

else 

{

//Luma : Tell us why, and then quit

//Note, engine has shutdown internally already!

//Another note, Alerts get hidden/broken by default.png not being "finished" yet, causing a "freeze" in the alert run loop

exit(0);

}



}


Add This function and the Console Function so you Can Call the function in TorqueScript

in TGBAppDelegate.mm before the @end


void showChartBoostView()

{



Chartboost *cb = [Chartboost sharedChartboost];

//App Integration of ChartBoost

 cb.appId = @"APP_ID"; // Video shows you how to get this Value

 cb.appSignature = @"APP_SIGNATURE"; // Video shows you how to get this Value



// Begin a user session

[cb startSession];



// Show an interstitial

[cb showInterstitial];

    

}



// This is the callin from TorqueScript

ConsoleFunction(callChartBoostView, void, 1, 1, "callChartBoostView()")

{

    showChartBoostView(); // Call this Function in your Torque Script whenever you want to display an Ad ie. Displaying High Scores.

}

In your games TorqueScript Logic Call the Console function to display a ChartBoost Ad when you would like. ie. Scores "Level".

showChartBoostView(); // Call this Function in your Torque Script whenever you want to display an Ad ie. Displaying High Scores.

About the author

Indie Developer in the Albany NY area. iOS, PC, Mac OSX development. http://itunes.apple.com/us/artist/michael-cozzolino/id367780489


#1
01/07/2013 (8:37 pm)
I'll give this a try, thank You my fellow NY'er.
#2
01/08/2013 (5:46 am)
Moving this over to the Resources section.
#3
01/08/2013 (11:36 am)
Thanks @ Chip. I thought I put this as a resource but ended up as Blog before.