iPhone to Flash porting - iphone

I need to port an existing game written for the iPhone to Flash. The iPhone game is mainly written in pure C rather than Objective C.
I'm wondering if there are any good tools for converting the C code to Actionscript directly, or in general if anyone has some advice on how to do this porting in an efficient way given its C based source code?
Since the game will keep getting updated with bugfixes etc, a method allowing rapid conversion of the updated game code to Flash so that only one code base would need to be maintained would be optimal.

Take a look at Alchemy. This might be what you want, but I suspect you will have issues simply compiling on different compilers since the user-input differs immensely between a flash game and an iphone game.

Related

Iphone game dev, c++ / mac comparison

Hey guys, I've done some research but still unsure.
To get into IPhone Game Dev properly do I need to use Objective C rather than C++ ? I'm happy to invest in a mac mini and want to make sure I'm using the same systems/platforms professional Iphone Dev's use. Are most of the tutorials out there in Objective C E.T.C?
Cheers!
it's totally up to you. If you decide to write your own game engine you can do it in Objective-C or C++. IMHO there is no single proper way to do game dev. I use mac mini and do parts of my coding in c++ if I find that easier than coding in Objective-C. After all you don't want to mix engine stuff (probably using opengl) with ui stuff so your code gets separated anyway. It honestly doesn't matter what is the language of your game engine as long as you can use it on idevice and are comfortable writing in.
So to sum up, you don't have to cling to one language. Write your UI in objective-c and prepare the environment to use opengl and then write your engine in c++ if that suits you.
The fact that OpenGL ES is written in C means you can use C, C++, Objective-C or Objective-C++ to write your game engine. So use what you're comfortable with.
Many of the books that I've seen out there assume C++, but as I say, you can do your engine in anything of the above.

Actionscript 3: Any way to get data to and from a local program?

I've recently been constructing a pixel shader to apply shading to the player-character in a Flash game I'm currently coding for. As it turns out, however, Actionscript 3 is... Not handling this gracefully, and the framerate hit is pretty huge.
What I would like to do is write something in C++ that can then use OpenGL buffers to store the pixels I want to tweak, tweak them in a hardware accelerated fashion, and then pass it back to the Flash file.
Is there any way of getting AS3 to pass bitmap data to a local shader plugin .exe, and then accept returned data back, or should I just give up and rewrite the entire damn thing in Unity or something?
Failing this, is there any way of forcing the GPU to do the number crunching in AS3? I know OpenGL can't be used with AS3, but DirectDraw, perhaps?
I'm aware this entire enterprise is a) ridiculous overkill and b) probably doomed, but it's currently all that's preventing me from having to work on my reflective essay for the project. (University coursework)
You can't interact with any local program. Since Flash Player 10, there is some silly hardware acceleration support, but mostly for video and not for 3D. The best AS3 (Flash Player 10+) can provide is the native support for working with triangles in 3D (method drawTriangles()). For example Flash 3D engine "Away3D Lite" uses this feature.
Have you tried looking at Alchemy?
http://labs.adobe.com/technologies/alchemy/
It is a way of compiling C++ code into the swf bytecode.

Engine for use with PC and Iphone?

Are there any engines that allow me to develop for pc and iphone at the same time? My preferred language would be c#, but that probably won't happen, so I probably will learn c++ or java.
I want a 2d engine, by the way.
No experience with it but...
http://www.torquepowered.com/products/torque-2D/
C# and Java aren't allowed on the iPhone, so a C or C++ engine would be your best bet. I'm guessing you're doing a game--if so, you'll probably want to use OpenGL. I don't know any specifically, but here's a full list.
Working with pure Core Animation layers can yield cross-platform 2-D drawing and animation between iPhone, iPad, and Mac. As an example of this, the Core Plot framework runs on Mac and iPhone from the same codebase. Core Animation lets you do some pretty complex animations and layout in 2-D.
It is against the rules in OS 4 to write an iPhone app in something other than Apple's dev tools. However, IANAL but I'd expect that it is in theory ok to take the app you made there and then try to run it on an emulation layer etc.. on the /other/ platform(s). Not sure about direct solutions, but check out the GNU Objective-C runtime / GNUStep, they might be a helpful starting point.

Port Flash to iPhone

How hard would it be to port a flash game to the iPhone. Obviously Flash CS5 is no longer an options, I still would like to know if there's anything that can be reused? or do I have to write everything from scratch (Is Obj-C that different than ActionScript?) Is there any other shortcuts?
Also, if anyone has done this before please share your experience.
Flash is a very different platform, not only is the language change going to be an issue you're going to be going from Flash's renderer to presumably your own using OpenGL:ES.
Although another method may be to port your app to JavaScript. Both ActionScript and JavaScript are EMCAScript dialects, so very similar in that area, the APIs will be completely different though.
http://paulirish.com/work/gordon/demos/ interesting and slightly related, this is a implementation of Flash in JavaScript.
Note the new Apple T.O.S may affect you, but as far as I'm aware it's still a beta and I'm not Apple or a lawyer so I won't try and decipher it for you.
I am doing the same thing. I am using Cocos2d for iPhone. This is a pretty good 2d game engine. Actually, two apps created with it are in the current top 25. You are going to have to get down and dirty in Objective-C though. Objective-C is different from ActionScript but if you are use to object oriented programming you should be able to make the switch. Programming a Flash game is different than typical game programming done in Objective-C/C/C++. So, if you are familiar with how to do things in the Objective-C/C/C++ game programming world (render loop, capturing inputs, etc), you'll really be ok. If not, you'll have to get use to not having the Flash timeline, dealing with frames, etc. Good luck! You can do it!
read the statements from apple, no its not possible.
For my game Hudriks I used flash to build levels and some animations. For this an animation engine has been developed that supports motion tween, and then wrote JSFL scripts that goes through Flash objects and export to a format that can be parsed in my game.
For writing the JSFL - look for document called Extending Flash.
The rest was developed from scratch using Objective C with OpenGL. Do not see option of 'one-click' compilation or converting from Flash to iPhone (not considering CS5), but with developing extensions for Flash you could reuse some work.
It is hard, but it is possible. I am working on a automatic code converter now.

