What's going on

This is a new forum that can be used to discuss anything that's not directly related to JPatch.

What's going on

Postby sascha » Sun Nov 15, 2009 10:48 am

As I've mentioned earlier, I've put JPatch on hold until next January.

I've plenty of non-computer-related stuff to do, but I've also started to work on a (more or less commercial) short term project, which should be finished by then. It's a game for the iPod touch/iPhone that I'll try to sell on Apple's App-Store. This has been hyped a lot, with reports of developers who spent half a year developing applications that don't sell well, while others spent merely 2 weeks writing some silly app that's selling 100.000 times. Well, I don't care much about rumors, so I've decided to invest a month or two of my spare-time into this and see how it works out.

The dark side of the force is strong, I know... But don't worry, I consider this an experiment with an expiration date. I'll be back fighting the empire right afterwards :-).

There's little real information available about app-store sales, so I intend to kind of "blog" about it and post some real life figures about how much time I've put into it and how well it sells.

This is quite an expensive hobby, you need a Mac and an iPod touch or iPhone, and if you wan't to test your applications on the device, Apple charges $90 per year for their "developer program" subscription. At least they know how to make money!
On the other hand, the platform is really cool. It has a very powerful GPU, and it's incredible what you can do with OpenGL ES on this little screen. Objective C also seems to be a really nice language. It's kind of a mix between Java and C. The object oriented features are much more Java-like than C++ (in spite of the strange syntax), but it's just an addon to C, so if you like to access the bare metal for performace, you can just code in plain old C. Even Cocoa (the framework formerly known as NeXT-Step) uses this - most things are objects, but e.g. 2D Points are C-structs, so you can create them on the stack as well (objects, like in Java, are always created on the heap). There is a garbage collector, but there are other, more efficient ways to do memory management, like reference counting with something called "autorelease pools", pretty clever.
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria

Re: What's going on

Postby sascha » Sun Nov 15, 2009 11:10 am

I bought the iPod because of its large screen and because of iTunes-U. You can watch thousands of lectures from hundreds of universities (for free!) via iTunes-U, and since I've got to use public transportation to get to work every day (which takes me 45 minutes to get there and 45 minutes to get back), this way I can spend that time more "productive" than reading or listening to music. The MIT has some excellent material available, I'm now half the way through calculus, linear algebra and physics ;-)

Now about the Game I'm writing: I had a half finished Java version of this on my hard-disk, and didn't quite know what to do with it. I've never intended to sell it, and it wasn't even spectacular enough to put it on sourceforge (it wasn't quite user-friendly, and lacked menus, sound, etc.)

Along comes the iPod. I've downloaded some free game-demos and though hey, cool graphics. So I did some research and found out that it supports OpenGL-ES. This lead to the idea to convert what I had to C (the OpenGL calls pretty much stay the same anyway) and see how it performs on the iPod. And well, it looked gorgeous. So I though I'll finish this and try to sell it for ¢99 or $1.99 in the App-Store, basically just for fun, but also to see what I can expect from App-Store sales. If it goes well, I might write some more stuff for that platform, if not, at least it's been fun.

It's almost finished by now, I'll let you know more later...
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria

Re: What's going on

Postby pndragon » Mon Nov 16, 2009 2:36 am

More power to you. I'm only sorry that I don't have an ipod or that one isn't even remotely close to being in my future. (I may be the only one of my boardgaming and programming friends who doesn't have this device). As for the Dark Side... anyone who says that money doesn't matter can't figure out how to get paid. It matters very much, especially when you have a young family.

--- Jim
"We're so sorry, Uncle Albert,
But we haven't done a bloody thing all day."
--- Paul McCartney
pndragon
 
Posts: 591
Joined: Sun Dec 05, 2004 1:27 am
Location: North Carolina

Re: What's going on

Postby dcuny » Tue Dec 01, 2009 3:43 am

Two of my co-workers are developing applications. The force is strong with this platform, indeed.

I also haven't got an iPhone, but my kids would love to have an iTouch. When we go to the mall, they like to go to the Apple store and play with them. :)
dcuny
 
Posts: 2902
Joined: Fri May 21, 2004 6:07 am

Re: What's going on

Postby sascha » Wed Dec 02, 2009 11:33 am

