Building Cross Platform (Mac/PC) Apps? - cocoa

I want to spec out an app and it is necessary for it to be accessible for both Macs and PCs. I previously would have thought of using Adobe Air however my opinion is that it is to slow, much slower than native apps.
What other options exist. I am willing to forsake a bit of speed but don't want to handicap the application by choosing the wrong framework/platform.
I will be hiring out this project so I will find a programmer that understands teh suggested approach.

If you go for cross platform solution like Adobe Air ... Java ... Mono ... Qt (framework) etc ... I don't think so will ever be able get the native efficiency ..
In my resent observation products like DropBox use python for its core modules and do native implementation based on needs.
My call for you is --- if you need best posible native app efficiency and cross platform then go for hybrid --- develop app's core module using may be python then go for native solution in rest of the places.

Related

NativeScript limitations

I´m evaluating differents mobile frameworks, and I think that nativescript is a good option. But I don't know if exists limitations on the development process. For example I had limitations on the styling (and that's not so important), but I want to know if in the future I can have a limitation and can´t use some native feature or external library.
Thanks!
I have been using NativeScript since v0.90. I have written multiple apps and over 40 plugins for NativeScript, so I am very familiar with the ins and outs of the platforms.
This post is features as of v6.50.
I can think of only a couple limitations;
Tooling sometimes leaves a lot to be desired, however using the IDE's supported make this better than the Native CLI in a lot of cases.
Sometimes errors aren't always propagated back from the app to the screen/ide -- so you have to do things like "adb logcat" to see the full error log to see the error that got filtered out by the CLI.
Native Services (i.e. background services) --- This is much better written as native code. The NS runtimes take memory while running; so a service you typically want as small of a memory footprint as possible -- I would not use anything but Java/ObjC for a background service.
OpenGL on android needs to run in a separate thread, NS by default switches you back to the main thread when returning from any native calls; this basically kills direct NS opengl calls. However, it is actually better to create any OpenGL stuff in Java or Kotlin anyways; and then have NS call into your native code that handles all the rendering, so this is more of a minor annoyance.
Beyond that I can't think of any "real" limitations; you have full access to the native platform and can actually style any control as long as you know how to do it via native calls; if for some reason the control doesn't support the normal css styling. I & others have used many Android and iOS libraries in our apps. You can easily reuse native android/ios components you have full access to anything out there that is available to a native iOS or Android app.
You can look at https://plugins.nativescript.rocks for a list of all the plugins in the NativeScript community.
I have been developing with Nativescript for some time now, and while finished product (application) is more than decent, the process of development is really painful. The primary reason for that are frequent bugs in Nativescript platform itself, and it's official plugin for VSCode.
I am currently working on Nativescript 2.0.0 and have been trying to update to newer versions since they came out, but there were always some errors, ether with Node, or with Gradle for Android, and that is just one of many problem examples I face with the platform. I wish they improve it in the near future.
For now native apis are fully accessible from JS but if you want you can do some library in native languages and call them from JS code too, about external libraries it depends if you mean native libraries or JS ones, but there quite many options/plugins done in JS code using some native libraries but in case not as JS plugin you can do it yourself with native libraries
Community support is low compared to other frameworks available in the market. This should improve as people adopt the framework. I see that as a limitation for now.
And Yes, Debugging is indeed a limitation.
Nativescript is the best cross-platform solution in my opinion, but like the others stated there can be limitations. Besides background services, accessing the hardware CAN be a bit tricky. I have been using it to work with BLE devices though, and once you understand how to interact with native APIs, it isn't so bad.
I've written one NS app (core).
Some of the cons are:
performance - loading and also run-time. I'm replacing an Android native app with a NS app (because it's cross platform) and few customers have complained that the new app is slower and jerky...I agree.
bugs in NS core. I think that they've spreading themselves too thin. They need to get their core product stable and improve it (i.e. make it faster).
plug-ins varying quality with minimal support. Here NS could curate a few important plug-ins and make people pay for it.
Yes it's free - but that's not a huge issue for me - I'd prefer to pay for a more polished product.
At the end of the day - the product works - have my app in the app-store and look forward to future improvements.

