grannysmith-technical/content/AdServer.md

2.1 KiB

title page_status see_also
AdServer
[Ad Server @ Smash Hit Lab](https://antifandom.com/smashhitlab/wiki/Ad_Server) (Used as an source for most of the content)

The Ad Server provides data used by the game to serve advertisements, in form of an UI xml file (ads.xml), an icon (ads-icon.png) and the full banner (ads-front.png).

Details

Retrieving

To check for ads, the game sends an HTTP GET request for:

http://grannysmithgame.com/ads/ads.php?product={product}&platform={platform}&version={version}&rev={rev}
  • product: most likely used to indicate if the game is a full version or the free one
  • platform: platform that the game is on, for example android
  • version: game version
  • rev: most likely an advertisement revision

The server responds with an zero length document if no advertisements are available. If there are any ads to show, then the server will respond with an xml document:

<ads revision="{revision}" showfront="{showfront}" onlyfree="{onlyfree}" sale="{sale}" folder="{folder}"/>
  • revision: current advert revision. If zero, then none are available and no other field needs to be filled
  • showfront: unknown
  • onlyfree: most likely used to show ads only to the users of Granny Smith Free
  • sale: unknown
  • folder: a subfolder where advertisement files are stored.

Display

The advertisements use UI xml files and are shown when clicking the icon in the top-left corner of the screen.

Examples

Example response for an ad listing might look like this:

<ads revision="1" showfront="1" onlyfree="0" sale="0" folder="data"/>

For the following files:

http://grannysmithgame.com/ads/data/ads.xml
http://grannysmithgame.com/ads/data/ads-front.png
http://grannysmithgame.com/ads/data/ads-icon.png

Example ads.xml file:

<ui texture="user://ads-front.png" selected="user://ads-front.png">
    <outside cmd="script:hideads"/>
    <!-- Note: you should change the width and height to banner image's dimensions -->
    <rect coords="0 0 500 281" cmd="game.url https://grannysmithgame.com"/>
</ui>