I also don't have an iPhone, but I've got the small (8GB) Version of the iPod Touch - mostly to watch iTunes-U video lectures when I'm on my way to/from work (by subway, not by car! ;-))
It's an amazing piece of technology, and when I saw it's raw OpenGL-ES power, I couldn't resist and started to port something I had done in Java/JOGL before over to C and OpenGL ES. The 32GB version even supports OpenGL ES2.0 (shaders!)
I also slowly begin to understand why C folks don't like Java...
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria

Re: What's going on

Postby pndragon » Thu Dec 03, 2009 5:14 pm

I also slowly begin to understand why C folks don't like Java...
Why? Inquiring minds (specifically, me) would like to know. I was unaware of a problem.

--- Jim
pndragon
 
Posts: 591
Joined: Sun Dec 05, 2004 1:27 am
Location: North Carolina

Re: What's going on

Postby sascha » Sat Dec 05, 2009 12:08 am

There's nothing wrong with Java, well, but...
Especially when you're dealing with 3D graphics there's a lot of linear algebra involved, dealing with points, vectors, matrices and stuff.
Let's take a 3D vector for example, you'll have a class like this:
Code: Select all
class vector {
    float x, y, z;
}
with some methods in it to add, subtract, multiply, scale, etc. those vectors.
Now the problem in Java is that the language only knows primitives (float, int, etc.) or full-blown objects. Forget about the memory overhead of objects (with 4Gig of RAM you don't really care about an 8 byte object envelope), but it's memory management that concerns me.
All Java objects are allocated on the heap (and have to be garbage collected later). So even if the garbage collector is optimized for collecting huge amounts of small objects in virtually no time, you still have to allocate the memory.
In 99 of 100 times this is no big deal, but if you have a loop and have to, I don't know, add a million vectors, or compute their cross-product, etc, this does hurt performance.
In JPatch I tried to reuse objects as much as possible, but sometimes this won't work, so to not allocate a million temporary objects just to throw them away a microsecond later, I often had to fall back to primitives! Instead of Vector v = new Vector(1,2,3) the code reads like float vx = 1; float vy = 2; float vz = 3 (local primitive variables are always located on the stack, so there is no need for malloc or garbage-collection, just like in C.) And if I need the cross-product, I'll have to copy-and-paste the one liner that takes six floats and computes a vector cross product - and that's really ugle, lot's of duplicate code, no good OO design, but the language leaves you no choice.

Enter Objective-C: The designers of this language have been pretty clever. Objective-C objects are much like Java objects, and they're too always allocated on the heap. But the language allows you to use C structs. Now if you need a struct outside of your method, you still can malloc the space it needs on the heap, but if you only need it temporarily, you can too just use it as a local variable, which is allocated on the stack. If you take a closer look on NextStep or Cocoa, you'll find that the framework also takes advantage of this. Simple things like 2D or 3D points are no full-blown objects, but C structs, exactly for that reason.

I know that Java does a lot of optimization, so it might be not as bad as calling malloc(sizeof(vector)) a million times in a loop, but still, even the best performance hack the Java runtime might have implemented won't beat using the stack.



That, and well, I finally can pass an array over to OpenGL and don't have to mess with Java byte-buffers.

I really like Java and I still do the majority of my work in Java, but one has to keep an open mind, and for some tasks, other languages are simply better suited. What's really cool about Java though is the huge framework, which contains almost everything you'll ever need: GUIs, sound, 2D-Graphics, multithreading, math, image-IO, networking, HTTP, XML parsing, etc - all portable and cross-platform - There's nothing out there that comes even close to that.
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria

Re: What's going on

Postby pndragon » Sun Dec 06, 2009 6:03 am

Thanks for the explanation. Those all seem like good reasons to prefer to C. I don't see myself finding the time to learn it any time soon---without even the excuse of a paying job to go to.

--- Jim
"We're so sorry, Uncle Albert,
But we haven't done a bloody thing all day."
--- Paul McCartney
pndragon
 
Posts: 591
Joined: Sun Dec 05, 2004 1:27 am
Location: North Carolina

Re: What's going on

Postby sascha » Sun Dec 06, 2009 5:53 pm

As a general purpose language I still prefer Java.

You'll almost automatically get a good object-oriented design and pretty save, readable code.

For low level things (and I'd consider OpenGL low-level), C kinda makes more sense though.
It's not that it's impossible to do with Java, but in this case the language's features more often get in the way than be of help.
sascha
Site Admin
 
Posts: 2792
Joined: Thu May 20, 2004 9:16 am
Location: Austria


Return to Off topic

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron