Category: General

  • Swift 3 – Using .map to walk through and create an array of items with offset

    Sometimes I want to create a quick way to add a number of items with a name; such as creating 10 decks with an offset number.

    Usually this can be done like this;

    // usual way;
    var decks : [Deck] = [Deck]()
    for idx in 1...10 {
    decks.append( Deck.init(name: "#\(idx)") )
    }

    But I find this functional way a bit better

    // functional way
    let decks = (1...10).enumerated().map({ (offset, element) in
    return (Deck.init(name: "Deck.\(offset)"))
    })

    Although my usual way is memorable, I like the functional one as its a bit cleaner and uses less code.

  • Scarface PS2 – Retrospective review

    Recently I’ve been re-playing the 2006 Playstation 2 game Scarface, to 100% completion. It took me approximately less than 2 days to do.

    I had a blast, but there are things wrong with the game that I hadn’t noticed when I first played the game.

    It may seem odd to replay a game that is 10 years old (as of 2016) and even then get the criticism that “why don’t you just play GTA, its a better game“; yes it is, but purely for an arcade-style action fun; I don’t think you can beat Scarface on PS2, even with its low resolution graphics.

    Whilst the opinion that its yet another GTA clone is often quoted, I feel it does offer a little more fun, a more arcade-style approach that the later titles of the GTA line of games didn’t seem to offer.

    It didn’t have as nearly as many side quests as the pinnacle of open world games, GTA San Andreas; and it didn’t have the same allure as GTA Vice City; which is heavily inspired from the 1980s Scarface movie.

    But at the same time, this game has its charm; and mostly fun.

    So, what exactly is wrong with the game?

    Issue: It loses the message of the movie

    The message of the movie is that there’s no going back from the life of crime.

    The idea of the movie is that Tony gets his comeuppance; that he dies alone in a self-destructive spiral of cocaine addiction, paranoia and desire for wealth beyond anything else, even at the loss of those he trusted.

    It was supposed also be some sort of ironic message that the only time Montana did something based on actual morals, it was the thing that actually killed him

    The message is kind of destroyed when you put a spin that Tony got away just to do every single shitty decision again.

    Beyond “losing the message of the movie”, there are other smaller issues I found with the game.

    Issue: The end boss (Sosa) is way too easy to kill

    It would have been fun to have Sosa at least a bit harder to kill; perhaps put him in a tank or he keeps running away with relentless hordes coming for you whilst he’s trying to escape in a helicopter?

    Issue: Set pieces are never used thoroughly

    There is only one mission, except the side-mission Felix leads, where Tony has to deliver goods by a Van. I would have liked it if he had to do more deliveries to get his initial reputation up without buying hard assets.

    I only remember one or two missions with helicopters being your main boss or sub-boss.  There should have been more of them.

    There is a ship cargo tanker on the Miami map in the Industrial zone, but you never go there to collect any formal cargo.  I would have preferred it if there is deliveries of product via the ship cargo at set intervals; that way a player doesn’t have to go to the Islands all the time.

    Issue: The game relies too heavily on pick up and deliver

    There is a lot of missions, side-quests where you are simply picking up something to deliver it elsewhere.  I think 90% of the game is pick up and deliver; the worst ones are the distribution missions.  Sure its fun to rack up the many millions of dollars you get for delivering product to your fronts; but doing it like 10-20 times gets relentlessly repetitive and boring.

    To speed things up a bit you could just focus relentlessly on getting all 4 storehouses and then focus on getting the “Harvest plantation” as fast as possible; this means you reduce the shipping part, but you still have to deliver it.

    Improvement: Have distributors or trucks on call that deliver your product; but it comes at a risk that you’ll lose the product to police/gangs and it comes with a percentage cut of delivery revenue.

    Issue: Hitting 100%; but nothing to do

    Hitting 100% in Scarface is pretty easy. Once you’ve beaten the story, bought every Exotic, eliminated every rival gang, there is nothing to do.

    Other than doing yet more distribution deals, the only thing I can think of is to go to the Islands with your personal female bodyguards (whom you unlock once you get 100%) and just start wars with the many spawning enemies of the islands.

    So what could they have done?

    1. Tony loses the fronts – to the Columbians; Make it a two-part story (200%)., and the second part is the Columbians take over Miami who are twice as strong, their armies twice as strong; make it a real challenge.  The last mission could be revisiting the Plantation, or Islands to take out the Columbians one final time.
    2. The Sandman twist – When I originally played the game, I thought that the Sandman character was going to turn on you; he never did.  It would have been better if he did and then this would reinforced the hate relationship between Sosa and Sandman.  Sandman’s motive: He wants Sosa out the way to control 100% of everything and Tony was just the triggerman.  So first-part, Tony kills Sosa; second-part its Tony vs Sandman/Columbians who are twice as hard to kill.
    3. The islands become un-lockable to control.  Missions on the islands become unlocked so now you try to take over the islands with their turf, with the final mission being in Boliva or some other island (not on the maps).
    4. Unlock Survivor mode or Relentless mode – Where you just have to live as long as possible
    5. Unlock other (abstracted) cities. A way to make distribution less boring would be if you could decide to attempt to send product to them.
    6. Other side-missions that are not simply pick-up and deliver

    Despite all this, the game is actually a lot of fun, despite it being quite short and nothing to do when you hit 100%, I did forget how fun the game was; I enjoyed it for what it was.

    Its just a shame there isn’t much to it.

  • What cables do you need to develop for Apple TV 4th generation?

    Having recently bought an Apple TV 4th generation for development purposes, I thought it might be useful for other developers who wish to dabble with the system to know what cables are needed to deploy your apps from XCode to the actual device.

    Notably the Apple TV (4th Gen) doesn’t actually come with the cable needed to connect from your machine to the device; it does come with a cable, but this is only for charging the remote.

    Instead, you will need a USB male to male cable (I think it was USB 3.0, but don’t quote me on that); in addition you will need a “USB-C to USB-A convertor” cable. You can purchase this from Apple.

    As with all other XCode projects; in order to deploy you will need to get a deployment provisioning profile via the Apple development website.

    My first thought was that it wasn’t going to work; Apple is quite harsh on deploying apps onto devices that are not Apple-branded cables; but was pleasantly surprised to see it working.

    So in short; you will need:

    • 1x USB to USB (male to male) cable
    • 1x USB-C to USB-A converter cable

    I hope this helps.

  • NSPredicates – SUBQuery on a parent-child relationship

    I am currently working on a game where there is a parent-child relationship in a quite small array where;

    A `Group` (parent)
    has many `Child` objects
    where 1 `Child` object can be owned by only 1 `Player`
    and a `Player` can only ever own 1 `Child` per group

    In the game, a `Child` object is called `Locomotive` (the game is about selling Locomotives) and a given `Player` can own a single locomotive in a given group.

    I needed a way to grab all the child objects in a given array that met a series of conditions; in short, I’m after a list of child objects that I can `legally` purchase.

    By `legally` I mean from the following rules (in no particular order)

    • I want to remove all children where I do not own anything
    • I want to remove all children which I already own a locomotive
    • I want to remove all children where I don’t have enough money to buy it
    • I want to remove all children by inspecting the group to only show those children where the sum total of orders > 0
    • I want to remove all children where something has been bought already

    Phew, quite a lot of conditions. At first I was not sure how to solve so many conditions.

    My first solution was to use a NSPredicate… with a block statement and simply loop through everything.


    NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
    EngYard_LocomotiveGroup *group = evaluatedObject;
    for (EngYard_Locomotive *child in group.locomotives) {
    if ( ([child.purchased boolValue] == NO) && (child.owner != player) && (group.purchasePrice < player.cash) && (group.initialOrders>0 || [group.totalOrders integerValue]>0 || group.unlocked==YES) )
    {
    return YES;
    break;
    }
    return NO;
    break;
    }
    return NO;
    }];

    This seemed quite a lot of code. Surely there is an easier way to do this?

    SUBQUERY to the rescue!

    Having played around with the SUBQUERY for a while, I finally got a single-line solution;


    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SUBQUERY(locomotives, $rv, $rv.purchased = %@).@count > 0 AND (purchasePrice < %d) AND (initialOrders>0 OR orders.@sum.integerValue>0 OR unlocked==YES)", @NO, player.cash];

    I double checked both instances in my logger; and they both return my expected results.

    Now on to more complex matters — how to make the AI make a decision to buy.

  • Back soon

    I have not written in a while. But will be back soon. Moving hosts is one of my priorities.

  • Startup Britain – Pitching to Chillingo

    logo

    On Monday 14 October I was in London as finalist to pitch a game to the Chillingo team as part of the week long Tech4Startup Britain event being held in Canary Wharf.

    The Chillingo Team were:

    • Matt Dixon, Sales & Business Development Director, Chillingo
    • Andy Needham, Head of Production, Chillingo
    • Daniel Tausney Public Relations, Chillingo.

    IMG_0267

    As a finalist, I was pitching my cocos2d game, “Bootleggers of America” to Chillingo; perhaps the UK’s biggest iOS games publihser; it was an incredibly once-in-a-lifetime occasion to be pitching to a fantastic games publisher amongst such a fantastic and diverse crowd.

    IMG_0262

    About the game

    The game I was pitching was “Bootleggers of America“, a Prohibition-era pick-up and deliver economic game that is similar to the old space trading games of the 80s, or if Drug Wars of the early 1990s, except the twist in my game is that you are responsible for producing your own goods, picking your own goons and making much deeper decisions beyond buying low and selling high.

    The game takes ideas from the PC-game, “Gangsters:Organized Crime”, and other mafia trading games to create a fictional world where you play as a Mafia don of your own crime family with the idea to make as much money from Speakeasies and Illegal bootlegging operations during the Prohibition-era.

    Although the consensus from the mobile app experts was that mobile players want to “dip in and dip out”, and that long-haul strategy games do not work well on mobile; I have seen a few games that have proven that they will work for a specific niche of players.

    My game plays is aimed to this niche and is a premium, solitaire, long-haul strategy game designed to play on the train, I felt that with games like “Transport Tycoon” recently being released on iPad that the idea that premium long-haul strategy games for iPhone, iPad can work.

    With this in mind, I felt that Chillingo could help get it published and help prove that the market isn’t about 15-second games.

    My pitch to Chillingo

    My pitch was about getting their help to turn the game from what it is now, and turn it into an isometric city with Game Center integration and allow you to play against other players; of course this would require servers, and a large scale technology support that only Chillingo or other games publishers could provide.

    This would mean, helping out with new art work and giving help on the technical level to provide the game servers similar to the other games they currently publish.

    Post-Pitch advise

    Rightly, Chillingo felt the game didn’t seem innovative or brough anything “new” to the table; plus they could not help with the technical challenge of delivering content via servers, websites, etc; and advised me to look at the game again and try to deliver such a product myself.

    The future for Bootleggers

    Right now, I feel the game needs to be refreshed with an Isometic city, and integration with Game Center and the ability to play against other players.

    In order to do this, I’m going to need raise funds from something like Kickstarter or IndieGoGo.

    When this will happen, I’m not sure; there are a few things in flux — but releasing a premium game that caters to the fans of long-haul strategy games, the mafia theme and “Gangsters:Organized Crime” into a strategy game that people will enjoy.

    Other pictures I took;

    IMG_0264

  • 10 reasons your business needs to go mobile, today

    There can be little doubt that mobile is crushing it for small businesses’ in local search. Increasingly, customers are using mobile smartphones to browse, surf, search and buy products and find services.

    And yet, many business still aren’t using mobile marketing effectively for their business; or understand the reasons why.

    So let’s go through 10 of the most popular reasons why your businesses needs to consider going mobile.

    1. The growth of mobile-internet searches is increasing, and un-deniable

    Searches via smart phones and tablets for local businesses like yours is one of the fastest-growing mobile activities.

    Mobile Internet searches have grown by 500% over the past two years and companies like Google, Yahoo! and Mozilla and taking this trend very seriously and are leading the charge as they’ve seen the growth of searches mean that they must offer services to these smart, savvy customers.

    The problem for your business is that if your website was designed for the “Internet” then mobile users are being cut out, they cannot find the information they want, they find the websites take too long to load; and most likely they’ll stop using your website and go to your competitor.

    That’s money on the table!

    The solution is simple, a mobile website that caters to these leads and grow the number of potential customers you have.

    2. 50% of all mobile searches are local

    When people look for services or businesses, they invariably search for local businesses, products and services; this number increases if they are on a mobile device.

    Indeed, local mobile searches are projected to exceed desktop searches for the first time in 2015 more and currently more than 1/3 of all Internet searches performed on mobile devices are for “local” products and services. In a nutshell, this means that these consumers are searching for YOUR businesses.

    local-search-graph

    The above graph shows the increased usage of mobile devices like smartphones are used in local searches in the US, and the numbers are the UK are not only following this trajectory, they are growing.

    3. 61% of users call a business after finding them on their smart phone

    Customers who use a mobile smartphone to searching for a local business are hungry, and ready to take immediate action; they are hot, ready-to-spend customers. Just many customers are you losing because your website is not mobile friendly?

    4. 59% of users visit a business after finding them on their smartphone

    In the world of the Internet, conversions matter; and its been proven through research by Google, and others that consumers that search for a local business via mobile are more likely to visit a business having found them on a smartphone.

    This is real, serious money.

    5. 71% Smartphone users that see adverts for a local business will do a mobile search

    When consumers see TV, printed or other adverts; the numbers show a high percentage of people will search for the business via their smartphone.

    6. 45% of mobile users are between 18 and 29 and use mobile search daily

    The numbers of young, hip urbanites using mobile smartphones to search for your business is increasing, that means you need to cater to them or risk losing them to the competition.

    7. 53% of shoppers compare in-store prices to online prices while shopping.

    It’s true. Even Google admits this. A high percentage of shoppers shop around both in physical shops and virtual e-commerce shops on their smartphone devices for the best price and the best deal.

    They want to make snap buying decisions and find the information they want quickly and easily. If they can’t, it’s likely they’ll not use your services.


    The numbers don’t lie. Mobile is here and your business needs to go mobile. Today.

    Sources:

    Sources:
    * Google – Understanding Mobile Marketing
    * Emarketeer
    * Mobithinking
    * MobileMarketing MAgazine

  • Mobile marketing for small business; An overview

    Most businesses these days already have a website, they already have a social media presence and already know that to win more business you need to have a website that ranks highly on search engines.

    But did you know that mobile, mobile apps and smartphones are fast becoming the go-to way to surf for local businesses.

    Indeed, smartphones have already become ubiquitous and is predicted that by 2015, “65% of all Internet access will be from mobile devices by 2015” (Mary Meeker, Morgan Stanley).

    However, most small businesses still do not have a website that will work effectively on a mobile device or have a firm understanding of mobile marketing.

    What is mobile marketing?

    Mobile marketing is a set of practices that enables small businesses to communicate with their customers through a mobile device or network. Typically, this can involve:

    • SMS (Text messaging)
    • MMS (Mobile messaging)
    • In-game mobile advertising
    • Mobile web advertising
    • Location or Geo based services, or geo-advertising
    • App store
    • Mobile Search Engine marketing and optimisation

    Why bother?

    The key differences offered by mobile’s are smaller screens, less real estate to showcase your business and a user that has less tolerance for slow loading websites or a lack of immediacy of information.

    The options for mobile are;

    • Make a mobile template for your existing website
    • Make your existing website “responsive”
    • Make a standalone mobile website
    • Make a mobile app, or a hybrid mobile app

    Typically most small business websites can either go responsive or have a mobile ready that is standalone.

    Case study: Pizza shop

    A pizza shop has a website, it does not work on mobile; so produces a mobile ready website that is standalone. Would the shop opt for a standalone mobile ready website, or a responsive website?

    In this scenario, my solution would be a standalone mobile ready website because it can give;

    • ‘Call to action’ – The shop only needs to provide calls to action, such as telephone number, a map, opening times; and other contact information
    • ‘Fast turnaround’ – A simple mobile ready website can be produced very quickly
    • ‘Limited info’ – Things like menus, prices, opening times

    A responsive site can be useful, but in the above case study a simple one-page mobile ready website that has plenty of “calls to action” would suffice.

    Apps and Mobile Websites – Whats the difference?

    The main difference is that mobile websites are simply mobile versions of your business; whereas Apps are usually sold in app stores such as Google Marketplace, the Apple App Store, etc.

    Other more subtle differences are things like the ability to work online and offline, the reduced barrier to use a mobile website (whereas an app has an app store barrier) and the need to deliver content, user experience or a product or service.

    It is clear that mobile marketing for small business can garner results and is an effective marketing strategy for any new, or existing small business.

  • New theme launched and a new direction

    A new theme has been launched for this website. We’re looking on-wards and upwards.

    For the past few months I have been working on a few iPhone (iOS) apps and am looking forward to working on some more going forward.

    In addition, the importance of mobile marketing and mobile ready websites is something that is increasingly becoming prevalent and important not just for small businesses but for startups and even well established ones.

    This mark a new direction for this website.

  • First impressions of the OUYA

    Ouya games console with game controller
    Ouya games console with game controller

    Recently I bought the OUYA games console and game controller; an Android-based games console that costs £99 (extra controllers cost around £30-40). The OUYA comes with HDMI cable, power cable, 2x AA batteries, a games controller (Bluetooth) and several ports including Micro USB, USB, Ethernet and power ports.

    Using WIFI, the Android-based games console was backed via a Kickstarter project and was released in the UK on Tuesday 25 June 2013 and by mid-day, reports that Amazon had sold out as well as several US chain stores.

    What’s the deal with the OUYA?

    Well its a budget Android powered “hackable” gaming console games console aimed at gamers on modest incomes, people who liked Retro gaming and of course; Indie game development. As it’s Android based you can “side load” pretty much anything on to it, and people have added their own apps, most of which are emulator for SNES, NES, Neo Geo, Commodore 64 and others.

    In terms of hardware, the OUYA has a nVidia Tegra 3, 1GB of RAM, and 8GB of flash storage and is expandable with a SD card.

    Initial thoughts and reservations

    Having spent a bit of time setting up the OUYA and figuring out WIFI connectivity issues relating to firewall settings, I finally got the OUYA up and running and playing some games.

    Every game is free to try with the idea that you will buy games you like, plus there is the added advantage of making and self-publishing your own games via the Micro USB.

    The UI interface is interesting, but it can be hard to find out specific information such as no visual indicator of how much a game actually costs to buy on screen, how much disk space you have left.

    The games themselves are fine, and some are a bit too expensive for my liking. When signing up you have the option to use a credit card (which I would avoid) and a pay via a paper based voucher system which is similar to how the Playstation network works.

    Where my reservations lie are that it will be viewed and seen by many as a dev kit, a toy and not a serious games device because of the lack of power, hardware or proper design.

    Perhaps part of this might be because the amount they raised to make OUYA wasn’t even touching the surface of making a games console on the scale of Sony PS4, Vita, Microsoft, and with constant rumours that an Apple games console means that the OUYA could be dead within a year or less; without proper games companies backing it and major investment.

    For those in indie development, the PS4 is coming out soon. Vita is opening up to indie developers I see both these and whatever Apple does as strong reasons that the OUYA is going to have a very hard market to crack.

    TV in a world gone mobile?

    In a world gone mobile it seems odd to be talking about a device for the TV.

    I do feel its lacking something, maybe its build quality, maybe its not as good as the hype or maybe its because for the same price you could get a pre-owned VITA, a pre-owned PS2 and a bunch of games.

    Developing for the OUYA?

    At this current time, developing for the OUYA seems limited to Unity, Android Java (which I don’t really want to be learning) and a few game engines. Corona SDK, Multimedia Fusion 2, YoYoGames are all meant to be making exporters which target the OUYA but it is my feeling this will be arriving within 2-3 months of the OUYA. Already, YoYoGames is making in-roads towards OUYA development.

    For the cynical, the OUYA perhaps should have been called the Unity-Box; because thats what your going to need to develop properly for the device. Thats not to say if your really good with Java you could make apps for the OUYA. For me, Java development is not something I want to be doing to make a simple game.

    I’m going to keep the OUYA for the summer and see if I can do simple apps with it without Unity.

    For further information on developing for OUYA, check out this article http://gamedev.tutsplus.com/articles/how-to-learn/how-to-learn-ouya-gamedev/

    My first initial feelings on the OUYA are:

    • Hardware: 5/10
    • Software: 5/10
    • Developing for it: 4/10
    • Future? Unsure

    Overall: 5/10.