pyehouse
31Aug/110

Centripetal: Free for a Day!

PNG is making Centripetal free for a day!

31Aug/110

cocos2d Health Bar

Would you like to create a cool health meter complete with a grilled effect and a background gradient? Something that looks a little like this:

Sample colored grilled health meter

I'm going to show you how to set this up in your own game. I'm assuming you are using cocos2d as your graphics framework. First, design your grill. This is going to be an image with the same background color as where you intend to put your health meter, but with transparent chunks removed to create the grill effect. Mine looks like this:

Note that it is 200 pixels wide by 40 pixels tall. More importantly because it uses transparency, I have to use an image format that explicitly supports transparency. In my case I used the PNG format, though GIF would also have worked. JPG, since it does not support transparency, would not work in this case.

Next, add the following member to the layer or scene to which you are adding your health meter:

    CCLayerColor* healthHiderLayer;

You're going to need that later. Next, in your setup code for the same class (typically in your init() method), add the following:

        float healthWidth = 200;
        float healthHeight = 39;
        CCLayerGradient* baseHealthLayer = [CCLayerGradient layerWithColor:ccc4(255, 0, 0, 255)
               fadingTo:ccc4(0, 255, 0, 255) alongVector:ccp(1.0f,0.0f)];
        baseHealthLayer.contentSize = CGSizeMake(healthWidth, healthHeight);
        [self addChild baseHealthLayer];
        healthHiderLayer = [CCLayerColor layerWithColor:ccc4(0, 0, 0, 255) width:healthWidth
               height:healthHeight];
        healthHiderLayer.position = CGPointZero;//ccp(shieldWidth,shieldHeight);
        healthHiderLayer.anchorPoint = ccp(1.0f,0.0f);
        [baseHealthLayer addChild:healthHiderLayer z:3];
        CCSprite* healthGrill = [CCSprite spriteWithFileName:@"healthGrill.png"];
        healthGrill.position = CGPointZero;
        healthGrill.anchorPoint = CGPointZero;
        [baseHealthLayer addChild:healthGrill z:4];

Let's break that down. I create two local variables, healthWidth and healthHeight, which are set to the width and one less than the height of the health grill image. I then create a gradient layer with those dimensions. I then add baseHealthLayer to whatever CCNode that I'm placing the health meter into. The rest of the health meter components are children of baseHealthLayer.

I then create a solid black layer on the fly which will be used to conceal the gradient layer we just created. It's a little bigger than the gradient layer in order to cover it without artifacts. Note that we anchor the healthHiderLayer on it's right end. That will be important later.

Then, we grab our grill and put it into place. Note also that we set up our z-order here with the grill on top, the concealing layer below it and the gradient on bottom.

The next bit of code should be a method defined in the object we put the health meter into:

-(void) setHealthPercent:(float)pct
{
    healthHiderLayer.scaleX = 1.0f - pct;
}

This gives you the ability to set your health to a specific percentage. This in turn alters the scaleX property of the healthHiderLayer. Because we anchor it on its right end, that means it adjusts its length as extended from the right end of the health bar in general. As the health percent decreases, the scaling effect increases, and the hider hides more and more of the gradient. The grill is just there as additional eye candy but can be made to look however you want the individual health bars to look.

30Aug/110

Malware .. Plague of the Internet

So you think you may have become infected with malware (that is, a virus, a trojan, a keylogger, a rootkit or any other number of bits of malevolent software). First off, realize that many types of malware can be cleanly removed. The counterpoint to that is that not only are other types extremely hard to get rid of, they can even confound anti-malware kits you might have installed or are considering installing to clean things up. Sometimes the safest approach might even be to physically remove your infected hard drive and connect it as a passive drive on another clean machine with cleanup tools which can then work with the infected drive without actually fighting against the malware installed on it.

Here are some sites with some apps that can help:

http://www.gmer.net - this site contains three tools:

  • GMER itself does very thorough scans and can attempt to clean some types of malware (they recommend that you rename it to something random before running so as to disallow malware on your system from trying to halt its execution)
  • catchme, which tries to detect whether you have a rootkit running
  • mbr, which tries to detect whether you have a MBR (Master Boot Record) infection, one of the thorniest types of malware to clean because you can’t (normally) clean it while booted up from the infected drive

http://support.kaspersky.com/viruses/solutions?qid=208280684 - this site links to Kaspersky’s TDSSKiller application which can disinfect certain rootkits

http://www.bleepingcomputer.com/download/anti-virus/combofix - this site links to ComboFix, an application that is updated regularly to find and eliminate a variety of malware infections. The warnings indicate you should only run it when you are told to do so by the helpers at bleepingcomputer.com so take it with a grain of salt

http://www.malwarebytes.org/ - this site links to MalwareBytes’ Anti-Malware (aka MBAM) which with the free version can do after-the-infection cleanup in some cases, but they also have a paid version ($25/yr) which tries to actively prevent infections.

http://download.bleepingcomputer.com/grinler/unhide.exe - this application is used to unhide your start menu and folders after certain applications hide them in an attempt to make you think your machine was damaged and that the malware can fix it if you provide a credit card number.

