2D Lua Games on iPhone - iphone

Are there any libraries / frameworks that facilitate 2D game programming in Lua on the iPhone?
It looks like http://anscamobile.com/ and http://sio2interactive.com/GAMES.html are the only reasonable options at this point. Someone should create a simple Lua binding for OpenGL, AL and iPhone Events for the iPhone!

#richcollins: Actually, as of late last year you CAN test on the physical device using Corona (anscamobile.com).
If you want to check this out, download the free trial at developer.anscamobile.com, and it'll let you make developer builds for your phone.
The full version will also make App Store builds -- feel free to email support (at) anscamobile.com if you have further questions.

I'm trying out SIO2 as it apparently supports lua.
http://sio2interactive.com/GAMES.html
While it is for 3D and may be overkill for 2d it looks pretty powerful. Just make your models in 2d and fix your camera position.
--jdkoftinoff

There has been a fair amount of discussion of Lua on the iPhone on the Lua list. It appears that Apple is touchy about allowing user-supplied scripts, but has approved apps that used Lua internally as an implementation language.
I know I've seen reference to several approaches to wrapping iPhone goodies mentioned, but since I'm not personally an iPhone developer (or even user) I haven't paid attention to the details.

Related

Beginner path to Game Development for OS X and iPhone

Another question. I have been researching everything this wonderful community has offered me in terms of my journey to pursue game development.
I have come to the conclusion that I would prefer to develop on my native machine, OS X - eventually leading to the iPhone.
I already own both Big Nerd Ranch guide's, Iphone Programming - the Big Nerd Ranch Guide and Learn to Program on Mac OS X - the big Nerd Ranch Guide.
My goal that I am trying to shoot for is a game similar to Blizzard's Diablo II.
When going through these books, everything seemed a bit over my head due to lack of Objective-C experience (so I suspect).
What it the best beginner friendly way for me to reach my goals? I have been looking at Objective-C books for beginners from Apress and the like, or straight C books.
How would experienced developers such as yourself guide a newbie through this path?
Regards
edit -
To answer why I have picked the apple route, it just looks to be the most comfortable (environment is native to the machine). I may be very wrong though. I was looking at Unity, it supports C#, JavaScript and Boo. Others like Panda3D use Python. I am just not sure, it seems like the decision process has become rather challenging.
It depends on the kind of game you're making - but many of the top games on iPhone were created with an open-source framework called cocos2d. It is fabulous, simplifies everything, has great tutorials and is available specifically for the iPhone.
Check it out at:
http://www.cocos2d-iphone.org/
I would recommend you
a) learn the basics of C (especially memory management)
b) learn the basics of Objective-C
c) learn the iPhone SDK from a book (I liked "Beginning iPhone Development" and its 2nd volume)
d) pick any project you find interesting and that is not too challenging and just code. You will find that by the time you are done, you probably think the things you did first are horrible, but you will learn a lot in the process
e) visit Stackoverflow.com as often at possible, it has most of the answers to the questions you will have :)
If you're working on a Mac, then things get interesting.
The largest game markets by several orders of magnitude are consoles and Windows. If you're just targeting the iPhone and OSX, the Mac is ideal for development. However, this is a limited (Mac OS), VERY competitive (iPhone) market. If you want to make something that will become a real product with real sales, limiting yourself to OSX from the starting gate is probably a mistake.
If you're just starting out and want to learn what makes all this game crap tick, stick with the language and OS that you're most comfortable with. Introducing too many variables into a learning expedition is a significant ingredient in failure. One of the nice things about this sort of app is that the algorithms and techniques you'll pick up are inherently cross-platform. Matrices are matrices, whether you're working on a TI-89 or an Alienware desktop.
However, if this is the case, try and remain aware of what platform-specific widgets you're using in your code. Plan to throw this one away. Write a bunch of test apps. And, when you feel confident that you're ready to build something real, you'll be ready to break out a VM or a new desktop with Windows (I LOVE XNA), C++ with DirectX or OpenGL, or whatever, and the variables, the new material you have to learn, won't be about graphics or math or gameplay, but about the platform itself.
Writing "Hello, World!" is a lot easier if you're not figuring out what you're trying to say, but only how to say it.
Also, rather than aiming for a Blizzard clone, start with something dirt simple, like Pong. Then make 3D Pong. Then add gravity. Then collision detection. And so on.
Also check out gamedev.stackexchange.com when you have game dev-specific questions. It's a LOT lower-traffic than SO, and a lot of the participants are teenage fanboys, but there is good knowledge there ready to be tapped.
You can develop a small game for the iPhone quite quickly once you've mastered Objective C and the iOS APIs. It took me about 4 weeks to develop a small iPhone-only game with limited game logic. Here's a writeup of my experiences:
http://corrino-software.com/how_long_does_it_take_to_make_an_iphone_game
However, something like a Diablo-style game would be a massive project. As David says, you're better off starting with something smaller and more managable to begin with, then you can move up to larger projects once you're comfortable with the development process and familiar with the tools and libraries you'll need.
If I were you, I'd start out with C, learn the fundamentals of programming, algorithms, and memory allocation (incredibly important concept in C). Then, you can move up to reading some books on Objective-C and get an idea for object-oriented programming and higher-level concepts like dynamic typing, garbage collection, etc.
As for software, if you're on OS X you want to get XCode, which is an integrated development environment developed by Apple for developing for iOS and OS X. Apparently, it's a free download (though that's just what Apple says on their website, dunno, I don't have a Mac).
As for books, etc. I'd just get some straight C books and look at some tutorials. Read them from cover to cover, and pay special attention to the important (and frustrating) concepts of memory allocation and management and pointers.
I find that a good way to learn a new language is to start with replicating common command-line tools like wc, grep, ls, etc. This will teach you the basics of I/O (both file and stdin/stdout) and some basic string parsing, as well as other goodies here and there. Additionally, you have a deterministic method of determining whether your program does it right or not, since you can easily compare to the standard command's output or behavior.
K&R, as well as Programming in Objective-C 2.0, are good places to learn the basics of C and Objective-C.
Once you have the basics of the language down, start with basic GUI programs (the ones in Hillegass's book are a good start). Once you can hook a basic GUI on the front of some underlying logic, it's time to start thinking more seriously about your game. Hillegass's book has a basic intro to using NSOpenGLView, which you can use to manually draw in 2D and 3D. It's important to note that when going through the examples in any book, you'll want to thoroughly understand what they're doing and how they're doing it, enough so that you can make some modifications yourself to enhance/change the behavior of the sample program you're working with.
Once you understand the basics of how your underlying game logic can hook to something the user can see, it's time to go find a game/drawing library that will get you where you're going. You definitely don't want to write all of the graphics routines yourself for a game similar to Diablo.

Any other game SDK besides CORONA for the iphone/ipad

Does anyone know of another good game SDK/Engine for the ipad or iphone other than CORONA?
Have a look at Cocos2d
Well since you didn't mention you need it to be free, I'd cast unity into consideration.
It's as powerful as it is expensive ;)
The above answers are great possibilities. I highly recommend unity as it just came out with its newest release that offers a gajillion wonderful features like batch rendering, beast lighting, etc. Its also ridiculously easy to program (im surprised there isn't a 'make this game for me' button in it). The price is worth it. By clicking a button, you can publish your game to pc, Mac, web, iPhone, iPad, xbox, wii, ps3, or android, depending on whether you purchased the license for each. It' bloody magic. Keep in mind that you need to buy the unity pro license before you buy the iOS license. One does not work without the other. It'll be a total of around 3 grand USD, but again totally worth it. Community is rad and helpful too.
If you're going the free route and have some coding chops, I'd run with openFrameworks. It's a c++ wrapper of the iphone sdk and has a very low learning curve. OpenFrameworks was created for artists who wanted to make interactive installations and art games but couldn't get really deep into objective c. Check out zach gage's work (stfj). He made bit pilot, unify, synthpond, and sonic wire sculptor all in open frameworks. He's also releasing his best yet very soon for the iPad. My own company is using oF (openFrameworks) for it's new game releasing this coming Saturday. Try it out. I guarantee you'll find something you love about it.
Good question. For very specific gaming needs, PhoneGap is worth a look. But considering it's JavaScript/ HTML/ CSS, it will not be as fast as the (IMO terrific) Corona. But if your game is in any way more page-related than sprite-animation related, give it a look. I created most of the games at VersusPad.com using PhoneGap, but now switched to Corona.

How hard is iPhone/iPad development

I've been developing for quite a while but while I consider myself competent (or better) with C++, Java, C# & AS3/Flex in areas from web-servers to desktop applications to 3D games, I'm aware all these languages are pretty similar; even on the libraries side I know what to look for based on using libraries that do similar things in another language.
But Objective C I understand to be a different kettle of fish, and developing for mobile devices has always struck me as likely to be hard work since you have to develop on your PC and test on the actual device itself - my experience developing for PS2 put me off such things due to poor debuggers and other tools.
What's the reality? Is it a paradigm shift to move from web-servers and desktop apps and rich web-clients to iPhone... or for an experienced developer is it just another language to learn and new libraries to play with? Is there anything to be scared about at all?
edit: My main question on Obj-C specifically was if it's a different way of programming, like it would be moving to Haskell from Java for instance. It sounds this is not the case.
For starters, ObjC is fairly easy to grasp so long as you focus on the fundamentals. Don't worry about the syntax, there's not much there above C which I will presume you already are familiar with. There are excellent books out there this book is the definitive guide I recommend to most new users, Erica Sadun also has a good book on iPhone development, I recommend both of these highly.
Secondly, the tools aren't hard to use, and you will be pleasantly surprised with the debugger and other tool integration. Instruments was a long time coming, but it's indispensable for catching things like memory leaks, cpu time usage, and now power consumption.
But really, nothing to be scared about, and as for another platform to learn; well, yes and no. There is always going to be another thing to learn, regardless of iPhone or something else. Don't resist. :)
There's definitely a "paradigm shift" (ugh, buzzwords):
You don't have all the memory in the world (and there's no swap either)
You don't have all the CPU time in the world
You probably don't want a binary bigger than about 20 MB (the size that can be downloaded over the cell network)
You can't just change the server backend to make things right.
Graphic design is important if you want to be successful (but you don't want to bloat your app)
Web requests take a while (a website with redirects feels really slow compared to the desktop beside it).
JavaScript animations are painfully slow (ever tried the Google Maps website on an iPhone?)
UI design is heavily constrained by the size of the user's finger (even though the iPhone 4 has a comparatively huge screen).
UI design is really tedious.
The user can do more things than clicking and typing.
I find that the biggest difference is in the UI, not in the language. Languages are easy. Libraries require a little reading/searching/asking around, but then they're easy. UI design and UI programming are very difficult to do well.
Objective C is different but not far removed from normal OO methods. The syntax was the larger barrier for me.
The problem I saw was/is you learn ObjC for iPhone, and you can't take the skill (ObjC knowledge) outside the Applesphere really. I haven't seen a use for it. I have a handful of books I went through to get my feet wet. Some of these, the Apress books, contained errors in the code walkthroughs causing me to Google the book errata countless times.. so be careful of that, if you learn that way.
Also, unless this has changed, you can only develop under OSX with the SDK tools because no Windows version exists to my knowledge.
With that, you also have to play by Apples development rules to get published into the AppStore, which has had its share of dev horror stories.
That said, a working app is fun and beautiful in the end.
On a scale of 1 to 10, it's about a 6.
Apple does use Objective C and it is different then normal C. So Iphone and IPad development can be hard if you've never used Objective-C before. If you are familiar at all with a language called SmallTalk, then Objective-C will be very easy for you to pick up.
Now other mobile devices, such as Android, uses Java. If you are competent in Java then Android development may be easier for you.
Some devices use Windows Mobile. If you are a .NET programmer, you can use .NET compact framework to develop Windows Mobile Apps.
Just so you know too, most mobile SDKs come with an emulator to test your app on. So if you don't have an iPhone, for example, you can still test your app with the emulator. I understand that the emulator is supposed to be 99% as accurate as an actual device
I don't think there's anything to be scared of.
The simulator's pretty alright, even if it can't handle some things - it's hard to simulate the accelerometer, for instance!
Once you're over the hurdle of figuring out what certs you need and setting up the iPhone development account and such, it's fine.
It's a bit of a pain writing something, loading it on the device, trying it out, etc., but the fact that you can actually debug the code running on the device makes it rather a lot nicer than it could be. (I had to maintain an application for the Nokia 9110, and there I had to edit, compile, load, run, crash blindly, stare at code, guess, edit, compile, etc.)
As a long time Windows C++ / .NET developer, I didn't find it very difficult to begin developing in Objective C.
There are some syntax differences that take some getting used to, but in general it similar enough to C/C++ to not feel like a completely new language.
Learning the library code and what you can and can't do easily seems like the larger challenge to me, which is going to be a challenge with any new platform.
I am writing a beginner book called Hello! iPhone, and I've made a mailing list of beginner tips to help people get started. After a week or so of tips, you'll be much more equipped to check out other books and understand the basics a bit better to judge.
http://loufranco.com/beginner-iphone-programming-tips/
It will take you through Hello, World and some other simple stuff (Outlets and Actions, basic memory management, etc).

Quickest way to get started with OS X app development?

I need to build an application which will run on OS X, polling for data, and displaying that data full-screen in a purty, graphical way - generally "identifier: value" text in some sort of tabular format, but possibly with spark-lines to display historical changes, and "animations" (nothing fancy, just fading text and similar) to show updates.
However, I've no idea where to get started. I've no experience with desktop application development or development on a mac.
Where/at what should I be looking for OS X development information which will get me quickly up-to-speed (coming from a web-dev background)?
For OS X development, and a really nice overview that will get you writing actual applications quickly, I'm not sure anything can match Aaron Hillegass' book, Cocoa Programming for Mac OS X.
It's considered by many to be the Bible of Cocoa programming, and it is example driven. You are writing applications that you can actually run throughout.
It is useful, although not as much so, for iPhone development, which you don't mention in your question, but you do in your tags.
If you really want to go native with OS X that will mostly mean learning Objective-C and Cocoa. You get started by becoming an Apple Developer Connection (ADC) member and downloading XCode. Inside the ADC site there is a lot of information that will help you get started, Objective C reference, sample code, etc. .
Depending on your background you might want to consider using Adobe Air for your application, if you know Flex or Flash that might be easier for you to learn.
There are also a couple of question already up on stackoverflow on this subject https://stackoverflow.com/search?q=learn+cocoa
Take a look at http://www.realsoftware.com. It's a cross platform development environment. Easy to learn, established user community, lot's of sample, shared code to get you started.

Is it feasible to make iPhone apps using just OpenGL and not Cocoa Touch?

I'd much rather code an app using pure C api such as OpenGL, rather that Cocoa Touch. So I'm wondering: is it feasible? Will I be able to maintain the same user experience that you get with Interface Builder?
None of the UI components have OpenGL equivalents. Is it possible? Yes. Is it sensible? No - you would be much better off learning how to use IB and the UIView classes. Coding the UI in OpenGL would be like painting your house with an artist's brush, using hand-made paint instead of Dulux.
Unless you are working on a game, users will expect your user interface widgets to work the same way they do in other applications. You can never emulate that properly, especially if apple decides to fix certain issues in future firmware upgrades, etc...
You will also need Cocoa for integrating with the system in general to store data, prefs and so forth. Is there any specific reason for your reluctance to use Cocoa? If it's because you feel an aversion to learning objective-c, then you really ought to give it a proper chance. It's a great language for building ui apps. If you are trying to port an existing app, then I would suggest building a wrapper that will interact properly with the iphone and call your c code from there.
This is not a fruitful answer (for that, see AirSource's) and rather a comment on your answer about not using Objective-C, but I learned Objective-C a few months after C# and I find I work well in both. Give it a chance and it will surprise you. There's a learning curve and they are different, but the interface tools in particular are so far ahead that you'll probably find it worth your while. It will definitely be better for you and for your app's users than hand-rolling it in OpenGL.
Depends on your app. Mine's an "immersive" game, so I'm using openGL
instead of CocoaTouch,
with a sprinkling of Core Graphics/UIKit calls to generate nice textures.
If I had to display any kind of standard, non-trivial widget, I'd use CocoaTouch.