How to get Samples folder contents working in Xcode?

Discussion about using Moai SDK - post questions, bugs and issues here.

Moderators: seebs, franciscotufro

How to get Samples folder contents working in Xcode?

Postby dissidently » Tue Jun 14, 2011 7:39 pm

Keep in mind, please, I'm a designer, not a programmer.  Xcode is like iTunes on acid for me.  I'd like to get down and dirty with Lua and Moai, despite Xcode, not because of it.



I'll go through the steps I'm using so far, to see if I'm doing something wrong… the attempt is to open any and all of the samples and then run them on an iOS device.  However I can't currently do it:

Download Moai SDK from github.  Unzip.  Open.  Find this:

Xcode Folder in Beta Download

selected the highlighted Xcode Project, and double clicked to open it in Xcode.

After a long indexing period, the files listed in Xcode look like this, after I dive in and find the inherent sample to this structured project.

file structure in first iPhone project

Assuming this is the file of this inbuilt sample, I click on Build device options and get this slightly baffling array of choices.

build device options

Assuming anything in the first group is right, I choose the lowest common denominator, the iPhone 4.0 Simulator.

Clicking on "Run" results in some 800 odd files getting compiled.  A lot more than makes any sense to me, but assume this is the SDK doing it's thing.

The device simulator opens, the cat picture spins.  And the simulator wants to connect to the internet to find out where it is.

success.

Right!  That felt good-ish. 

Now there's this other folder in the Moai SDK download full of Samples.

Sample Apps Folder

So here's my question.  What do I need do to go through each and everyone of these samples… running them on the simulator or device now that I've done all the above?
dissidently
 
Posts: 36
Joined: Sat Apr 23, 2011 8:37 am

How to get Samples folder contents working in Xcode?

Postby patrick » Wed Jun 15, 2011 3:37 am

Thanks for the detailed post. Right now there is only one target being built by the iPhone reference project - MoaiSample. The Lua files you found in the project tree's 'lua' folder are copied into the app bundle when the target builds. To build the rest of the samples, there are a few approaches:

The simplest is just to remove the files and resources under the 'lua' folder and replace them with the files and resources from the sample you want to build. The iPhone sample host always loads 'main.lua' from an app resource folder called 'lua' so whatever you drop in there should be the sample you'll see in the simulator. All of the samples should run this way, but do be aware that some of the samples are still desktop-only from an input perspective.

A more sophisticated way to build the samples is to create a separate target for each sample, add all of the lua source and resource files you care about to the IDE and edit the membership of those files. So you'd wind up with multiple app targets (FooApp, BarApp, BazApp) and separate resource folders for each. The app host code would be shared by all app targets, but the lua files would be included in each target independently. (You can change a file's membership in a target when you add the file, by using 'get info' on the file or a group of files, or by editing the contents of one of the target subfolders.)

We're going to be stepping up support for the reference hosts on key platforms as the project matures, but we still recommend that developers take ownership of the host app for their projects. So everything under the 'moai-beta/src' folder is part of Moai and officially supported by us; the code for the host apps is intended as sample code that provides a minimalist implementation for each platform. The typical approach for a commercial title is to make a copy of the sample app (code and all), add the lua scripts and resources for the game and customize from there. To give you an example, one of the more advanced studios using Moai customized the host app to transition between multiple Moai runtimes, download customized game content from their servers and do things like overlay the Moai view on streaming video to inject interactive game elements into their animation.

For just learning Moai, an easier path might be to build the OSX or Windows desktop host. Since the desktop hosts don't need to have resources and scripts bundled in with them it is much easier to point them at the different samples to run quickly or experiment with. There's a Windows binary installer that installs a pre-build host and adds it to the system path so you can easily run any of the samples with a double click of a batch file. We'll be releasing something similar for OSX later this month.

...

One more thing - don't be baffled by the large number of files that have to be compiled when you build the engine. Moai relies on some open source 3rd party libraries that are pretty enormous. Notably, openssl (libcrypto and libssl), libcurl and freetype all contribute hundreds of source files to Moai. The good news is that once those are built (for a given platform), you shouldn't have to rebuild them if you only want to change your script files or host app. If your main goal is to just use Moai as an engine, then the upcoming binary release for OSX and iPhone will solve that: you'll have a desktop executable and a set of static libraries you can link to that will include everything you need; you won't have to build anything but the half dozen or so files that make up the iPhone host itself.
User avatar
patrick
 
Posts: 589
Joined: Sat Apr 02, 2011 10:50 pm

How to get Samples folder contents working in Xcode?

Postby dissidently » Wed Jun 15, 2011 4:42 pm

Patrick THANKYOU!  I'm now plugging my way through the samples.  Not on the desktop app.  Definitely not on windows.  I'm ALL about the device, iOS devices, and how things look on them.  It's a designer thing, let's not call it visual thinking because  "visually retarded" might be more accurate.

I want to see how it looks, immediately, always.  I don't expect you, a logically thinking and highly knowledgeable programmer to understand my "visual retardation" and constant aesthetic considerations.

Programmers and designers live on opposite ends of the sanity spectrum ;)
dissidently
 
Posts: 36
Joined: Sat Apr 23, 2011 8:37 am


Return to Moai SDK

Who is online

Users browsing this forum: No registered users and 0 guests

x