0

I've been working for a month and a bit on a game, using cocos2d-x on the marmalade platform. Finding information about on the internet has been a frustrating experience due to its rarity, but that issue is amplified tenfold when cocos2d-x is thrown in the mix -- few people seem to use the combination, or at least ask and answer questions about it. But I digress. Currently I'm working on getting the Android side working before dealing with iOS.

I want to get ads into my game. I have found sdks for marmalade and for cocos2dx, but not both at the same time. This raises issues.

IwGameAds: iw2D and iwgl don't play nicely because they change both change gl states. Cocos2d-x uses gl. The solution to that problem is to wrap iw2D with save and restore, as mentioned here, but iwgameads requires this to be placed in the main loop:

// Update the ads view
IW_GAME_ADS_VIEW->Update(1.0f);
// draw the ads view
IW_GAME_ADS_VIEW->Draw();

The problem here being that the cocos2d-x main loop implementation is hidden to me. I could hook in the update easily enough, but the draw is more difficult -- where do I put it? Do I override my game layer's draw(), call super and do the gl state saving stuff before calling iwgamead's draw?

RevMob: neither revmob sdk (marmalade or cocos2d-x) allows for banner positioning (the default banner stretches to take up 1/4 of a landscape screen) or callbacks. I managed to get banners and fullscreens showing using their marmalade sdk easily, but the game continues to run behind the full-screen interstitial whenever it deigns to appear after being called... which often results in cocos2d-x crashing.

Their cocos2d-x sdk is much harder to integrate with marmalade and I've been unable to progress past "jni.h not found" errors. I presume that if I got that working the crash/running in background would resolve itself, but I'd be left with the more-than-problematic design flaws.

InMobi: marmalade's s3eInMobiAds subproject is nice and all, but won't allow me to test anything without a published app. This one is more promising than RevMob because banner positioning and event callbacks appear to be possible, but due to marmalade and cocos2d-x's gl conflicts, this might turn out to be just as bad a solution as iwgameads. I've emailed them about the possibility of being able to test+integrate during my app's development.

s3eFlurryAppSpot: The test project supplied with marmalade works (there's a bug where the first ad doesn't display), but I guess it doesn't play nicely with cocos2d-x as nothing displays despite the logs saying otherwise. Full-screen ads work, but appear to be portrait only. As with revmob, these don't pause the game, but there are at least callbacks to fully control the flow of things.

AdMob and others: other ad providers I've found for cocos2d-x tap into the underlying java. It increasingly seems to me that this might be the direction I need to go in to implement ads. However I can find scant resources on how to do this sort of thing or even if it's possible under marmalade.

Has anybody had success with ads using marmalade+cocos2d-x and could point me in the right direction?

Tom
  • 6,946
  • 2
  • 47
  • 63

1 Answers1

0

Sohan from the InMobi team here.

I really can't speak for the other ad networks, but you asked if you could "...test+integrate during my app's development."

To parapshrase President Obama, Yes you can!

The diagnostics mode can be used to test the InMobi integration before the App release. You will need to enter a device ID to see the test ads. Check this link

Sohan
  • 1,287
  • 1
  • 15
  • 29
  • Thanks Sohan. I'd already set this up, and tried again to make sure the problem was still there: D/[InMobi]-[Network]-4.0.4(10035): Invalid App Id.Please check the app Id in the adrequest is valid and in active state – Tom Apr 24 '14 at 05:24
  • I can only assume it fails because my property is at the "Verification" pending stage. It requires a URL to prove I am the owner of the property. But since I haven't released it yet, I have no URL. I'm not going to release until I have working ads. It's a bit of a chicken and egg problem :P – Tom Apr 24 '14 at 05:25
  • Tom, to see a test ad you don't need the app to be verified. You can see a test banner ad. I've tried this myself. Maybe some other error with the setting of the test mode? – Sohan Apr 25 '14 at 12:20