Categories
bitching iphone

Anatomy of a cluster-f*ck: Imagination’s SDK installer

iOS devices (iPhone, iPod Touch, iPad) are powered by 3D chips branded “PowerVR” from a company branded as “Imagination”.

If you want to develop 3D games/apps, you can do that using Apple’s free tools + SDK. But some of the good stuff – e.g. higher-res textures – you’ll need to dive into PowerVR specifics. This should *in theory* be very, very, very easy. But Imagination does not make it so :(.

All you really need is a few source files, but instead of putting them on their website to for you to download, Imagination has wrapped them up in a 1 gigabyte (broken) self-extractor. And it doesn’t work. It *really* doesn’t work. Read on for some of the joys of just how awful something as simple as a “unzip this file” program can get…

UPDATE: I realised after posting that I left out a very important point. Until this mess, I’d found Imagination’s tech guys to be friendly and helpful, and their tools to be useful and to work fine. They were always badly documented (e.g. very bad error handling, missing key facts like “a 64 megabyte texture requires 3 GIGABYTES of RAM to save”, etc – but they essentially “worked”). Maybe I just got lucky until now, but this installer seems a radical departure in terms of quality and testing. For anyone who’s *not* used the PowerVR stuff before, bear this in mind: IME, this experience is not normal. Also: use the forums – the support team seems pretty responsive.

TL;DR – if you want to load PVR textures on iOS, google for “PVR” and “iOS” and “copyright imagination” and find the header files and source that are embedded in a couple of open-source projects from a couple years back, before Imagination accidentally broke everything.

Categories
computer games games design MMOG development network programming networking programming system architecture web 2.0

MMO scalability is finally irrelevant for Indie MMOs

Here’s a great post-mortem on Growtopia (launched 2012, developed by a team of two)

It’s slightly buried in there, but I spotted this:

Categories
PHP programming startup advice usability web 2.0

WordPress: inline “signup email” drop into post or sidebar

My blog posts are info-rich and spam-poor. Most of the “enter your email address” plugins are designed for spam – covered in bling, in-your-face animations, background music, all sorts of crap.

There’s nothing out there, so I made one, using a GPL’d existing project. Feel free to use this yourself.

note: this is an image, not a form!
Screen Shot 2013-06-13 at 13.48.14

Categories
Unity3D Unity3D-tips

Unity Custom Editors: dragging handles in 3D

Here’s two quick tips for people writing custom 3D editor controls (something you should be doing a lot of in Unity, because it’s very good at it, and it saves a lot of dev time and design time!)

Categories
GamesThatTeach

Games that teach: Code Combat

http://codecombat.com/campaign = Tower Defence clone where instead of just placing towers … you write basic commands in javascript to manipulate your troops around the map:

This is an early preview build, so it ONLY WORKS WITH CHROME (EDIT: (deleted off topic personal commentary) … Chrome’s native plugin stuff is great, I can see why a lot of devs use it for prototyping … but the politics around Google, and their actions to edge-out more inclusive, free, open browsers is distressing)

Screen Shot 2013-06-10 at 19.36.04

Categories
entity systems

Entity System game on Steam Greenlight: The Few (WW2 planes RTS)

http://steamcommunity.com/sharedfiles/filedetails/?id=130180383

Categories
programming

SVGKit 2013 – Recipes (part 2)

(see also the first set of SVGKit recipes)

Change the color of a SVG element like a Path or Circle after the user click on it

[objc]
CALayer* layerUserClickedOn = …

if( [layerUserClickedOn isKindOfClass:[CAShapeLayer class]] ) // should ALWAYS be true, but just in case you write your code wrong…
{
CAShapeLayer* shapeLayer = (CAShapeLayer*) layerUserClickedOn;
shapeLayer.fillColor = [UIColor redColor].CGColor;
}
[/objc]

Find the CALayer that was generated from a particular SVGElement

NB: Apple/ObjectiveC uses “id” as a keyword, so we had to rename the SVG name “id” to “identifier”.

If your SVG file is legal, and has a unique “id” attribute for every SVGElement, then you can find the CALayer directly from the SVGElement, using the “id” attribute. If your SVG file has no “id” attributes, or the SVGElement you’re searching has no “id” element, then you’ll have to do more work – or fix the SVG file (edit it, add an “id” attribute to the SVGElement that matters, save it … then use this recipe)!

[objc]
SVGKImage* svgImage = …
SVGElement* element = … // see previous SVGKit recipes
CALayer* layer = [svgImage layerWithIdentifier:element.identifier];
… // do something with it…
[/objc]

Clone part of the image, and move it around / change it

First of all, find the part of the SVG you want to clone, e.g. using “Search an SVG file for particular tags / nodes / elements” from the first set of SVGKit recipes.

That gives you an (SVGElement*). Use the previous recipe to get the CALayer. Finally, clone it and use it:

[objc]
#import "CALayer+RecursiveClone.h" // requires SVGKit version 1.1.0 or later


-(void) someMethod
{
SVGKImage* svgImage = …
SVGElement* elementToClone = … // see previous SVGKit recipes
CALayer* layerToClone = … // see recipe above

CALayer* newLayer = [layerToClone cloneRecursively];
newLayer.frame = layerToClone.bounds; // reset it to be positioned at (0,0)

// if you want the clone to start in same position as original
// add this code
if( calculatePositionOfOriginalLayer )
{
CGFloat xOffsetOriginal = 0.0f;
CGFloat yOffsetOriginal = 0.0f;
CALayer* parentLayer = layerToClone;
while( nil != (parentLayer = parentLayer.superlayer) )
{
xOffsetOriginal += parentLayer.frame.origin.x;
yOffsetOriginal += parentLayer.frame.origin.y;
}
CGPoint positionOfOriginalLayer = CGPointApplyTransform( layerToClone.position, CGAffineMakeTranslation( xOffsetOriginal, yOffsetOriginal ) );
}
}
[/objc]

Edit the polygons / lines / shapes after loading

Every “shape” is stored as some form of Apple CGPath object.

[objc]
CALayer* layerInSVG = … // use a previous recipe to get the layer from the SVG element
CAShapeLayer* shapeLayer = (CAShapeLayer*) layerInSVG; // if you chose wrong, this will error at runtime
CGPath pathToEdit = shapeLayer.path;

… // edit the path, and create a replacement path

shapeLayer.path = myEditedPath;
[/objc]

Apple doesn’t provide an API to directly edit CGPath objects. They have a C API that let’s you create a callback function that turns the CGPath into a list of draw-calls, that you can then work with. But it takes quite a bit of code to read this, and then convert it back into a CGPath that Apple can draw.

So far, no-one has open-sourced their code for this (I’ve got a private version I wrote for a previous project, but it’s thousands of lines of code). Either petition Apple to add the missing APIs, or find someone to write it for you / license it to you, or write it yourself.