Categories
computer games games design games industry

“We are a compromised profession” (Game Designers)

Carlo Delallana responds to the sensationalized report that “I think most game designers really just suck”:

“One of biggest problems that game designers face in their path towards mastery is respect. It’s easy to respect an artist with a demonstrable skill, no average person assumes they can do what an engineer does. But game designer? For one thing our profession faces a common misconception, that game design is coming up with ideas (as noted by Garrott’s comment on lazy designers). That all you need to do is clone, that you are no better than your competition (as noted by Mark Pincus).

We are a compromised profession, tasked at executing a formula to minimize risk. Unfortunately, executing on formula is counter to mastery of any skill. If the marching order is “status quo” instead of “challenge yourself” then how does a game designer grow?”

(NB: Gamasutra clearly did the IMHO scummy journalist thing of sensationalizing RG’s quote; and RG should have been a lot more careful – personally I believe he didn’t mean it the way it came across, but it came across … badly)

Either way, Carlo’s reply is worth reading in full

Categories
android

Download link for Android ADT in 2013

Tonight I lost 30 minutes because Google’s Android team still has the wrong links on the download page of their website. Every few months someone from their team copy/pastes the wrong link back onto the page…

Android’s download page (http://tools.android.com/download) says:

“download …ADT and Tools … from http://developer.android.com/sdk/index.html ”

This is 50% true. The “Tools” are on that page (although some poor web design means you now have to jump through silly JavaScript hoops to see them – this is a new “feature”).

…but “ADT” has NOT been on that page for something like 2 years now. I am surprised that no-one cares enough to fix this. You can wipe your system and download 0.5 gigabytes of trash to replace it, hidden inside which is the ADT – but you cannot get to the ADT itself.

So, until the Android team checks their links and fixes their webpage, here’s the actual (official!) download page for ADT:

http://developer.android.com/sdk/installing/installing-adt.html – Google’s ADT download page, NB: IGNORE the part at the top, the actual link is in “Troubleshooting”, and has been there for 3+ years

Categories
iphone programming

Every size you need to know when designing for iOS

References

Building an app, the basics

iPhone launchimage/splash

Default.png Default-568@2x.png
Model Size Model Size
3 + 3GS 320×480
4 + 4S 640×960
5 640×1136

iPad launchimage/splash

Default.png Default@2x.png
Model Size Model Size
1 + 2 768×1004
or 1024×748
3 + 4 1536×2008
or 2048×1496

iPhone fullscreen

No status bar with status bar with status bar + navbar
Model Size Model Size Model Size
3 + 3GS 320×480 3 + 3GS 320×460
or 480×300
3 + 3GS 320×416
or 480×268
4 + 4S 640×960 4 + 4S 640×920
or 960×600
4S 640×832
or 960×536
5 640×1136 5 640×1096
or 1136×600
5 640×1008
or 1136×512

iPad fullscreen

No status bar with status bar with status bar + navbar
Model Size Model Size Model Size
1 + 2 768×1024 1 + 2 768×1004
or 1024×748
1 + 2 768×960
or 1024×704
3 + 4 1536×2048 3 + 4 1536×2008
or 2048×1496
3 + 4 1536×1920
or 2048×1408

iPhone app icons

App iTunes Spotlight
Model Size Model Size Model Size
3 + 3GS 57×57 3 + 3GS 512×512 3 + 3GS 29×29
4 + 4S + 5 114×114 4 + 4S + 5 1024×1024 4 + 4S + 5 58×58

iPad app icons

REQUIRED
App iTunes NewsStand (if Newsstand app)
Model Size Model Size Model Size
1 + 2 72×72 1 + 2 512×512 1 + 2 >= 512
3 + 4 144×144 3 + 4 1024×1024 3 + 4 >= 1024
OPTIONAL
Spotlight Settings
Model Size Model Size
1 + 2 50×50 1 + 2 29×29
3 + 4 100×100 1 + 2 58×58
Categories
iphone programming

Touch interfaces: Help for new users (any app)

I’m writing an iPad game that’s designed to be self-evident and trivial to use.

Today, I made a re-usable “tell the user how many fingers to use” animation that would work well with any app. So, I decided to open-source it and stick it on github.

Screenshot from my current app (NB: you need to photo YOUR fingers – not mine! – if you want it to look like this)

Usage

Instructions are in the source code, but my intention is for this to be ULTRA SIMPLE for you to use, so here goes:

[code]

// Add this to the main UIViewController for your app – the one that displays
// when you’re ready for user interaction
-(void)viewDidAppear:(BOOL)animated
{
VFingersHelp* helpView = [[[VFingersHelp alloc] init] autorelease];
/** This will position the helpview in bottom-left corner. Bottom left/right corners are where
users prefer to "touch" (c.f. Disney’s style guide for toddlers).
While they’re watching the help, we don’t want them touching, so we deliberately place in bottom corner.
(feel free to move to top corner if you prefer).
NB: it’s easy to take a photo of your fingers and display at bottom of screen…
*/
helpView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
helpView.center = CGPointMake( 0 + helpView.bounds.size.width/2.0, 2.0 + self.view.bounds.size.height – helpView.bounds.size.height + helpView.bounds.size.height/2.0);
[self.view addSubview:helpView];
}
[/code]

Categories
fixing your desktop

OS X: Make your Mac load web pages 1000x faster

Apple’s core networking for OS X (Lion, Mountain Lion, etc) is famously poor. One of the (many) unfixed bugs is this:

“I go to a webpage (e.g. google.com) and my browser displays a message saying ‘Server not Found’. If I keep hitting Refresh, it never works. If I wait a few minutes and try again, it works”

This is entirely Apple’s fault. They aggressively (and incorrectly) cache “failed” lookups. And … because it’s Apple … you can’t turn it off. It’s been broken for at least 5 years now, which suggests they have no intention of fixing it.

But: you can “flush” it. Since it’s a cache (which are designed to auto-flush anyway), there’s no harm in doing this.

Solution: restart Apple’s DNS cache

  1. Open a Terminal window
  2. type: “sudo killall -HUP mDNSResponder”
    • (you’ll need your admin password, annoyingly, because you’re ‘forcing’ Apple’s code to behave itself)
  3. Reload your webpage – works immediately

After the first time, you can repeat the command frequently without typing your password. Simply hit the “up” arrow (to re-type previous command) and Return to run it.

Categories
advocacy computer games Dare 2 Be Digital education games design games industry GamesThatTeach iphone programming

Teenagers learn to program, write own 3D game, in 3 weeks

Background

Last year, Pearson ran the first ever Innov8 competition, giving tech startups a chance to make their own innovative new product/project. The grand prize was £5,000 towards building the product.

Most of the teams were adults (even: real companies), but a team of students from Blatchington Mill School won, with their idea for an iPhone/iPad app: “My Science Lab”.

Team: Quantum Games

The three students named themselves “Quantum Games”: Jon, Nick, and Oli. All three of them have been studying for their GCSE’s in parallel with this project.

They’ve been supported by Mark Leighton, Assistant Head / ICT Director at the school.

For mentoring and game-development expertise, they had me – Adam Martin – previously CTO at MindCandy and NCsoft Europe, now an iPhone/Android developer

Previously

The students chose to focus on a game that would help other students revise the “Momentum” part of GCSE Physics.

In summer/autumn 2012, they learnt the basics of game design and development. We didn’t do any formal teaching – they simply had to pick up the skills they needed as we went along. YouTube videos, and “trial and error”, were our primary techniques…

In particular, they learnt 3D-modelling and texturing (using Wings3D and Photoshop) and game-programming (using Unity3D and Javascript).

By the end of 2012, they’d written their own physics engine, some basic gameplay, and a simple simulation of an exercise/problem in Momentum.

Last month

The big thing this month has been BETT. Pearson had a large stand, and asked the students along to talk about the project. They gave an excellent presentation to an audience of approx 30 people at BETT, covering the background and some of the things that went well, that didn’t, and what they’d learnt from it.

Leading up to BETT, they worked hard to squeeze in a new build of the game, with a rethink on the interactive sections and how they hang together. Unfortunately, we hit what seemed to be a major bug in Unity’s camera-handling, and none of us could fix it in time (nor could we get an answer from Unity support in time). But the students managed to invent a workaround at the last minute which worked fine for demoing at BETT.

The game isn’t finished yet – GCSE’s and schoolwork left too little time to complete it before BETT – but we’re very close now. The students are aiming to finish it off this month and next, and I’m hoping I might even be able to take a copy to the GDC conference in March (taking place in San Francisco, GDC is the commercial games industry’s main annual conference).

In the meantime … you can sign up now on the Quantum Games website (http://quantumgames.co.uk), and we’ll email you as soon as the game is ready – or sooner, with a private beta-test!

Categories
iphone photos

London … from VERY high up

Courtesy of Gareth, I got a surprise trip to the Shard on opening day, just after sunset.

Tragically, I had my DSLR with me and *left it behind* 10 mins before Gareth phoned me, so all this is from an iPhone 4 (gasp!). Even so, it’s impressive. The Shard is so tall that you get a view of London without the typical “squashing” from perspective. Even from airplanes, flying in to Heathrow for many years, I’ve never seen quite such a decompressed view of London at night…

IMG_3417

IMG_3427

IMG_3448

IMG_3452

IMG_3456

Categories
amusing programming

Modem dialup noises … visualised (and transcribed)

Visual spectral diagram showing the noises modems make, and box-outs for what they’re actually saying:

…and Transcription for txtrs

Modem A: hey babe, you dtmf?
Modem B: u know it
Modem A: what u up 4 2nite? wanna v.8?
Modem B: i wanna ack u like my daddy net2phone use 2 ack me
Modem A: um ok… v.8 then
Modem B: lol jk, u comin?
Modem A: brt just gotta turn off echo suppressors n cancellers
Modem B: ok i wait
Modem B: my pcm is so modulated
Modem A: lol rly? u think u can handle V.90/V.92?
Modem B: D/A?
Modem A: …D?
Modem B: wtf no, im not into that
Modem A: lol jk we can do V.42 LAPM if u want im down 4 nething
Modem A: up to 3429 o/c
Modem A: u know i give as good as i get, ne way u want it, loud or soft, high or low, fast or slow, i got all the time in the world 4 u babe, my clock source is internal
Modem B: of course no 3429. and same 4 me. except i might lose track of time, lol
Modem B: and honey if u with me we gon be makin sum NOISE
Modem B: 6db at LEAST u know how i like it
Modem A: lol i hear ya, 3200 all nite long, the way u get me goin maybe we even go 2 4800 lol
Modem A: set ur pre-emphasis filter params n put on that 1920 hz carrier frequency i got u
Modem A: im here baby
[SCRAMBLED]

Categories
games industry startup advice web 2.0

Amazon and the high-value of a low-margin business model…

Some good observations on tech business strategy here

Low-margin can still mean high-value-business:

“Most people just look at a company’s margins and judge the quality of the business model based on that, but the cash flow characteristics of the business can make one company a far more valuable company than another with the exact same operating margin. Amazon could have had a margin of zero and still made money.”

Preventing the number-1 biggest threat to a mainstream company (disruption):

“Study disruption in most businesses and it almost always comes from the low end. Some competitor grabs a foothold on the bottom rung of the ladder and pulls itself upstream. But if you’re already sitting on that lowest rung as the incumbent, it’s tough for a disruptor to cling to anything to gain traction.”

And … an idea I’d considered more seriously back when I started in iOS development. This was the perfect way to disrupt agencies (tough and unpleasant though it was):

“Not having to sweat a constant onslaught of new competitors is really underrated. You can allocate your best employees to explore new lines of business, you can count on a consistent flow of cash from your more mature product or service lines, and you can focus your management team on offense. I”

Categories
amusing fixing your desktop

Virgin Atlantic – how to get them to phone you back

Here’s the magic URL, that you can’t access directly from the site:

http://www.virgin-atlantic.com/en/gb/bookflightsandmore/bookflights/callme.jsp

Huh?

In 5+ years of flying with Virgin, their online booking system has always, every single time, failed – and redirected me to a page where I get that link to get THEM to phone ME.

(which is useful, since the evil mobile network operators don’t like Virgin’s 08-something numbers, and turn them into premium-rate bills)

It’s a pain going to the site, going through the pointless online booking, knowing that you’ll end up on the “our booking system sucks, click here” page.

So I’m blogging this so I never need to do it again!

Categories
agile games industry marketing startup advice web 2.0

How middleware (and open source) downloads ought to work – Unity3D

While upgrading Unity, I noticed the current download page is a great example of how it SHOULD be done:

Unity 4 has some … issues … with backwards compatibility – but at least they made the “need an older version?” link prominent. And how many old versions can you download?

Many!

(it goes on right back to unity 3.0)

Old versions? Who cares!

Well, that backwards compatibility thing is a *****. If you work on a project with other people, and they’re using Unity 3.5 … you SHOULD NOT (must not?) use Unity 4 (there be Dragons).

But it’s fine; Unity makes it trivial for anyone joining such a project to get exactly the version they need.

Some games middleware *cough*Hansoft*cough* companies declare that everyone must use the latest version, even if it is buggy and breaks existing projects. Or if it requires staff retraining. You must retrain EVERYONE! NOW!

(Hansoft has probably changed by now – maybe unfair to single them out. But for a long time they only allowed you to download the “latest” version, and actively deleted everything else. As soon as a new version existed, BOOM! Everything else got wiped. A happy customer I was not)

Recap

So, here we have a piece of middleware, with a download page:

  • Lives at an obvious, permanent URL: http://unity3d.com/unity/download/
  • Makes it very easy to find the download link (many open-source projects: shame on you)
  • Uncluttered webpage, and makes it easy to understand which download you want (Eclipse.org: shame on you)
  • Every version has its release notes right there, for you to click on! (Apple (every product), and Firefox: shame on you)
  • Every version has BOTH the windows AND the mac downloads (computers today are cheaper than they’ve ever been. Many people have a laptop thats Mac, and desktop that’s Windows, or vice versa. You can’t assume that the browser they’re using dictates the desktop they’ll be working from)

Designing a website to look simple is certainly a difficult and non-trivial task.

But in the case of a download page – where almost everyone has the same needs, and there are many examples to copy (plagiarise) from – it doesn’t take much. More projects (and companies) should at least try to do this.

Categories
fixing your desktop games design games publishing programming

Unity crash: “type == kMetaAssetType && pathName.find (“library/metadata”) != 0″

Unity’s QA dept needs a smack up-side the head. If you get this bug, you’re a bit screwed – the only “fix” is to go into system settings and wipe Unity’s crud.

Error message:

type == kMetaAssetType && pathName.find (“library/metadata”) != 0

Thanks, Unity, that’s very human-readable and helpful. Not.

(appears to be an Assert written by a junior programmer – or a debug-only Assert that got left in the shipping version(!))\

Problem:

  1. Unity’s tech team wrote Unity 3 so that it would open projects BEFORE checking if there was a new version available
  2. Unity 4 is NOT backwards compatible; it corrupts projects so that they will NEVER load in Unity 3.x
  3. …also: Unity 3.5 will FATAL CRASH if it tries to open a Unity 4 project
  4. Unity (generally) is badly written and auto-opens the last project, even if you don’t want to, and EVEN IF ITS CORRUPT
  5. Unity (generally) DOESN’T BOTHER to offer any way of starting “safely”

Solution (OS X):

  1. Force-quit Unity (not only does it crash, but it hangs forever) – RMB on the icon, hold down alt/option, and the Force Quit option appears
  2. run Finder, go to (your user)/Library, aka “~/Library”. If you don’t know how, then do ONE OF the following (either works):
    • EITHER: Start at your username folder (it’s the parent folder of your Desktop folder, parent of your Documents folder, etc), un-break OS X (Apple ships it as broken-by-default): google for “enable see Library folder in Finder”, follow the instructions
    • OR: In Finder’s “Go” menu, select “Go to folder”, and type “~/Library”
      • Inside Library, find “Preferences” folder
      • Find *everything* that begins “com.unity3d.” and delete it (there are approx 20 files, of 2 different file types)
      • Re-start Unity, and it will open the default project
      • …And this time, Unity will offer to upgrade to Unity 4

UPDATE

For bonus points, the Unity 4 “upgrade” isn’t an upgrade: it’s a replacement. I expected it to download “the bits that have changed”. Nuh-uh. One gigabyte download! (try getting that in a hurry, when your project has suddenly imploded in front of you, because of the non-existent backwards-compatibility :( ).

Some idle thoughts…

I’ve seen similar behaviour before when writing very simple OS X apps. There’s some massive bugs in Apple’s code that have been around for 5+ years (and Apple shows no intention of fixing), which cause “startup actions” to happen in a semi-random order, depending on the NAME and NUMBER of recently-opened projects.

It takes very little testing to discover this. If it’s the problem with the Unity software, then Unity needs to seriously improve their testing on OS X – they should have discovered this easily.

But also … why on earth are they using the NSDocument loading system? Apple never finished writing the docs for it, they seem to have never finished implementing it (major bits of the API seem to be missing) – in general, OS X authors don’t seem to use it any more. Probably because it doesn’t work?

Categories
fixing your desktop

Installing Windows on a Mac: what you need to know (2013)

Prologue: Apple et al recommend you “install new OS’s from USB, not DVD – USB is faster”, but I’ve never bothered before. However, there appears to be a major defect in most Apple iMacs, where the DVD drives fail after only a dozen or so uses (google it and there’s depressingly-long forum threads of people reporting the same problem). When this hit my iMac, I was forced to explore the USB alternatives…

Windows 8 boots the same way Macs do

With the arrival of Windows 8, much of what we see on the web about “installing windows” or “booting windows” is wrong — including Apple’s own Bootcamp (currently: almost a year out of date, badly broken, and Apple hasn’t announced a fix. Sigh).

Allegedly (confirmed by direct experience, but I’m no expert on this) – Windows 7 (and previous versions) used “MBR” booting. Intel Macs use the more modern “GPT” booting – and Windows 8 has finally dropped backwards compatibility, and uses GPT too.

So, as of 2013: there is nothing “special” needed to make a Mac boot in Windows 8

In fact, if you try to, Windows 8 install WILL FAIL because it doesn’t support the old MBR booting any more (it even produces a clear, helpful error message explaining why)…

If something ruins your booting, fix from command line

For power-users who know what they’re doing, this stack-exchange answer gives good step-by-step instructions (with explanations!) on how to “un-break” a broken boot setup on Mac. Worth bookmarking (I used it to fix one of my machines).

NB: all the tools they use in that answer are pre-installed with the Mac and have “man” docs – type “man (command name)” in Terminal to read them.

NB: you can run these tools straight away, but they will probably refuse to “save changes” because you’re using the disk they’re trying to change (mentioned in the link above). You’ll need to boot into a special “repair mode” – see below:

NB: if you mis-type the instructions on that page, you probably will wipe your hard disk. Don’t try this while tired/drunk/etc – or at least take a full backup of your computer first!

An OS X “emergency boot USB drive” is only 1GB

The web is plagued with technically unskilled “journalists” who write articles about “make a USB boot disk for OS X”, and all they do is copy/paste Apple’s own instructions on how to INSTALL OS X (and then they claim credit for it).

The OS X installer requires a 4GB – or, if you’re unlucky, an 8GB – USB key. That’s 8x what you actually need.

It is faster, easier, and safer to use Apple’s own “Make an OS X Bootable USB key” app, which works on any USB drive that’s 1 GB or larger.

You can even create the USB key without downloading the special app – although it requires more fiddling (I recommend: download the app. It’s small and trivial to use).

NB: if you own a mac, make one of these now. Do something useful with those crappy 1GB USB keys you have gathering dust on the shelf!

OS X has an Emergency Partition by default – but you can’t use it

Because those USB boot disks are so massively valuable, Apple now includes a hidden one on your hard disk too, so that you can boot into that and “fix” your main OS X even if you don’t have a USB drive.

Here’s more info on the “Recovery Partition” as its called.

HOWEVER: since that’s installed on the same disk you’re partitioning, … most / all of the disk-repair / disk-alteration utilities are still disabled. That’s why you want/need a USB emergency disk!

Apple’s emergency boot disk doesn’t support all USB devices (e.g. some mice)

Even devices that work during the Apple boot-menu are DISABLED BY APPLE in their “emergency repair / boot” setup.

But without a mouse, you cannot get to the OS X menubar.

And Apple designed their “emergency” system so that most of the features can ONLY be reached viw the menubar (hmm. They really didn’t think that one through…)

So, memorize this keyboard shortcut: ctrl-f2 (or, on a wireless keyboard or laptop: fn-ctrl-f2).

That hilights the “apple symbol” menu, and you can then use cursor keys to reach the other menus.

Apple won’t let you create a USB Windows installer unless you have a MacBook Air

Someone at Apple went out of their way to make life miserable for Apple customers. If you own (or can borrow) a MacBook Air, Apple’s Bootcamp enables an extra “magic feature”: it will create the Windows 8 install USB key for you. (NB: requires a 4GB or greater USB key).

…but if you try this on any other physical Mac, Apple blocks that feature. The key you create will work on EVERY Mac – there’s nothing magical about it.

NB: if you have a Windows 8 DVD but don’t own an Air, and you know someone who does, it’s probably worth borrowing theirs now, to make one of those keys, in case you need it later!

NB: alternatively, if you have access to a machine that already has Windows installed, you can use Microsoft’s “create a Windows8 boot disk / installer” app (says win7, but works for win8 too). Unless you have a recent version of Windows, though, you’ll need to download hundreds of megabytes of .NET updates before this will run – which makes this a slow and irritating option.

Categories
advocacy games industry GamesThatTeach programming web 2.0

Free art can help create a generation of non-pirates

The 21st century will be dominated by “digital” culture and art. History suggests that non-digital art will flourish too (while becoming a smaller, more specialized, part of a larger pie). So it’s all good: more people will have more opportunities to create – and more access to experience – a wider array of art. Win/win!

Except … our societies are struggling to work out how we’ll pay our artists when the marginal price of a copy is less than a penny.

Last week, something interesting happened when several unrelated projects I’m in all came together at once.

Someone is ‘stealing’ from CGTextures.com

Marcel at http://www.cgtextures.com/ gives away a huge library of high-res photo textures, aimed at game-developers, entirely for free. You don’t pay for access, you don’t pay to use them. You can include them in commercial games, make a million dollars – and you owe him nothing (bar gratitude).

Last week he came to a private forum asking for advice on suspected copyright infringers, who might have been taking his free images, removing the attribute/authorship info, and selling them for themselves.

Copying the images, and charging for them, is not theft. It’s illegal, but it’s not stealing. The original source is still available – free – to anyone who wants it. And many authors in this case are inclined to let the scummers go free, so long as they stop charging innocent users for something that’s free to all.

But CGTextures isn’t free to run; if they ever need to raise funds to pay for it, some of that money – which the community would happily donate – is being taken right now by a selfish scummer. Hmm. Tricky.

3D art is hard

If you’re “not an artist” (which for most people means: “I’m crap at drawing/painting!”) then making any kind of 2D art is very difficult, and tends to look like utter crap.

Computer games are dominated by good or great art. Even in the Indie scene, where “teams” are often no more than 2 people working together, we have a blinding array of beautiful artworks. At the opposite end of the spectrum – the AAA titles with budgets counted in “tens of millions” of dollars – it only gets better.

People love playing games – and they love making them too. Many people – artists and programmers – dream of “making a game”. But … just like “I’ve a great idea for a book” … the vast majority never manage it.

Two of the most common reasons they fail:

  1. Aiming too high: games require a lot more work than people imagine, and most people get 10% in and discover they’ve bitten off way too much to chew
  2. The artwork looks crap: everyone they show it to hates it (or they dont dare show it), the author hates it, they realise that no-one will play it, let alone pay for it, and they gradually lose the will to finish the project

Anyone can make a game: even un-trained teenagers

We’re in the final few weeks of proving this (a team of three 15-year-olds are about to publish their iPhone game that they designed, built, tested, and launched from scratch).

Starting with nothing but beginner-level knowledge of Javascript (not enough to write an app), they’ve:

  1. Learnt Javascript
  2. Learnt 3D-modelling
  3. Created all their own 3D models, with textures
  4. Built, tested, and refined a working game

Sounds hard, right? Well, yes, it was. But – if you know enough tricks of the trade – most of that can be made easy enough for anyone to do themselves.

  1. Game structure – use an established game engine
  2. Programming – stick to “simple” programming concepts
  3. In-game artwork – “stylised” 3D models are trivial to create (c.f. Minecraft)
  4. Testing – use a modern IDE with a decent debugger

This is all great, but I’ve glossed-over one item there: textures. You can avoid the need for painting skills by making your game-items 3D instead of 2D, but sooner or later you’re going to need to texture them.

JFGI

With the programming, one of the skills I’ve drummed into them is JFGI (Just F’ing Google It). Everytime you get stuck: google it. If you get no hits – fine, you’ll have to work it out yourself. But often you’ll find:

  1. It’s a bug in your tools, not your fault! Here’s a workaround…
  2. It’s practically impossible; don’t waste time trying to solve it…
  3. Your software documentation / manual was missing the following info: …
  4. It’s a generic boilerplate piece of code. Don’t worry about it, but use this copy/pasteable code solution: …

Leveraging the internet as a resource is fundamental to being a great programmer. I’ll gloss over the risks / dangers for now (I’ll write another post on that later), but most of the time you cannot JFGI too often.

But … with the 2D artwork, with the textures for 3D models … Google becomes a danger.

Google Images: the devil on your shoulder

Writing a presentation, and need an image? Google Images it!

…making a game, and need a “wood texture”? Google Images it!

WHOA THERE, JOHNNY!

Doesn’t feel like stealing (that’s cos it isn’t) – but it is something illegal: copyright infringement. It’s precisely why “copyright” was invented in the first place.

And yet: this single problem can make all your effort, all your hard work on your own creative artwork (your game), invalid. You can have the most sublime game design, a control system that a toddler can master, a frame-rate as smooth as silk … but if the 2D graphics (or the textures) are crap … the whole thing falls flat on its face. And most people can’t draw.

How the pros do it

There are simple techniques for making very good textures starting from random photographs. Even a novice can create something perfectly “good enough” in a short amount of time.

Only one thing is needed: a big library of photographs, MORE THAN ONE per real-world “texture” you need to create. If you have the money, there are dozens of Stock Photography resources, each one costing hundreds (or: thousands) of dollars a year.

But if you’re students – undergraduates, high-schoolers – or simply “not rich” (“artist” isnt’ exactly a high-paid career) and working on your own, you probably don’t have “hundreds of dollars”.

Hey, I know! Let’s use Google Imag- … crap.

Enter stage left: > http://www.cgtextures.com/ – a FREE, ROYALTY-FREE, MASSIVE collection of photographs DESIGNED FOR USING IN COMPUTER GAMES. Why? I guess Marcel is just a naturally generous person.

I showed the guys CGT. No problem; texture sources a-plenty. And it’s all free. And legal…

Full circle

  1. potential pirates who are ‘creating’ are happy to respect copyright, if you educate them early enough … so long as they have viable alternatives
  2. if you take away the alternatives, they must weigh up the moral “cost” of infringement against the moral “benefit” (and personal satisfaction) of completing their own work
    • I’m not advocating this piracy; but where no theft is involved, to most people’s minds the cost is tiny and the benefit is huge. Realistically I expected few people to resist when he temptations – both moral and practical – are so big
  3. sites like CGTextures put “artistic creation with 3D” in reach of everyone
  4. pirating art from CGTextures is – AFAICS – only a criminal activity: illegally extract money from someone else’s work, with no ‘creation’ involved
  5. …but if sites like CGTextures go away (if Marcel gives up), and the next generation of artists lose their alternatives, “copyright” has no chance at all

IMNSHO, anti-software-piracy organizations tend to be idiotic, amoral, and begging to be nuked from orbit. They’re often part of the problem, not the solution. If they genuinely wanted to reduce piracy, they should be creating sites like Marcel’s: royalty-free resources of reduced cost that their industries could easily afford to give away for free.

The debate has – for way too long – characterized software pirates as “inherently evil; bad-doers; malicious”. This is undoubtedly true of some (my opionions of anyone re-selling CGT’s free art are unprintable). But we’re not born as software-pirates; we get that way because of the culture and society we grow up in. We have the opportunity to teach new generations respect for copyright – but that cuts both ways.

In the Digital Age, copyright needs to deserve our respect, not simply demand it.

Some other free texture sites

While checking some of the points in this post, I noticed a few other photo-texture sites that offer royalty-free images suitable for games dev, worth checking out:

Categories
programming startup advice

The cost of interrupting someone … analysed

“Based on a analysis of 10,000 programming sessions recorded from 86 programmers using Eclipse and Visual Studio and a survey of 414 programmers (Parnin:10), we found:

  • A programmer takes between 10-15 minutes to start editing code after resuming work from an interruption.
  • When interrupted during an edit of a method, only 10% of times did a programmer resume work in less than a minute.
  • A programmer is likely to get just one uninterrupted 2-hour session in a day

We also looked at some of the ways programmers coped with interruption:

  • Most sessions programmers navigated to several locations to rebuild context before resuming an edit.
  • Programmers insert intentional compile errors to force a “roadblock” reminder.
  • A source diff is seen as a last resort way to recover state but can be cumbersome to review

The full article – http://blog.ninlabs.com/2013/01/programmer-interrupted/ – includes graphs, analysis techniques, suggested tools / features that help to fix the problems, etc. Good reading.

Also some good comments, for instance:

The less-quoted benefit of Pair Programming

“I was surprised to discover whenI first started pair programming 13 years ago, how one person ia a pair can hold the context while the other person in the pair gets interrupted. We could get back to work in seconds.”

The less-quoted benefit of TDD

“I was also surprised by test-driven development, how it helps keep track of where you are. Here are some of the factors I’ve noticed:
* The test tell you how far you have gone.
* Your test list serves as a reminder of where you need to still get to.
* The focus on small steps meas at any instance there are fewer balls in the air.”

Categories
fixing your desktop

How to export timesheets from OfficeTime

OfficeTime is one of the more popular/higher rated time-tracking apps for iOS / OS X. On the whole, it’s fine.

But exporting the data – which is half of the app’s purpose – is extremely difficult. There’s no docs I could find either in the app or on the website. You have to google, get lucky, and find some old blog posts by the author with hints. And even then you still have to jump through a 9-step process.

Every time I need to do this, its sufficiently un-obvious that I forget how and have to figure it out again. So, here’s a step by step:

  1. You must have a wifi network that both your computer and iphone are on
    • Yes, really :(.
  2. Run OfficeTime on the desktop
  3. Create a new project you will never use (author requires you to do this – if you don’t create the blank project, the app quits itself!)
    • I prefer names like “Delete this that Officetime created”
  4. Run the app on iphone
  5. Go to the Settings menu (cog icon from the home screen)
  6. Select “Desktop Sync”
  7. Select “Sync with”
  8. …if everything’s working, your computer name will appear in the list…
  9. On the computer, ACCEPT the sync
  10. …nothing happens. None of your data appears, but don’t panic, this is “as expected”
  11. On the computer, open the Reports menu, and create any report – your data from iPhone will finally appear

…after that, it’s plain sailing. The UX of the desktop app is poor, but it’s trivial from here to get to Excel, and clean up the data.

UPDATE: getting it into Excel…

At first, I thought you should use the “Reports” menu.

Don’t do that – the export GUI is terrible, it saves files in the wrong format, and … the output format is harder for Excel to use. There’s an easier, better way…

Instead:

  1. Open the QuickStart menu
  2. …this will silently, magically, have gained a set of new options now that your iPhone is connected. One for each project on the iPhone
  3. Select the project you want to export. A window will appear with all the data, nicely formatted, easy to read
  4. NB: for me, the desktop app creates a phantom “0 minutes long” additional entry when you do this. Select it and delete it
  5. Select all the rows in the window, then CMD-C (copy), switch to Excel/OpenOffice.org and CMD-V (paste)
    • (this uses a better format than the built-in exporter, and you can manually clean it up)

This gives you the exact times, down to the nearest minute. Most people don’t bill their client that way – although it’s good to show the actual numbers, you usually want to do a precise (accurate) total, and then round to the nearest 15 minutes for each billable period.

Here’s the Excel / OOO formula for that:

Create a SUM cell for all your times (use the appropraite column, not C6:C10):
=SUM(C6:C10)

Create a ROUNDING cell for final number (C12 is wherever you put your SUM cell above):
=CEILING(C12; 1/24/60 * 15 )

NB: the “15” in that last formula is the “number of minutes to round to” … replace it with “30” for half-hours, “60” for hours … etc.

Categories
advocacy bitching web 2.0

Ethics in the modern world: Lessig on Aaron Swartz

I don’t normally blog about this stuff, but here we have the intersection of an eloquent speaker on core matters of modern life and how they intersect the legal systems … with the kind of tragedy that’s often threatened when elements of society have orders of magnitude more power than responsibility:

http://lessig.tumblr.com/post/40347463044/prosecutor-as-bully

The public statement by the prosecutors is worth reading too:

http://0v.org/carmen-ortiz-has-released-a-statement/

UPDATE: according to the United States Department of Justice’s own website (?), in relation to this case:

United States Attorney Carmen M. Ortiz said, “Stealing is stealing whether you use a computer command or a crowbar

It is extremely difficult in practice (practically impossible?) to steal via “a computer command”. To me, the Attorney’s statement has no relevance to what – it is reported – happened in this case.

For reference, type “define: stealing” into Google, and see what you get

Lawyers can *always* hide behind a claim that they’re “only following the letter of the law”; unfortunately, the Western legal system is generally based upon NOT following the letter of the law, but the spirit of the lawmakers (as interpreted by various stages of Judges). Which makes such arguments inherently specious.

I’m not a lawyer, merely a slightly-informed amateur, but … If this is the best defence that the prosecutors can offer, as eloquent lawyers, it appears to me that they knowingly do terrible things.

Categories
computer games design games design games industry network programming programming

All Game Developers should read Pat Wyatt’s blog…

I noticed a few months back that Pat Wyatt has been blogging rgularly and in a lot of detail last year. This (IMHO) is big news: Pat is an awesome developer who held key positions in the teams behind many of the bestselling computer games (e.g.: Diablo 1 + 2, Starcraft, Warcraft) and went on to co-found Arena.Net (creators of Guild Wars).

I worked with him briefly in the past, and he’s friendly and full of advice and knowledge – but while he was happy to share, IIRC it was rarely in published form.

I’ve had a tough few months, but I’ve been dipping into his blog a few times, and it delivers in spades. Here’s a few hilights:

Assertions: enable them in live builds

(I’ve always felt this was the “right” way to do it for servers – where you don’t have to worry so much about frame-time, and assertions are more valuable at runtime because they help with the hardest-to-trace bugs … but it’s hard to get broad data on what the performance cost is)
http://www.codeofhonor.com/blog/whose-bug-is-this-anyway:

“The bug was easily fixed by upgrading the build server, but in the end we decided to leave assertions enabled even for live builds. The anticipated cost-savings in CPU utilization (or more correctly, the anticipated savings from being able to purchase fewer computers in the future) were lost due to the programming effort required to identify the bug, so we felt it better to avoid similar issues in future.”

…and a great rule of thumb for any Programmer:

“After my experience reporting a non-bug to the folks at Microsoft, I was notably more shy about suggesting that bugs might be caused by anything other than the code I or one of my teammates wrote.”

Some bugs are due to … user’s broken hardware

http://www.codeofhonor.com/blog/whose-bug-is-this-anyway:

“Mike O’Brien, one of the co-founders and a crack programmer, eventually came up with the idea that they were related to computer hardware failures rather than programming failures. More importantly he had the bright idea for how to test that hypothesis, which is the mark of an excellent scientist.

He wrote a module (“OsStress”) which would allocate a block of memory, perform calculations in that memory block, and then compare the results of the calculation to a table of known answers. He encoded this stress-test into the main game loop so that the computer would perform this verification step about 30-50 times per second.

On a properly functioning computer this stress test should never fail, but surprisingly we discovered that on about 1% of the computers being used to play Guild Wars it did fail! One percent might not sound like a big deal, but when one million gamers play the game on any given day that means 10,000 would have at least one crash bug. Our programming team could spend weeks researching the bugs for just one day at that rate!”

AI cheats to improve game balance in RTS’s, starting with Warcraft/Starcraft

http://www.codeofhonor.com/blog/the-making-of-warcraft-part-3:

In most Warcraft missions the enemy computer players are given entire cities and armies to start with when battling human players. Moreover, Warcraft contains several asymmetric rules which make it easier for the AI player to compete, though these rules would perhaps be called outright cheating by most players.

One rule we created to help the computer AI was to reduce the amount of gold removed from gold mines to prevent them from being mined-out. When a human player’s workers emerge from a gold mine those workers remove 100 units of ore from the mine and deliver it back to the player’s town hall on each trip, and eventually the gold mine is exhausted by these mining efforts. However, when an AI-controlled worker makes the same trip, the worker only remove 8 units of ore from the mine, while still delivering 100 units into the AI treasury.

This asymmetric rule actually makes the game more fun in two respects: it prevents humans from “turtling”, which is to say building an unassailable defense and using their superior strategic skills to overcome the computer AI. Turtling is a doomed strategy against computer AIs because the human player’s gold-mines will run dry long before those of the computer.

Secondarily, when the human player eventually does destroy the computer encampment there will still be gold left for the player to harvest, which makes the game run faster and is more fun than grinding out a victory with limited resources.”

Categories
programming

SVGKit 2013 – Recipes

SVG is an awesome image format thats widely used, works in all browsers. SVG graphics make better apps and better games – and automatically “upgrade” themselves for future devices.

This post gives some simple 1-line / few lines of code recipes for using some of the main features of SVGKit – SVG implementation for iOS/OS X.

NOTE: this post refers to the 1.0.x version of SVGKit

Basic usage / installation

Install instructions are on the main GitHub page.

Basic usage / first-time usage info is on SVGKit 2013 – Usage.

Recipes

Load an SVG file like loading a PNG file

[objc]
SVGKImage* newImage = [SVGKImage imageNamed:@"imagename"];
[/objc]

Display an SVG file on-screen using an ImageView

[objc]
[self.view addSubView: [[SVGKFastImageView alloc] initWithImage:newImage];
[/objc]

…or an ImageView that supports CoreAnimation for every element

NB: the “Fast” imageview above saves everything as a single layer. Good for rendering, but bad for interaction. The “Layered” imageview here allows you to tap on any layer, rotate/animate/fade/drop-shadow/glow any element, etc.

[objc]
[self.view addSubView: [[SVGKLayeredImageView alloc] initWithImage:newImage];
[/objc]

Use a URL to load an SVG (open an SVG file *directly* from the web)

[objc]
// Splitting URL to multiple lines to make blogpost
// easier to read…
NSString* longURL = [NSString stringWithFormat:@"%@%@%@",
@"http://upload.wikimedia.org/",
@"wikipedia/commons/f/fd/",
@"Ghostscript_Tiger.svg";
NSURL* url = [NSURL urlWithString:longURL];
SVGKImage* newImage = [SVGKImage imageWithContentsOfURL:url];
[/objc]

Open an SVG from a custom source (maybe an in-memory SVG creation method)

First, create a class that conforms to SVGKSourceReader, i.e.:

[objc]
@interface MyNewClass : NSObject <SVGKSourceReader>

[/objc]

…then subclass SVGKSource, and over-ride the method:

[objc]
-(NSObject<SVGKSourceReader>*) newReader:(NSError**) error
[/objc]

Finally, use your customized SVGKSource to load your SVG:

[objc]
SVGKSource* myCustomSource = [[[MyCustomClass alloc] init] newReader:nil];

/** Other examples, using the default SVGKSource class:
SVGKSource* urlSource = [SVGKSource sourceFromURL: [NSURL …];
SVGKSource* fileSource = [SVGKSource sourceFromFilename: @"monkey.svg"];
*/

SVGKImage* newImage = [SVGKImage imageWithSource:myCustomSource];
[/objc]

Search an SVG file for particular tags / nodes / elements

SVG is an XML file, containing XML tags/nodes such as: “<svg>”, “<g>”, “<path>”, “<linearGradient>”, etc.

[objc]
NSString* tagToFind = @"linearGradient";
NodeList* result = [svgImage.DOMDocument getElementsByTagName:tagToFind];

for( Element* domElement in result )
{
// You can use the Element object directly:
domElement.tagName;

// …or, if it was parsed by the SVG parser, you can convert it to an SVGElement:
SVGElement* svgElement = (SVGElement*) domElement;

}
[/objc]

Search for sub-tags / sub-nodes of a particular tag/node

If you already have an SVGElement reference, you can search all its descendants:

[objc]
// To search the entire document, use:

// SVGElement* startPoint = newImage.DOMTree;
SVGElement* startPoint = … // from your code

NSString* tagToFind = @"linearGradient";
NodeList* result = [startPoint getElementsByTagName:tagToFind];

for( Element* domElement in result )
{
SVGElement* svgElement = (SVGElement*) domElement; // if your tags are all supported by SVGKit, they will be converted to SVGElement instances

}
[/objc]

Get a list of ALL descendant tags (from a particular node down)

[objc]
SVGElement* startPoint = … // e.g. for whole SVG doc, use: newImage.DOMDocument;
NodeList* allElements = [startPoint getElementsByTagName:@"*"];
[/objc]

Render one small part of the SVG file on its own

E.g. if you want to display a subset of the SVG, or want to export a single element:
[objc]
NSString* idInSVGFile = … // assuming your SVG file has an "id" attribute for this node
CALayer* absoluteLayer = [newImage newCopyPositionedAbsoluteLayerWithIdentifier:isInSVGFile];

// NB: "absoluteLayer" is now positioned in absolute space;
// if you add it to your window using e.g.:
[self.view.layer addSublayer: absoluteLayer];
// …it will appear in the same place as it appeared before,
// keeping all the offsets, rotations, etc
[/objc]

NOTE: there are several “newCopy…” methods, and each has different effects and outcomes. Read the method docs for each to decide which one you want to use. In a future version of SVGKit, we’d like to move these methods into a class of their own, and make it easier to see which one does what

Customise the parsing, using your own parser extensions

Create your custom class that adheres to SVGKParserExtension:
[objc]
@interface MyCustomSVGParserExtension : NSObject <SVGKParserExtension>

[/objc]
Then create a parser, INCLUDE THE DEFAULT extensions, and add your one on the end:
[objc]
MyCustomSVGParserExtension* myCustomExtension = [[MyCustomSVGParserExtension alloc] init];

SVGKParser* parser = [[SVGKParser alloc] init];
[parser addDefaultSVGParserExtensions]; // HIGHLY RECOMMENDED
[parser addParserExtension:myCustomExtension];

SVGKParseResult* result = [parser parseSynchronously];

SVGKImage* newImage = [[SVGKImage alloc] initWithParsedSVG:result];
[/objc]

Get help on why parsing failed (and warnings and line numbers!)

[objc]
SVGKImage* newImage = … // use methods above

// EITHER: parse using default parser:
SVGKParseResult* parseResult1 = newImage.parseErrorsAndWarnings; // this is a convenience pointer to (SVGKParser*).currentParseRun

// OR: use a custom parser:
SVGKParser* parser = … // use methods above
SVGKParseResult* parseResult2 = parser.currentParseRun;
[/objc]

And then you have the following info:
[objc]
/* array of NSError objects, each one a "WARNING" from the parser */
parseResult.warnings;

/* array of NSError objects, each one a "FATAL ERROR" from the parser – if your SVG didn’t render at all, this is why! */
parseResult.errorsFatal;

/* array of NSError objects, each one a "RECOVERABLE ERROR" from the parser – if your SVG didn’t render correctly, this is why! (although you probably still got to see something) */
parseResult.errorsRecoverable;
[/objc]

UPDATE: more Recipes!

For more recipes, see SVGKit Recipes part 2

(this covers answers to some of the common questions asked in the Comments below)

Categories
programming

SVGKit 2013 – Usage

SVG is an awesome image format thats widely used, works in all browsers. SVG graphics make better apps and better games – and automatically “upgrade” themselves for future devices.

This post explains how you can use SVGKit – the open-source SVG implementation for iOS/OS X in your own apps

(NB: basic installation is covered on the GitHub page – this is about how you *use* it)

SVGKit is like Apple’s UIKit

Originally, SVGKit was a bit tricky to use. I re-architected it to be an exact clone of Apple’s UIKit – same classes, same class structure, same method names.

So, we have:

UIKit SVGKit Notes
UI* SVGK* Apple’s standard: library names start with abbreviation of the library name
UIImage SVGKImage SVGKImage.h started as a copy/paste of UIImage.h
UIImageView SVGKImageView You cannot instantiate it directly, have to use a subclass
SVGKFastImageView Renders your SVG as a single layer, fast.
SVGKLayeredImageView Renders your SVG one CALayer per SVG element; you can hilight individual elements, tap them, animatet hem, etc

(a side note: We couldn’t use a classname prefix of “SVG” because the SVG spec reserves all classnames beginning “SVG”. Apple had a similar problem when they invented GLKit – the prefix “GL” was already used in the OpenGL library they were extending, so they named their classes “GLK” prefix. Hence … “SVGK”)

Loading an image

You already know how to load a UIImage, the “easy way”:
[objc]
UIImage* newImage = [UIImage imageNamed:@"myImage.png"];
[/objc]
Well, SVGKit is … the same:
[objc]
SVGKImage* newImage = [SVGKImage imageNamed:@"myImage.svg"];
[/objc]

Displaying an image: UIImageView

And how do you create a UIImageView?
[objc]
UIImageView* imageView = [[UIImageView alloc] initWithImage:newImage];
[/objc]
…so, for SVGKit:
[objc]
SVGKImageView* imageView = [[SVGKFastImageView alloc] initWithImage:newImage];
// ….. or:
SVGKImageView* imageView = [[SVGKLayeredImageView alloc] initWithImage:newImage];
[/objc]
Wait – why is this different?

The reference in both cases is an SVGKImageView – but you cannot alloc-init that class directly. Why?

Different people use the library in different ways. Some people need performance, others need detailed aniamtion. SVG’s contain a lot of bonus info, and it’s not possible to support every use case with a single class. So, you get to choose which one fits your needs

Advanced uses

So far, so easy. What about when you want more control? And how do you load an SVG over the internet (can you load an SVG directly from the web?)

Time to delve a little deeper…

Loading an SVG: in detail

There are four steps to loading an SVG (all of which are done automatically by SVGKImage above):

  1. SVGKSource: specify a location (a file, a filename – or an HTTP URL)
  2. SVGKParser: parse the file (all SVG’s are XML files, so your file can contain any custom XML you want)
  3. SVG classes: convert to SVG’s custom classes (from the SVG Spec); includes automatic support for CSS styling, cascades, etc
  4. SVGKImage: export the SVG to something Apple can render: e.g. a flat CALayer, or a hierarchy of CALayers, etc
  5. Experimental Exporter that saves a .svg file from your SVG file, including any changes you made to the in-memory DOM

Every stage is extensible, so you can either add features, or custommize it

Extend SVGKSource: adding new sources

Easy: create a new subclass of SVGKSource, and implement the two methods.

The method signatures are a little strange, because they have to support fast file-access (a C native library from Apple) as well as modern Objective-C methods.

One example of each: the supplied SVGKSource for loading from disk uses C methods, and the supplied one for loading from a URL uses Objective-C methods.

Extend SVGKParser: custom SVG files and formats

NOTE: do NOT subclass SVGKParser; parsing is very complex, and there’s a special mechanism that makes it easy to extend the parser (read on…)

Parsing is complex, so our parser is modular (based on ideas from a modular XML parser I wrote years ago). The SVGKParser class doesn’t parse SVG directly: instead, it parses raw XML, and converts it to a higher-level version that’s much faster to work with. It also manages error handling, loading bytes from an SVGKSource, etc.

You create a new parser instance with a helper method that includes all the modules you need by default:
[objc]
SVGKParser* parser = [SVGKParser parserWithDefaultParseExtensions];
[/objc]

SVGKParserExtension: adding your own custom parsing

Our SVG implementation is already split into sub-modules. This makes the code easier to maintain – and it makes it much easier to add support for SVG features one-by-one, in parallel with other developers.

Example classes:

  • SVGKParserSVG: parses “Basic” SVG – obvious things that require no special handling. NB: this is the most complex parser extension we have. Most are much simpler
  • SVGKParserGradients: parses SVG Gradients – because these were added later by a different developer (Stich) … likewise, if you’re adding a msising SVG feature, feel free to make a new parser-extension for it, it’s easier!
  • SVGKParserDefsAndUse: the SVG <defs> and <use> tags are much harder to parse than 99% of SVG, since they require complex cross-referencing and instancing. So, we use a separate parser extension to isolate this code.

For one of my games, I wanted to store gameplay data inside the SVG – attach info to particular SVG tags (e.g. give each SVG path a “bonusPoints” attribute).

To do this in a spec-compliant way, you should:

  1. Create a new XML namespace (requires no code: you simply invent a URL on a domain that you own)
  2. Put the namespace in your SVG file, using an <xmlns> tag, and give it a “prefix”, e.g. “my-game”
  3. Everywhere you want your custom attributes, or custom tags, prefix them, e.g.: “Write an SVGKParserExtension, and in the “supportedTags” and “supportedNamespaces” methods, return ONLY your namespace, and either nil, or the set of tags you’ve invented

Once the file is parsed, use the DOM to fetch your data (by definition, SVG parsers are required to be DOM-compliant parsers too)

e.g.:
[objc]
NodeList* myCustomNodes = [svgImage.DOMDocument getElementsByTagNameNS:@"http://my.custom.namespace" localName:@"my-custom-tag"];
[/objc]
(NB: NodeList is defined by the DOM, and is just a wrapper for an NSArray. If you #import “NodeList+Mutable.h”, you can access the NSArray directly, and use ObjectiveC fast enumeration. This is cheating, it’s not in the core SVG spec, which is why it’s hidden inside a separate header file)

Extend SVG Classes: the core SVG Spec

Don’t.

(the only valid reason for doing this is if you find features in the spec that are missing or broken in SVGKit. All other usages, you should be able to do in some other way, more easily, with less risk of your changes being broken when we upgrade SVGKit)

Extend SVGKImage export: export your SVG into custom rendering or to a new file on disk

All the parsed data for the SVGKImage is available to you directly, for exporting:

  • (SVGKImage* image).DOMTree : this property contains the entire parsed SVG-DOM (all the SVG* classes)
  • (SVGKImage* image).CALayerTree : this property contains the SVG converted into Apple’s CALayer classes, renderable directly in OS X and iOS
  • Additionally: “SVGKImage+CGContext.h” has methods to render the SVG into any CGContextRef you supply (or will autocreate one for you)
  • SVGKExporterNSData : creates NSData raw bytes, efficient and fast (good for OpenGL)
  • SVGKExporterUIImage : creates a UIImage instance, which you can use anywhere in UIKit

To save memory and CPU, the “CALayerTree” property isn’t created until you request it; if you don’t want the CALayer’s, they’ll never get created.

Improving SVGKit, fixing bugs, and ultra-advanced development

But SVGKit isn’t perfect: there are still missing features, bugs, etc.\

If you find a bug but can’t understand / fix it, please create a simple-as-possible SVG file and send it to us (create an Issue on the GitHub page, and include a link to the file). If you give us permission, we’ll add it to the suite of “test” images we use to verify each version of SVGKit, and that way it will always work, even with future versions.

If you fix bugs, or have bits you want to fix, please have a look at the SVGKit Development guide.

If you want support or help with SVGKit, the very best thing to do is create an Issue on the SVGKit page. That way, any of the contributors can see your problem and help you out. If you email me directly for help, you’re less likely to get a response (I’m busy, and I work on SVGKit entirely unpaid).