This list is by no means exhaustive. There are other tools available as well. More importantly these tools are explicitly NOT antivirus tools along the lines of Symantec, Security Essentials, Sophos, Avast and others. With the exception of MBAM, they don’t have a resident mode to monitor your machine to try to prevent outbreaks or instantly clean up infections in real time. They are mostly intended to clean things up when requested. And nothing replaces contacting an actual computer support technician to have a look. Additionally these tools are typically updated frequently to respond to the most recent outbreaks. This means you shouldn’t just download a copy and expect it to be equally effective six months down the road.

29Aug/110

I’ve Made A Game… Now What?

You've finished your masterpiece. Your testers are happy with your game and so are you. Everyone who has seen it has fallen in love with it. It's ready to go up on the app store.

So now what? Well, if you're like me, you start scrambling to learn everything you can about how to market your iPhone app. I'm willing to admit that there is quite possibly some excellent resource out there, some single point of reference, which tells the budding iPhone app developer how to shepherd his app onto the millions of devices out there. I'm equally willing to admit that I have not yet found that resource. What follows are my own ramblings concerning marketing.

It goes without saying you want your app to be good. I mean that in the complete sense. It needs polish; it needs to look and sound and behave like a quality app. All of that can of course be independent of whether the game (let's just pretend we're only talking about games, though most of this applies to any iPhone/iPad app) is actually fun, but that's another can of worms. Suffice to say I hope you found a fun game concept to start with.

But even if your app is perfectly designed and developed, it won't mean anything unless you can get folks to see it. In preparation for that you will need to make sure there is something worth seeing. Part of the app submission process is taking screenshots and uploading them in the app store. You will likely want to keep some of them around to use yourself on the webpage you're going to create for your game. Yes, you're going to want to create a webpage that exists solely to extol the virtues of your creation. You will provide this URL in the app store when you submit your app.

You should also create a demo video of some kind. The iOS Emulator can be useful here but if your game requires the accelerometer (e.g. tilt control), the compass, or some other aspect that requires an actual device, you will have a more difficult task ahead of you. Once you have your video, I would recommend you upload it to Youtube or some other video sharing site which is publicly accessible. You can, in addition to that, create an embedded video object on the game's webpage so that visitors can also see it there.

The game webpage needs to be well written and well designed. It should get the point of the game across and, if possible, drive the potential customer to buy the game. Most games at low price points are virtually impulse buys. Don't dilly dally. Get to the point and get them to the app store to buy your shiny.

So now you have something searchable, something folks can go to and see and learn about your new game. Now you need to get them there. Here are some things that do NOT work.

Do not rush out and create a Twitter account and post your link. You have no standing, no history, no credibility, no followers and your tweet will have no effect. Likewise, do not rush out and do this with a Facebook account, a blog or any other account. Really, if you plan to make use of social media, you will either have to plan WELL ahead to establish yourself in advance OR you are going to have lean on someone else's credibility. That means sponsorship, finding someone who is willing to sell you their space. They've already done the work of pulling together a readership and might sell you the fruits of their labor.

Do not expect your game to show up fresh and new on the store and just spread automatically. Your app will show up on top of various lists for the first 24-48 hours and after that will be essentially buried on the back pages. Here, page 2 is about as bad as page 200. You can expect your first 1-2 days of sales, barring any advertising strategy, to be your best days. You want to plan to do better. It won't *just happen*.

Do not expect the 'New and Noteworthy' gift basket. If Apple puts you in 'New and Noteworthy', thank your lucky stars and enjoy cashing your check. But you have virtually no control over this. There are many quality games that never make it into that lofty position. It's a matter of luck as much as anything else. At least as far as I can tell. I hope. Otherwise, why haven't I gotten there... *sniffle*

Things to do? Well, I can tell you some things I'm trying. I submitted my app to as many review sites as I could reasonably find. Don't forget to download your promotional codes from Apple. You're going to be handing them out like candy on Halloween. Most review sites expect you to provide a free copy for review, which is only reasonable.

Remember what I said about social media? Try to find someone who will tweet for you. Or advertise on Facebook. There are some brokerage sites which will help you find contacts to do just this. Additionally there are sites which allow you to buy online advertising. These usually allow you to purchase a specific section of the target website, allowing you to put an image there in a rotation, along with the URL your potential customer will be sent to should they click on your ad. Most use a CPM arrangement, which is a cost-per-thousand-views option. They should provide you an average number of views to let you estimate what the final cost will be. Sometimes you can find a flat rate option which is a set dollar amount. Consider your budget when you consider these options.

And... that's all for now. As I said, I'm sure this isn't complete. Perhaps it's not even the right approach. Some of the things I'm trying now I have yet to see whether they are going to pan out. And some things I know I have not yet fully explored. I'll try to come back with more results.

My last bit of advice... don't quit. If you're like me, your education and experience is deep in the development side of things, less so on the artistic front and extremely limited to non-existent on the marketing front. But if you were inspired to create an app, don't let it go to waste. Keep trying to figure out how to get eyes on your game. Even if you're discouraged, shake it off and keep at it. It's the only way to achieve success.

Filed under: tech No Comments