Two extra rounds, zero penalty circles


    Last week I was exploring the possibilities of the new Bluetooth 4.0. What for? Then, from now on, Apple installs it on their smartphones and tablets.
    If you are the owner of a bunch of iPhone 4S and iPad Mini, then you can repeat my experiments. I leave the rest with a short video demonstrating the application. Honestly, I riveted as many as 5 applications.
    The meaning of all five new applications is simple, like the metro style - I use the iPhone as a peripheral gamepad. Imagine a gamepad not only with buttons, but with a video camera and accelerometer!
    The iPad accordingly plays the role of the TV on which the game unfolds.

    Among other things, I posted one application in App Store, and Apple approved it right away, to my unspeakable amazement.
    I’ll also tell you about the results of weekly sales.



    What you need for development

    To write my own application, I downloaded the BTLE Central Peripheral Transfer example from the Apple home site.

    Threw away the apple ViewController and replaced it with the next piece of code
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        iPad = 0;
        shotView = [[ShootingViewController alloc] initWithNibName:@"ShootingViewController" bundle:nil viewController:self];
        [self.view addSubview:shotView.view];
    } else {
        iPad = 1;
        targetView = [[TargetViewController alloc] initWithNibName:@"TargetViewController" bundle:nil viewController:self];
        [self.view addSubview:targetView.view];
    }
    


    On the iPhone side, you can change the contents of the peripheralManager function to transfer to the iPad any data that is useful to you on the receiving side. These can be accelerations, video processing results, button clicks, other events.

    /** Catch when someone subscribes to our characteristic, then start sending them data
     */
    - (void)peripheralManager:(CBPeripheralManager *)peripheral central:(CBCentral *)central didSubscribeToCharacteristic:(CBCharacteristic *)characteristic
    {
        NSString *sendText = [NSString  stringWithFormat:@"%d,%d,%d,%@", _numShots, (int) xt, (int) yt, [[UIDevice currentDevice] name]];
        NSLog(@"Central subscribed to characteristic: %@", sendText);
        // Get the data
        self.dataToSend = [sendText dataUsingEncoding:NSUTF8StringEncoding];
        // Reset the index
        self.sendDataIndex = 0;
        // Start sending
        [self sendData];
    }
    


    I want to warn that the amount of data transferred at one time should not exceed 30-50 bytes. Otherwise, communication is often lost, and packets are also lost.

    In addition, if the program on the iPhone processes events from the accelerometer 100 times per second, then the data on the iPad should be transmitted no more than 10-15 times per second. Otherwise, the application may freeze, the communication channel is apparently clogged and the iPad does not have time to process it.

    Biathlon 2013 app





    The very first I made the biathlon app, a simulator of target shooting. Inspired by the victories of Malyshko and Shipulin at the World Cup, he made it in a day. The blanks, however, were already, such as examples of working with the sound of shooting. Two pictures still had to be borrowed from the network, scaled and wiped out watermarks.

    The iPhone is a rifle with optics, through the optics I aim at the iPad and fire a shot by tapping the iPhone screen.

    To recognize the geometry of the iPad, I draw a bright blue line on top of the shooting range. At first I chose the orange color, but it only worked in an office environment. There are yellow lamps around the house, and orange is everywhere. The recognition program is unfortunately bad, just subtract the pixel values ​​from top to bottom with the condition of the presence of a blue component. If you play in the white and blue Intel office, then recognition works poorly.

    But these are the problems of the arrow, for a hint, I draw a green target that indicates the borders of the iPad screen.

    Biathlon 2013 at App Store


    Usually I make all my applications free. But I insert an advertisement. It makes no sense to put ads in this application - there are few such people who have a bunch of the latest apple devices.

    On the other hand, if a person has new-fangled expensive pieces of iron, then he has money. Let him buy the application. For 5 bucks, so them bourgeois.

    I posted the 6th biathlon for 5 bucks and forgot about it. And on January 15th - a raz! - The application is approved and ready for sale.
    Making a sale - otherwise there’s no chance whatsoever they will notice.
    3 dollars. Also bold.

    Well, I think, as usual, 1-2 jumps in the first five days, then sluggish 50 jumps per year.

    But no, more leaps. Here's an example of today's report.
    Title               Units        Price          Store
    Biathlon 2013     11	  2.69 EUR	    DE   
    Biathlon 2013       2	   2.69 EUR	    FR
    Biathlon 2013       1        21 NOK           NO
    Biathlon 2013       1       99 RUB            RU
    Biathlon 2013       1       2.69 EUR          SI
    


    I want to note that links to videos posted in the app and application have no effect. As it was 50 views a week ago, it remained.

    And here from the publication on Habré 7000 views are usually gained. But there is no sense in them; you cannot spread bread.

    I think this is the first app to use this technology. If not, correct me.

    Other applications



    Three-dimensional tetris. It is based on the rotation of the iPhone as a solid - I transmit one number from 24 positions into which the figure is turned.

    Digger - classic dosovsky, management with iPhone. I transmit clicking on the k4 button.

    Wolfenstein. Just a shooter - transmit the angle of rotation and the event shot.

    Darts. Simulation of iPhone with a dart throwing movement. I transform the deviations of the accelerometer along the axes into the displacements of the X - player on the target.


    Most are ready for 50-90 percent and so far they have not impressed me.

    Yes, I forgot! Tennis! Tennis is awesome! Now I’ll take a screenshot.



    It's interesting to play tennis. On iPad, I transfer only the type of strike - left or right.

    Also popular now: