IOS games develop game functions other than those of ios games

Source: Internet
Author: User
Tags admob

IOS games develop game functions other than those of ios games

In addition to the functions of a game, how many things do we need to consider when developing a game?


A lot. It's also annoying!


However, it will be very easy next time.


Is there anything we want to add to the game?


(1) Sharing

(2) scoring function

(3) GameCenter)

(4) Advertisement (iAd and other advertisements such as Admob)

(5) In-APP purchase

(6 )...


These functions are not completely necessary and should be considered as needed. However, for example, sharing and scoring, these features can increase the spread speed of a game, and display is worth adding to each game.


The basic usage of each function is summarized below.

PS: This is just a summary post. The usage of each function is related to Tutorial on the Internet.


(1) Sharing

The simplest and most direct method is to use the sharing function provided by iOS to use UIActivityViewController:

NSString *initialString = @"Smash Bug! is a Great App! Have Fun with it!";    NSURL *url = [NSURL URLWithString:@"https://itunes.apple.com/us/app/air-drum-*/id901397384?ls=1&mt=8"];    //UIImage *showImage = [UIImage imageNamed:@"Default-568h@2x"];    UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[initialString,url] applicationActivities:nil];    [self presentViewController:activityViewController animated:YES completion:nil];

You can find the sharing code on the Internet to share the Code with your friends and QQ space.


(2) scoring

That is, you can directly jump to the App Store after clicking it. This is very simple and important:

NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=901397384";    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

You can change the id to your application id when using it.


(3) GameCenter

It may be used less in China, but I am afraid it is a very important method abroad.


This requires you to enable GameCenter on iTunesConnect and create the corresponding LeaderShip and Achievement.

The corresponding Tutorial is available on Raywenderlich.


There are actually two steps for use:

(1) Verify the local player. If the player does not log on, the pop-up window will pop up to log on.

- (void)authenticateLocalPlayer{    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];        localPlayer.authenticateHandler = ^(UIViewController *viewController,NSError *error) {        //3        [self setLastError:error];                if (viewController != nil) {            [self setAuthenticationViewController:viewController];        } else if ([GKLocalPlayer localPlayer].isAuthenticated) {            _enableGameCenter = YES;        } else {            _enableGameCenter = NO;        }    };}

- (void)setAuthenticationViewController:(UIViewController *)authenticationViewController{    if (authenticationViewController != nil) {        _authenticationViewController = authenticationViewController;        [[NSNotificationCenter defaultCenter] postNotificationName:PresentAuthenticationViewController object:self];    }}

(2) Send scores and other data to GameCenter in real time

2.1 send Achievement

How to Create Achievement achievements:


+ (GKAchievement *)reach10Achievement:(NSUInteger)numberOfReach{    CGFloat percent = numberOfReach/10 * 100.0;        GKAchievement *reachAchievement = [[GKAchievement alloc] initWithIdentifier:kSmashBugReach10AchievementId];    reachAchievement.percentComplete = percent;    reachAchievement.showsCompletionBanner = YES;    return reachAchievement;    }

Sending achievements


- (void)reportAchievements:(NSArray *)achievements{    if (!_enableGameCenter) {        NSLog(@"Local play is not authenticated");    }        [GKAchievement reportAchievements:achievements withCompletionHandler:^(NSError *error) {        [self setLastError:error];    }];}

2.2 send score wait until LeaderShip (ranking)


-(Void) reportScore :( int64_t) score forLeaderboardID :( NSString *) leaderboardID {if (! _ EnableGameCenter) {NSLog (@ "Local Play is not authenticated");} GKScore * scoreRep
In addition, we also want to click the GameCenter button to display the GameCenter interface:

Orter = [[GKScore alloc] initWithLeaderboardIdentifier: leaderboardID]; scoreReporter. value = score; scoreReporter. context = 0; NSArray * scores = @ [scoreReporter]; [GKScore reportScores: scores withCompletionHandler: ^ (NSError * error) {[self setLastError: error];}

In addition, we also want to click the GameCenter button to display the GameCenter interface:

- (void)showGKGameCenterViewController:(UIViewController *)viewController{    if (!_enableGameCenter) {        NSLog(@"Local Play is not authenticated");    }        GKGameCenterViewController *gameCenterViewController = [[GKGameCenterViewController alloc] init];        gameCenterViewController.gameCenterDelegate = self;        gameCenterViewController.viewState = GKGameCenterViewControllerStateAchievements;        [viewController presentViewController:gameCenterViewController animated:YES completion:nil];}

(4) Advertisement

The most basic Banner Advertisement of iAd is too simple now, iOS7:

Add a code in the ViewController to display the advertisement:


    self.canDisplayBannerAds = YES;

Admob (I only use Google ads) is also very simple. After registering with Admob, download its SDK and add the SDK to the project.

Important: Add-ObjC to Linker Flag

Then it's easy. Just copy the following code to ViewController:


// Admob    [self addAdmob];#pragma mark - Admob- (void)addAdmob{    // Initialize the banner at the bottom of the screen.    CGPoint origin = CGPointMake(0.0,                                 self.view.frame.size.height -                                 CGSizeFromGADAdSize(kGADAdSizeBanner).height);        // Use predefined GADAdSize constants to define the GADBannerView.    self.adBanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin];        // Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID before compiling.    self.adBanner.adUnitID = ADMOB_ID;    self.adBanner.delegate = self;    self.adBanner.rootViewController = self;    [self.view addSubview:self.adBanner];    [self.adBanner loadRequest:[self request]];}#pragma mark GADRequest generation- (GADRequest *)request {    GADRequest *request = [GADRequest request];        // Make the request for a test ad. Put in an identifier for the simulator as well as any devices    // you want to receive test ads.    request.testDevices = @[                            // TODO: Add your device/simulator test identifiers here. Your device identifier is printed to                            // the console when the app is launched.                            GAD_SIMULATOR_ID                            ];    return request;}#pragma mark GADBannerViewDelegate implementation// We've received an ad successfully.- (void)adViewDidReceiveAd:(GADBannerView *)adView {    NSLog(@"Received ad successfully");}- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error {    NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);}

Everything is OK! Make changes based on the actual situation of the game!


(5) In-APP purchase

I will talk about this in another blog. I will not talk about it here.


OK. That's all.

Introduction to various ios game development engines

The unity3d billing method is a key difference. Generally, COCOS is used.

I would like to ask programmers who are engaged in Game Development how they can enter the game development company and need to master the appropriate knowledge.

The basic knowledge is solid, and then the development direction is determined. For example, for Android, IOS, or PC platform development, the development environment and development language are understood accordingly, then, make some targeted contacts or works. If you are not sure, you must have development experience in C/C ++, Java, and other basic aspects. In addition, you must have your own understanding of development.
Of course, it is important to have continuous enthusiasm and not be afraid of failures or difficulties.

To be honest, I am not very optimistic about AS3 development. It doesn't mean that you can't make money, but web games in China are being abused. My opinion is not a proper path. In addition, flash game development has limitations. But now we can see that pc games are only web games that are overwhelming. Real pc games, such as those developed using directX, have never heard of any games.
In addition, there are some good games developed for ios and android in China.
Based on your current situation, if you do not want to play flash games, it is most important to learn more and lay a good foundation. As for works, if there is no good idea, don't waste time. In fact, in most cases, as a developer, it is only a task of writing code, and few of them can write their own work. After graduation, you may find a number of game companies in advance to learn from each other.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.