2D Cross-Platform Game Development Engines [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I've worked for some time with Corona SDK and love how fast and easy I can create powerful apps using Lua. But it can only compile for iOS and Android, which feels like too little now.
My main interest is for it to be able to compile to Desktop AND Mobile. At least for the following:
Windows + Mac for desktop, as standalone applications.
iOS + Android for mobile.
I'd prefer it to lean more towards Lua type scripting instead of ActionScript, but please feel free to post anything that you have worked with and love.
I've found the following engines so far:
Marmalade Quick - After further looking into it, Marmalade Quick can only build for Mobile!
IwGame - Works on top of marmalade and says it can deploy to
desktop and mobile with Lua. Any info is greatly appreciated on this
sio2 - Says "SIO2 is an OpenGLES based cross-platform 2D and 3D
game engine for iOS, Android, MacOS and Windows" and "The engine also
allows you to port your game on the Mac Store and on Windows.", but
their forum and web title is "Game Engine for Mobile Devices". Can't
find any info on if it can deploy to desktop platforms, any info is
greatly appreciated again.
Loom Engine - Loom is similar to Haxe + OpenFL (attempts to attract Flash developers) in that it uses AS3-like of ECMAScript, but it doesn't build native code from it. However it uses Cocos2D for rendering so it should in theory be as fast as Cocos2D. -- Thanks to Bojan.
SDL - I've read in multiple places that SDL can deploy to nearly any platform or device and has a Lua binding. But i can't find how this works as it's not an engine. Any one who can explain how it works and if it's possible is once again, very much appreciated.
SFML - "Windows, Linux, Mac OS X and soon Android & iOS. " doesn't use Lua but can use other languages like Java and Python etc. Anyone have any information on this?
Torgue2D - "Torque 2D was developed with OS X, Windows, and iOS devices in mind and works equally well on all the platforms." uses TorgueScript and no Android =(
Sencha - Seems to compile to all platforms, uses Javascript too which I know. But even with V8 JS would this work well performance wise compared to other options?
GameMaker - own scripting language GML and I actually remember this one as a tool for non-programmers. Has it actually grown into a real engine, I mean for serious development?
Construct2 - Same question as gamemaker
Corona - Lua but mobile only (Android and iOS only as well)
Cocos2D - Seems like it has lots of options but not sure with the same language? Seems like you'd have to re-write your entire code. Any info if cocos2D can deploy to desktop + mobile with almost the same code would be greatly appreciated.
Angel2D - Says it can deploy to everything except Android and uses Lua, anyone ever used this one before?
libgdx --- I've only seen good things about this. Here is a benchmark test for libgdx and is where I saw it reaching 40k sprites at 60fps. http://www.sparkrift.com/2012/1/love2d-vs-allegro-vs-clanlib-vs-libgdx-vs-cocos2d-x-vs-monogame-vs-xna-vs-sfml . It seems libgdx barely goes over 30k actually. But still seems amazing. This is on the same level as Qt for me, almost perfect, except I'm not really worried about performance on it. libgdx can build for everything pretty much.
XNA + MonoGame --- MonoGame's performance seems only slightly lower than libgdx, can build to most platforms. However I don't know much about XNA and I heard it won't be receiving future updates, but is quite stable? More information is welcome.
Citrus --- Don't have much information on Citrus either. AS3 game engine that can build for iOS, Android, Windows, Mac and more.
Haxe + OpenFL --- OpenFL (Haxe) builds to native on many platforms, not just to Flash. Windows, Mac, Linux and Android all get optional native deployment or OpenFL runtime called Neko which is in theory faster than Flash, and SDL 2.0 will enable iOS deployment soon(ish). -- Thanks to Bojan.
Qt-Project --- Just linking Qt project here, can build for everything and has a pretty big community with lots of third party libraries to help you even further.
Moai ---The only Lua engine that I know that can build for Desktop and Mobile. Only downside is the community isn't that big and documentation isn't the best. But if you can get passed those this is a great solution and the one I'm currently using.
Adobe --- Can't forget to add adobe here since it can build to everything that supports flash.
Unity3D --- Recently announced 2D integration looks very promising, should be released Q3-Q4 of 2013.
Cocos2d-x --- An open source engine. Supports JS, Lua, C++ and multiple platforms.
Html5 --- There seem to be a lot of emphasise on html5 mobile apps, here are just a few tools I found that can help port your html5 project to a platform:
Chromium embedded
Sencha
Phonegap
Appcelerator/Titanium
Icenium
So, I'd be happy if you could comment from your experiences with any engines and suggest which one you would recommend.
Thank you for your help!
EDIT: Since this topic is getting popular I'll be adding other options I've found over time. I suggest you choose what is most familiar to you and best for your project needs.
I would recommend V-Play (v-play.net) - it's a cross-platform game engine based on Qt for iOS, Android, Symbian, MeeGo, Blackberry10 and also can export for native desktop applications for Windows, Mac and Linux.
It's based on C++ but has a neat scripting support for QML & JavaScript. QML is a no-brainer to learn and can boost your productivity as less code is needed - just see the comparison with cocos2d-x(60% less Loc) or Corona(15% less LoC) for a comparison of the same games.
(Disclaimer: I'm one of the guys behind V-Play)
If you are into using Python, Kivy is a great solution these days. It compiles to all the platforms you ask for:
Kivy is running on Linux, Windows, MacOSX, Android and IOS. You can
run the same code on all supported platforms. It can use natively most
inputs protocols and devices like WM_Touch, WM_Pen, Mac OS X Trackpad
and Magic Mouse, Mtdev, Linux Kernel HID, TUIO. A multi-touch mouse
simulator is included.
Kivy uses lots of optimized code for graphics rendering (via Cython) so it is fast too.
Here is a speakerdeck that gives you some background and an overview (android specific).
How about HaxeFlixel? We have a great selection of demos, and of course support cross platform development via Haxe + OpenFL. This is an open source project hosted on GitHub. We support all major platforms (including iOS).
Here is my game framework Oxygine.
It is open source modern hardware accelerated 2D C++ framework for mobile and PC platforms.
Features: OpenGL(ES) 2, compressed textures, atlases, complex animations/tweens/sprites, scene graph, fonts, event handling, build tools, and others.
Can be built on top of SDL2 or Marmalade SDK.
In the basis of the engine there is a scene graph, that is similar to Flash one. To be short, You can call this as Flash for C++, but more comfortable and way faster. Initially it was developed for mobile platforms (iOS, Android), but can be also used for PC games.
No mention of App Game Kit (AGK) here so let me fill in the gap. It's a mainly 2D cross platform SDK allowing you to code once in either C++ or it's own "Basic" language. Version 2 just got over 400% funding on Kickstarter and will have full 3D support, Spine support (for 2D animated characters), bullet physics and whole bunch of other new features.
It already has Facebook, Twitter, a bunch of Ultrabook sensor commands, Box2D and more. I've been using it from the start and love it (can you tell?). No, I don't work for The Game Creators (the company that created it) although I admit I did do for a while making some apps.
One of the best features from my point of view is you can develop on Windows and broadcast from the IDE over Wi-Fi to any supported device, so while I'm coding I can (within seconds) test my code on iPad, Android, Windows, Mac or Blackberry Playbook.
If you have C# background. Have a look at Duality.
Duality is a flexible 2D game framework written entirely in C# –
and it’s here to make things a little easier for you. It provides both
an extensible game engine and a visual editor to match. There will be
no need for a level editor, testing environment or content manager
because Duality is all that by itself. And best of all: It’s free.
I'm just answering to give you some insights on how the SDL is used. As you said before it's not a game engine (it's just a library actually). Furthermore, it is not object oriented at all and you don't have some easy animation facilities (you have to code them by yourself).
How it works (I used the C version but I guess the Lua binding should be similar):
Include the headers needed to build the project on the platform you want.
Design your own game loop in which you will set up (at least) a whole event processing system, frame rate manager and a "screen cleaner (or updater)" (I'm insisting on the fact that you have to manually refresh your screen using the SDL_flip_screen routine which is something that is not one of your concerns at all with Corona).
Then, code your game using all the "mechanics" you made before.
The SDL is a low level library (don't expect to have an easy to use GUI framework or the storyboard framework of Corona for instance).
Finally, this library was used to port Civilization III to Linux, so yes it works but it will ask you a lot of energy to have something like you had with Corona ;)
PS: I am not a native English speaker, so please let me know if I wasn't clear :)
Gideros is a great Lua based 2d cross platforms engine, currently supporting both Android and IOS platforms, but more to come.
And it also has some great features as instant on device testing, auto scaling and auto image resolution to easily target various of screen sizes, as well as the option to extend each platform through native plugins.
You also have ShiVa3D, a serious competitor of Unity3D.
It uses Lua and supports many platforms from mobile to game consoles and web browsers.
Very intuitive to use and very nice UI to work with.

Desktop publishing platform closely tied to PhoneGap?

I'm looking for a desktop publishing platform for Mac, Windows, and Linux that is closely tied to PhoneGap in terms of the concept. I know that there's Titanium for Desktop (TideSDK?) but as far as I've used it before, it requires the end-users to download a big 70mb-ish runtime file once. What I liked about PhoneGap is that it doesn't require any of that (it works out of the box). I'm looking for something similar, only, instead of being meant for the mobile development, it 's targeted at desktop application development.
Perhaps I failed to mention it but if you are not aware of what I'm specifically talking about, I'm talking about an environment of sort that will let me code via an HTML base and output a native for said platforms. Both TideSDK and PhoneGap does this.
I would highly recommend giving TideSDK another chance, I have developed large, data driven applications on it in the past, and deployed to OSX and Windows and have personally been very satisfied with it. Also, it is now an open source project managed and maintained by a very good team with some oversight and help from Appcelerator (the original creators).
Theyre are two benefits to TideSDk as I see it:
License - TideSDK is open source licensed under a liberal Apache 2.0 license. As opposed to QT which is under the restrictive GNU Lesser Public, and commercial license.
Power - TideSDK allows you to leverage native API's (like phonegap) but access them in your favorite programming language (well, choose between Ruby, PHP, and Python). Your only options with QT are C++.
As for what you said about the 70MB runtime, this is not true, I built the runtime in with my last project, and the binary I gave to my clients (OSX) was only 15.3MB.
Hope this helps you come to a decision.
There is a way to run a PhoneGap HTML5 App on the Desktop with the help of Adobe AIR like described here: http://www.tricedesigns.com/2012/02/17/repurposing-phonegap-apps-as-desktop-apps/
But I am also looking for a less bloaty approach. Maybe based on Xulrunner/Prism/WebRT thing (or Chrome).
Tidesdk is the easiest, xml file is almost identical to the phonegap, provides powerful api and the best part you can package your app with runtime. I think you should stick to tidesdk.
I was looking for the same and found this implementation for windows ony: https://github.com/davejohnson/phonegap-windows
I did not tried it though.

Cross-platform GUI language/toolkit

I am attempting to write a cross-platform GUI application that would be deployed to Windows, Mac OS X, and Linux. My requirements are:
Single code base for all three deployment platforms, without a large amount of conditional logic for handling differences between platforms.
Looks as close to "native" as possible on all three platforms.
Easily distributable to all three platforms, in the sense that it could be easily installed by end users and does not suffer from extreme bloat (as discussed in this ArsTechnica article.)
Based on these requirements, I've narrowed down the selection of toolkits to Qt and wxWidgets, since none of the other toolkits that I know about (including Java's Swing and SWT, Flex, AIR, etc.) satisfy the "native-looking" requirement. Among these two final contenders, Qt appears to offer better support for applications that look and feel native on all three of my deployment platforms, but I'm willing to consider opinions to the contrary.
I would prefer not to use C++ as the implementation language, but I'm not sure if there are any practical alternatives. My biggest concern about using an implementation language other than C++ is the deployment problem. As discussed in the Ars Technica article, PyQt does not meet the "easy deployment' requirement in any practical sense, and I suspect that most other language bindings for Qt would suffer from the same deployment problems (at least on Mac OS X). Java (or Scala) with QtJambi? QtRuby? wxPython?
Does anyone know of any combination of language and toolkit that satisfies all three of the above requirements?
It depends on your needs. But in general Qt Framework (with any language) and Java SE (with any language) is much more better because it has not only cross-OS GUI libraries but also cross-OS networking, threads, ... wxWidgets is GUI only.
Both Qt and wxWidgets are nice. In my experience Qt is better. Swing is... Well, not so nice.
Both Qt and wxWidgets applications written in C++ and Java Swing applications are not so hard to deploy on Windows, Mac and Linux. The rule is that the deployment is simple when you are programming in "native" language. By "native" language I mean the language a framework itself is written in.
PyQt does not meet the "easy deployment' requirement in any practical sense...
Python (and any other language with the default implementation as interpreter) apps is hard to deploy in the usual sense (I mean in form of standalone executables).
So probably you have 2 choices:
C++/Qt or C++/wxWidgets.
Java/Swing if native look & feel is not very strict requirement.
wxWidgets is quite good, and does contain some non-GUI code (contrary to what kemiisto said): threads, sockets etc.
The nice thing about wxWidgets is that wxPython actually should be pretty easy to deploy on OS X. There are some other language bindings for wx, but wxPython is probably one of the oldest ones.
At my day job I've been developing cross-platform (Windows / MacOS / Linux) using perl and wxWidgets. The combination is pleasant to use for development (I'm a perl hacker) and I rarely have to include specialized code per platform. There are some perl modules that help out with this (e.g. File::HomeDir that knows about the canonical locations for document directories etc on the various platforms).
For release, I don't rely at all on the system perl installation and instead build a perl installation that is included in the release. This way I can completely control the runtime environment of the app. I ship a windows installer package via innosetup, an mac os .dmg file with a .app included that the user can just drag to their /Applications, and for linux I build debian and redhat packages.
Have you looked at Xojo? It definitely meets all three of your requirements and it is much simpler to learn and use than C++.
About a decade ago or so, it was fashionable to model a GUI in a cross-platform flavor of XML (like XUL) and then have a platform-specific rendering engine process that XML-file to display a layout. It is no longer fashionable to do this, however. Today, in 2017, the trend is to build your apps on platforms that allow you to write everything in HTML, CSS and/or JavaScript, no matter what environment your code is supposed to run in.
The "first generation" of this type of tools produced what are basically "hybrid" applications, where web applications run on top of browser-like & platform-specific WebViews. This technique is rather inefficient, however. Your apps don't feel very "native", are rather bloated and they tend to be rather lacking in performance. However, it's relatively easy to have a consistent look-and-feel in different environments. Phonegap / Cordova is the most popular platform for mobile environments and NW.js for desktop environments.
The "second generation" is different : they compile everything to fully "native", platform-specific binaries. Instead of relying on WebViews, "native" widgets are used when possible. This gives your app a more "native" look-and-feel, typically has less bloat and is much better for performance. However, you'll have more differences between the different platforms. Examples are NativeScript, React Native & Tabris.js (all for mobile environments).
Unfortunately, there are no "second generation" tools for desktop just yet. So, right now, if you want to build a cross-platform desktop app, you're stuck with "first generation" tools. NW.js has a longer track record than Electron and has support for various features not present in Electron, but it also comes with its drawbacks. AppJS is still older, but it's not as mature - and not nearly as popular - as the other two.
Anyway, their reliance on WebViews means that your application will feel more like a web app than a desktop app. And bloat and performance drawbacks are inevitable with this kind of solution. This means you'll never get the same performance as code you write directly in Java or C++ nor the same performance you'd get in "second generation" platforms, and it will never feel equally "native". However, it can still be the best solution eg. when a consistent look-and-feel across different platforms is more important or when you have a background as a web developer.
If performance, lack of bloat and your application getting that "native" feel are important criteria, you might want to wait a little longer until the first "second generation" platforms appear for desktop. It's really but a matter of time before platforms for desktop apps follow the same evolutionary path as platforms for mobile apps, although it might actually come in the form of "desktop extensions" to existing mobile platforms.
The way it's currently looking, it looks like you'll soon be able to write "native" apps for desktop & mobile alike with the exact same codebase. With React Native already having plugins that add support for Windows 10 and support for MacOS, I would personally go with React Native and give their dev team some time until they support all desktop environments I need to support and those extensions for desktop are mature enough for production environments.
If you can't wait that long, you don't want to bet on what's to come in the future or if these criteria aren't that important for whatever application you want to build today, you might want to try some of the "first generation" platforms currently available and see which is most suitable for you. Just be aware of the drawbacks!
As always, choose wisely...
Popular platforms
First generation platforms for mobile environments (iOS & Android)
Meteor (built on top of Cordova)
Ionic (built on top of Cordova)
Second generation platforms for mobile environments (iOS & Android)
NativeScript (AngularJS eco-system).
React Native (React eco-system)
Tabris.js
Platforms for desktop environments (Windows, Linux or MacOS)
Electron
NW.js
AppJS
Platforms for smart home and IoT devices
iViewer
Iridium mobile
.Net (C# or VB.Net) is what I would use for this (in fact, it is what I use for my own application). Thanks to the Mono project, .Net applications can run on Mac and Linux as well as Windows without any modifications to the code (unless you're calling Windows API functions). You don't even have to compile different versions of your program: the same EXE will run on all platforms.
Java/SWT is one of the good choices. You can find a lot of information about it here.
Java does support "native-looking" applications by using the SystemLookAndFeel. The quickest way to try is to invoke the following at application start up.
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Take a look at this for more information on the available Look and Feels in Java.
http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html

How do you port a Cocoa/Mac application to Windows?

How do you port a Cocoa/Mac application to Windows? I mean how would you go about it? Assume the app was written with Objective-C and Cocoa, there's nothing fancy going on, no "engine" that could be factored out, etc.
Rewrite from scratch? I don't think there will be huge overlaps between the Mac and Windows codebases, right?
I have doubts about cocotron.
Its not clear from the cocotron website that cocotron is actually production ready yet. Id suspect that it would be possible to start new app development and use cocotron constantly to maintain and test windows builds on the go.
But to retrofit it into an existing project might be a much larger task. There are also no alternatives to cocotron - other than perhaps gnustep.
The practical approach to cross platform development involves developing the non gui components of your application, once, in C or C++. And then using a cross platform GUI library like QT - which is VERY good at generating and using native UI where possible or faking it where not. Please DO go to qt.nokia.com and download the latest build of QTCreator for windows and mac - See how the same QT application looks and feels very convincingly native on both platforms.
If QT doesn't provide a native enough solution, then you need to develop your GUI twice :- once in Cocoa, and once in Win32. The cocoa GUI would be in objective C of course, the Win32 GUI in C/C++.
Your non gui application code would - written in c++ - not be able to call Objective-C directly, but its not hard to write shim classes, implemented in .mm files - the provide a c++ interface, and wrap access to an objective c object or class.
You are also going to have to come up with an alternative to CoreData on windows - perhaps sqlite? Given that XCode has integrated support for the sqlite framework, and testing multiple code paths is, well, more work - perhaps dropping CoreData in favor of a common layer is a better approach?
The problem with Objective C is its very poor support on any platform that is not OS X. You can attempt to use the Cocotron, but I wouldn't consider it production ready yet.
For portability, a re-write is in order. With judicious use of standard C or C++ for the "core" of the application, you could still implement platform specific GUI code. If you don't like maintaining two GUIs, you can also try a toolkit such as Qt
Depending on which objects and framework you are using for your cocoa app, you might be able to get away with using gnustep, although the end result will probably look very weird to windows users, and the development environment might be a bit difficult to setup at first.
Are you aware of Cocotron? It looks like the project may have gone stale, but it's a good starting point anyway. It's a project to port Core APIs.
If your application is not cleanly separated (ie: a la MVC) then the only solution is a rewrite, I think.

Resources