Topic: iPhone publishing

Yesterday I started working on a xcode example showing how to use Maratis Engine for iPhone, it's not very complicated but as I'm not used to iPhone programming, it still need some work, here is the first test, still only fixed pipeline and no sound, but it should be good soon :

http://www.maratis3d.org/wp-content/uploads/2011/03/iPhoneJules.jpg

Work is mainly creating iPhone context and finding an alternative to DevIL and libsnd (LGPL). As I don't have any iPhone (and don't want), this example is using iPhone simulator.

See you soon,
Anaël.

Re: iPhone publishing

iPhone is the best platform for indies to publish imo
Great news smile

Re: iPhone publishing

Fantastic! I can't wait to see how you progress with this.

Will you be able to upload the Xcode example for us to tinker with?

Re: iPhone publishing

yes, i didn't find the time to continue since this post, so it's still missing the sound and the touch input, but if you don't mind testing the in-progress version, I will post it tomorrow.

Re: iPhone publishing

Cool,

Thanks for the reply.

Looking forward to tinkering with it.

Re: iPhone publishing

You can find the current xcode project in SVN branches/iPhonePublishing/ :

http://code.google.com/p/maratis/source … Publishing

Re: iPhone publishing

thanks!! I will also try, it looks very interesting!

Re: iPhone publishing

Cool!

I can't find Common/MLoaders/MiOSImageLoader.h and Common/MLoaders/MiOSImageLoader.cpp. Where can I get these files from? I'm going to try for using MDevILLoader next.

Re: iPhone publishing

Hi,

sorry, I just checked and I probably forget to commit it on svn,
I will send it again. Thanks for reporting.

[EDIT] That's done, check again on svn.

Re: iPhone publishing

Thank you so much! It worked!

iPhone4

Last edited by sakamoto (2011-04-20 23:29:54)

Re: iPhone publishing

smile wonderful !

Re: iPhone publishing

Anael,

First of all, great work, I feel this has the potential to evolve into something very special and unique. I like the flexibility you've built into it and how easy to understand the code is.

I was playing around with the iOS version yesterday and I made some improvements (mainly making it universal for iPhone/iPad/iPod) and a few other tweaks. I was wondering how I could contribute back to source so everyone can enjoy this.

I was planning on working on input this weekend. If this is something that would also help you, please let me know.

Thanks,
- Ricardo

Re: iPhone publishing

Hi Ricardo,
thank you very much, it will be very nice to have your improvements in the source !
You can send me a SVN patch, or if you are interested in contributing regularly, I can create an account for you on SVN.

The two next steps to finish an ES1 version are :

- the inputs :
By feeding the MInputContext (MEngine::getInstance()->getInputContext()) with touch data)

- The sound loader :
Which need to be written using another lib or manually (libsndfile used in PC/MAC is under LGPL and cannot be used on iPhone because of license issues). I wrote a native image loader using iOS functions, but I'm still hesitating for the sound, iOS sound loading is not very clear.

Thanks,
Anaël.

Re: iPhone publishing

Anaël,

I wouldn't mind having an SVN account and contributing regularly.

I'm planning on making some improvements (of course adding touch controls), and I'm pretty sure you would like those. I could also add motion (accelerometer/gyroscope) input.

I also want to create an exporter for Maya or XSI SoftImage to make it easier for our project and help out other people that need it.

Let me know what you think.

Thanks,
- Ricardo

Re: iPhone publishing

Very good !

I will be happy to have you in the team,
I'm sending you a mail.

Thank you,
Anaël.

Re: iPhone publishing

skumancer added multi-touch and accelerometer support to the iPhone publishing example and to MSDK,
updates on svn : http://code.google.com/p/maratis/source/checkout

Thank you a lot smile

Re: iPhone publishing

Hi,

I checked out the latest from svn and am able to compile the example.xcodeproj and install it on my iphone. I'm also able to change which level is loaded by altering the "Start file=" line in Demos.mproj and recompiling. So far so good!

What I can't seem to figure out is how to use the accelerometer or touch input. For example, I'd like to be able to tilt the iphone or touch the screen to pilot the car in Physics.level. Is there a magic incantation, a predefined variable I can use in the script to access these iOS inputs?

Thanks for any help.

-Zach

Last edited by dybbuk (2011-06-09 04:06:43)

Re: iPhone publishing

