Gamehouse and QuickLua

The nice people at MadeWithMarmalade are running a promotion with gamehouse where if you integrate their game network promotion api you win money and a Marmalade license extension. There are some stiff requirements (at least for me and my apps) to get the incentives, but I decided to integrate a couple of my apps just to see what it was like (and because I am on vacation with nothing to code). What I found out is that unlike most tap or impression exchanges, gamehouse will show your app thousands a time a day for free (at least during their beta period).

Two of the apps I integrated gamehouse with are written in C++ (what all the instructions are written for), but one of my app I used Marmalade’s Lua api. What follows is how I got the gamehouse extension working with my Lua project.

1. Download the gamehouse Marmalade extension from here:  http://gpn.gamehouse.com/sdk

2. Once the sdk is unzipped copy the gamehouse folder to the extension folder inside your marmalade folder. In my case that is: C:\Marmalade\7.1\extensions.

3. Modify your project .mkb to include the gamehouse extension in the sub-project section. Your subproject section should look like this (unless you have added other projects):

options
{
s3e-data-dir = resources
app-icf = ‘resources/common.icf,resources/app.icf’
}

subproject
{
gamehouse/gpn
}

4. Download the files located here: https://devnet.madewithmarmalade.com/questions/18739/gamehouse-and-quick-integration.html.

Place the header file in the header folder. On my machine it is located here: C:\Marmalade\7.1\quick\include.

And the source file here: C:\Marmalade\7.1\quick\source

5. Modify quickuser.mkf located here: C:\Marmalade\7.1\quick

By adding  the two files you just added. It should look something like this after your changes.

includepath .

files
{
quickuser_tolua.cpp
quickuser_tolua.pkg
quickuser.h

#Gamehouse c++ files.
include/CGGameHouse.h
source/CGGameHouse.cpp
}

6. Modify quickuser_tolua.pkg also located here: C:\Marmalade\7.1\quick by adding the reference to the header file. Your file should look something like this:

//——————————————————————————
// Mark-up in header files
//——————————————————————————
$cfile “quickuser.h”
$cfile “include/CGGameHouse.h”

7. Run the quickuser_tolua.bat file. According to the documentation it should be located here: C:\Marmalade\7.1\quick. Unfortunately I have not seen it in a few releases. If you don’t have it either copy it from the same folder but the 6.4 install (the last version that had it for me).

8. At this point you can either open the quick_prebuilt.mkb or any of your Quick project in Visual Studio and compile it using the x86 Debug target.

9. From within your Lua project now you should be able to initialize gamehouse by calling:

gameHouse.initGameHouse(“yourGameHouseAppKey”)

and request the display of the ad by calling:

gameHouse.presentAd()

10. Remember to add the required items for the particular platform you are deploying it to. For example for Android you need to add the required activity to the android manifest file. Instructions can be found in the gamehouse integration document found in this thread: https://devnet.madewithmarmalade.com/questions/18456/how-can-i-integrate-the-gamehouse-extension.html

That is all, if you run into problems let me know and I’ll try to help. I am back to bill paying work after the new year.

Advertisements

InMobi and ad size support for IwGameAds.

If anybody has bothered (highly unlikely) to download and install any of my games in Blackberry Appworld they would have noticed that at times you will get an ad that takes over the entire screen of the game. This happens even if you are in the middle of playing the game. Unfortunately until this point IwGameAds did not have a mechanism to be able to request an ad size. With some providers like mmedia this is not a problem because you define the size with you define the slot.

Again I have made changes to IwGame to support ad sizes. These are the first batch of ad sizes supported: 168×28, 216×36, 300×50, 300×250, 728×90, 320×480, and 320×50. Up to this point I have only tested and modified (where needed) 2 providers: mmedia and Inneractive. With these code changes I have also added InMobi (was not supported in the original version of IwGameAds). I couldn’t find a way to specify ad size in mmedia, and it isn’t necessary since you can specify it on their portal. All these words is just to say that the ad size functionality is now supported for InMobi and Inneractive. As I test and update the other providers, I will make sure to add the ad size option. You can keep track of what providers I have tested by looking at the read me on gitHub. This change meets my current needs, but I realize that it would be more useful if you can specify the ad size per slot. I plan to make that change as soon as time permits.

Example 1: The ad size of 300×50.

IW_GAME_ADS_VIEW->Init(“yourAppId”);

IW_GAME_ADS_VIEW->setAdProvider(CIwGameAds::InMobi);

IW_GAME_ADS_VIEW->setSlotSize(CIwGameAds::s300x50);

IW_GAME_ADS_VIEW->setNewAdInterval(15);

IW_GAME_ADS_VIEW->setNumAdsVisible(2);

Multiple AppId support for IwGameAds.

I have used IwGameAds for a while (I didn’t write the original code). One of the great things of using it with Marmalade  is that you can write your code once and ads appear everywhere you deploy it.

I use 2 ad providers, and I usually set up the platform as Android since IwGameAds only supported 1 appId per provider. This meant that whatever device is presenting the ads, it would always shows up as Android on the ad console. It also meant that such as ads for Android games would show up on Blackberry devices.

I made some small changes to the code to accommodate multiple appids per provider. You can get the version with my changes in my repo.

To add the extra appIds you can do it when creating the mediator:

Example 1:

// Create Inner-active ad party and add to the mediator

CIwGameAdsParty* party = new CIwGameAdsParty();

party->ApplicationID = “Default when it doesn’t match any of the others.”;

party->IOSAppID = “iOS AppId”;

party->BBAppID = “ONX based blackbery devices App Id.”;

party->AndroidAppID = “Android App Id.”;

party->WP8AppID = “Windows Phone 8 App Id.”;

party->Provider = CIwGameAds::InnerActive;

ad_mediator->addAdParty(party);

Example 2: Not all the appIds have to be provided it would just use the default when the others can’t be found:

CIwGameAdsParty* party = new CIwGameAdsParty();

party->ApplicationID = “Default when it doesn’t match any of the others.”;

party->IOSAppID = “iOS AppId”;

party->WP8AppID = “Windows Phone 8 App Id.”;

party->Provider = CIwGameAds::InnerActive;

ad_mediator->addAdParty(party);

Example 3: You can also use it without a mediator:

IW_GAME_ADS_VIEW->Init(“defaultAppId_Android”);

IW_GAME_ADS_VIEW->setAdProvider(CIwGameAds::InnerActive);

IW_GAME_ADS_VIEW->setIOSAppID(“appAppId_IOS”);