iPhone:Learning Cocos2D project

I want to develop a game in a month by using the Cocos2D Open Source game engine. Learning Cocos2D is a bit hard and I don't know how to create my initial project by using the files provided by Cocos2D base project. I doubt whether it is possible?
Can I learn by using Cocos2D base project directly and modify it for my game application? Does the license allow me to use like that? ( Because I can't learn all OpenGL programming concepts and develop an application in a month, which is very hard. )
Appreciate your thoughts and advice.
Thank you.
, I have been programming games for iPhone for more than a year now! I started doing most of the things in Objective-C but then I learned that for most graphically ( or computation ) intensive games, Objective-C is not really the best option. There are a lot of paths like Pure Objective-C for logic, and inline C functions for the more "intensive" parts of your game, Obj-C does also let you use C++ files ( for the model classes for example ) with Obj-C++ (which is basically a .m Obj-c source code file but renamed to .mm for Obj-c++ ).
Having said that, Cocos-2D is in my opinion a wonderful library, it's mostly written in Obj-C but has pure C parts for the most CPU intensive stuff (physics it's chipmunk physics and Box2D, they also have a hash table library written in pure C to avoid calling NSDictionary a lot). Cocos2D is not hard to use, and you can get a nice game working quite fast!
You can embed the whole Cocos-2D to a project of yours, or just embed some useful parts of it (like Cocos-Live for On-Line scores, the Texture loaders, etc). You could also start working directly from the Cocos-2D Xcode project and remove what you don't need (like examples etc).
For a simple explanation of the Cocos-2D license , read Here !
About OpenGL, with Cocos you won't need to learn it deeply, unless you start getting into very custom stuff.
Having said all that, here are my recommendations :
1) GUI takes time, GUI can take a lot (even more than 50%) of your source code actually... so take that into consideration if you are going to have game menus, etc.. and adjust your time schedules to make the GUI coding fit!
2) When you have learned Cocos a bit, start playing with OpenGL, it's a wonderful ride, and it's really great to know a bit about the "Engine" of your "Car" so if your "Car" (Cocos2D) break's or doesn't do exactly what you want, you can always tweak here and there to make it work.
For what it's worth, I tried to pick up Objective C a few times over the last year but gave up pretty quickly each time (though I used to do C a lot in the early 90s). Just over a week ago, though, I watched some screencasts and eventually decided to start making my own game. I then discovered and gravitated toward using Cocos2D.
Now, 9 days later, I have a prototype of a game done (it's a kinda clone of Robotron 2084). It's been great fun doing it so far and while this is not the most up to date version (this was at the 1 week mark), this video will give you an idea of what I've achieved: http://www.youtube.com/watch?v=lzD6va1GiTI
I started by using the default Cocos2D project and just figuring it out and adding stuff as I went. I did a TON of Googling and often ended up here on Stack Overflow and on the Cocos2D iPhone forums (which are VERY useful). I've scratched my head a lot but it's been a fun experience (except for tracking down memory leaks ;-)).
Cocos2D is, I believe, LGPL licensed but has some extra clauses tagged on to make it even more free so you can use it in your iPhone game projects commercially or not without any problems.
I've found you don't need to learn much about OpenGL. I've copied and pasted some free snippets from here and there but they've been simple to figure out. Things like drawing lines and boxes, etc. I haven't learnt any "hard" OpenGL stuff. I've just stumbled and got a pretty long way, IMHO. I now feel pretty confident and am still finishing off this game to get it on the App Store and want to develop more!
Make sure to start with the latest Cocos2D 0.99-rc because they changed a lot of names and it'll annoy you if you have to upgrade in future. It's very stable and works fine. Go to http://www.cocos2d-iphone.org/download and download it, unpack, then run the template installer. Then create a project using the Cocos2D template in XCode and Build & Run it on the iPhone Simulator. You'll get a basic example that you can then dig around in. Read the Cocos2D iPhone "Programming Guide" on their site too and gradually figure out how to change the scene to do something you want it to do. Small steps, etc :-)
If you have programmed games before AND you have some experience with Objective-C THEN you could develop a game in a month. The complexity of the game is a big factor.
I think Cocos2d is a very good framework to help you get started in 2D game programming for the iPhone.
Here is a very nice tutorial that will get you started: link text