A look through the code led me to think "ACCEL_X", "ACCEL_Y", and "ACCEL_Z" might store accelerometer values, so I changed Text.lua to the following:

-- get objects
Text0 = getObject("Text0")
Text1 = getObject("Text1")

-- scene update
function onSceneUpdate()
    

mx = getAxis("ACCEL_X")
my = getAxis("ACCEL_Y")
mz = getAxis("ACCEL_Z")

    text = "x = " .. mx .. ", y = " .. my .. ", z = " .. mz
    setText(Text0, text)

    text2 = "testing accelerometer input"
    setText(Text1, text2)

end

Installation of the Text project on the iPhone results in a blue screen with no visible text. Maybe either the font's not rendering, or some other problem has occurred?

Thanks for any help or info.

Re: iPhone publishing

A look through the code led me to think "ACCEL_X", "ACCEL_Y", and "ACCEL_Z"

yes, there is also new lua functions for multitouch : "getTouchPosition(id)", "getLastTouchPosition(id)", "getTouchPhase(id)"

getTouchPhase return 0 to 4 :

0 : Begin
1 : Update
2 : End
3 : Cancelled
4 : None

About text, we have not been able to link freetype to ios yet, but the maratis binary font loader is working,
when loading a font (ttf) using Maratis editor you'll see that a ".font" file is generated, use this file to replace the ".ttf" file.

This will be automated in the future.

Re: iPhone publishing

Interesting. Thanks for the info!

I opened the Text.level file in Maratis and changed each text item to use GenR102.TTF.font instead of GenR102.TTF. They looked fine in Maratis, but again are invisible when compiled into an app with xcode and sent over to the iPhone.

After switching the text items to use the GenR102.TTF.font rather the .TTF, I tried duplicating one of the text items in Maratis. I moved the duplicate and noted that it was not visible -- the .font not rendering? I changed that text item to use the .TTF and it appeared, I then changed it back to use the .font and it remained visible. I'm not sure what this means.

I suppose if I can't get the text generators to work on the iPhone, maybe I can store the sensor input in variables in lua and somehow pass them to an NSLog command and read them in the xcode console? Though eventually I'd love to be able to display text, right now I'm just trying to see what the sensor values look like so I can decide how best to use them.

I'm impressed by the power built into Maratis and hope I can figure it out. The rendering speed and built-in physics engine are great. I'm curious whether anyone has developed apps that are available on Apple's app store using it.

Thanks again for developing Maratis, and for all your help.

Re: iPhone publishing

Thanks smile

I saw that the .font loader is not added in the iphone project, i'll update svn when i have some time,

EAGLView.mm is missing 2 lines of code :

"#include <MLoaders/MBinFontLoader.h>" (it's commented)
and "engine->getFontLoader()->addLoader(M_loadBinFont);" (to be added in initRenderingContext after "mesh loader")


The files MBinFontLoader.h and MBinFontLoader.cpp maybe also need to be added to the xcode project.

Re: iPhone publishing

Ah, I'll try adding those lines and files.

Is there a list somewhere of what Maratis features are and aren't yet supported on iOS? I'd be happy to start compiling one.

TTF font loading would be on the not supported list.

The StandardRenderer is also not supported in iOS? I got an error when I changed "FixedRenderer" in EAGLView.mm to "StandardRenderer".

Re: iPhone publishing

Hmm, I suppose I could try uncommenting "//engine->getRendererManager()->addRenderer(MStandardRenderer::getStaticName(), MStandardRenderer::getNew);" and see if the StandardRenderer works in iOS. I'd have guessed it was commented out due to incompatibility, but maybe not?

Re: iPhone publishing

I'm guessing the getTouchPosition(id)", "getLastTouchPosition(id)", "getTouchPhase(id) commands in iPhonePublishing aren't yet committed to svn, as I searched through the code for those strings and find nothing. I did see that a touchPoints dictionary is created in EAGLView.mm.

Re: iPhone publishing

After adding those bits, the .font loader is indeed working.

This bit of code in my Text.lua now displays the accelerometer data.

mx = getAxis("ACCEL_X")
my = getAxis("ACCEL_Y")
mz = getAxis("ACCEL_Z")

    text = "x = " .. string.format("%.3f", mx) .. "\ny = " .. string.format("%.3f", my) .. "\nz = " ..  string.format("%.3f", mz)

    setText(Text0, text)