I'm looking for some ideas on the general architecture for creating a Windows application (I'm open to suggestions: Java, C++, C# and also for frameworks) in which I can show another application running inside of it. Very similar to the iframe concept, where a web page is rendered within the frame.
I think I would need to instal the framed application as part of a custom installer, or even assume it is preinstalled in the OS. The important part initially is to be able to framed a graphical application inside another.
I have an application which is composed of many JFrame objects (using Java and Netbeans). The 'main' frame has 4 buttons and each button opens another frame. Now my problem is that I want the whole application to be run on the web as a website.
I was considering 3 possible scenarios (from my research):
Use Java Web Start
Convert JFrame to JApplet
Create from scratch a Java web application
I was hoping that maybe someone can give me some help, and guidelines of which option I should opt for.
The quickest option is to modify your application to run as an applet (yes, this would involve making a JApplet from your JFrame). However, you should realize that the Java Applet is considered an outdated technology. Most mobile devices won't run them and even some popular desktop browsers won't (Mac Chrome). What's more, Oracle now requires all applets to be signed in order to run with default security settings. This means purchasing a yearly (~$200) signing certificate.
Java Web Start is not really fundamentally different from applets and will suffer the same issues as above.
Think again about your choice of technology. A Java web application (e.g., Spring MVC) or a JavaScript application (e.g., GWT, JQuery) are better choices.
For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X & Unix/Linux.
Applet deployment has always been difficult, with weird bugs in particular versions of specific JREs in conjunction with particular browsers. My 'favorite' bug happened in a version of Firefox that triggered an applet to reload when the user scrolled up in the web page.
See also The Use of Multiple JFrames, Good/Bad Practice?
i need to develop in java an application that accesses local resources, mainly a webcam, and possibly a wacom bamboo pen tablet. It should take pictures and notes and then post them to a web server.
The ways i can think of are:
use applets
use some kind of standalone app created via JavaFx (or swing or similar)
Which way would you go about it? Are applets considered a viable/secure way to achieve this?
Thanks
I would go the standalone app route. I always turn Java off in my browsers because I can never remember which specific version has security bugs.
If you build it as a desktop app I think you could quite easily convert it to be an applet later on if you wanted.
When considering a platform for a game, I've decided on multi-platform (Win/Lin/Mac) but can't make up my mind as far as browser vs. desktop. As I'm not all too far in development, and now having second thoughts, I'd like your opinion!
Browser-based games using Java applets:
market penetration is reasonably high (for version 6, it's somewhere around 60% I believe?)
using JOGL, 3D performance/quality is decent; certainly good enough to render the crappy 3D graphics that I make
there's the (small?) possibility of porting something to Android
great for an audience of gamers who switch computers often; can sit down at any computer, load a webpage and play it
also great for casual gamers or less knowledgeable gamers who are quite happy with playing games in a browser but don't want to install more things to their computer
written in a high-level language which I am more familiar with than C++ - but at the same time, I would like to improve my skills with C++ as it is probably where I am headed in the game industry once I get out of school...
easier update process: reload the page.
Desktop games using good ol' C++ and OpenGL
100% market penetration, assuming complete cross-platform; however, that number reduces when you consider how many people will go through downloading and installing an executable compared to just browsing to a webpage and hitting "yes" to a security warning.
more trouble to maintain the cross-platform; but again, for learning purposes I would embrace the challenge and the knowledge I would gain
better performance all around
true full screen, whereas browser games often struggle with smooth full screen graphics (especially on Linux, in my experience)
can take advantage of distribution platforms such as Steam
more likely to be considered a "real" game, whereas browser and Java games are often dismissed as not being real games and therefore not played by "hardcore gamers"
installer can be large; don't have to worry so much about download times
Is there a way to have the best of both worlds? I love Java applets, but I also really like the reasons to write a desktop game. I don't want to constantly port everything between a Java applet project and a C++ project; that would be twice the work!
Unity chose to write their own web player plugin. I don't like this, because I am one of the people that will not install their web player for anything, and I don't see myself being able to convince my audience to install a browser plugin.
What are my options? Are there other examples out there besides Unity, of games that have browser and desktop versions? Did I leave out anything in the pro/con lists above?
I'd suggest writing a game first.
It's easy to get caught up in how to make the best game ever,which can run on anything from an abacus to SkyNet, but the reality is that you're going to have plenty of challenges ahead of you just finishing a game that runs on your own PC.
Write a game first, for one platform (whether that platform is "Windows native with DirectX", or "Java applet" or even "pure AJAX in a browser"). If you can do that, then you can start thinking about how to port it to other platforms. But trying to do everything is a sure way to end up achieving nothing.
Or to put it another way:
I've decided on multi-platform (Win/Lin/Mac)
so you've actually decided nothing. Decide on a platform to develop on. Then make the game. Then make it work on other platforms.
Don't worry so much about what your "audience" will find acceptable. If your game is fun, then yes, people will happily install Unity. Just like they'll install your game if it's not browser-based. But the important point is not "what do I have to install to play it", but rather "is it worth it". Your focus should be on making a game that is worth the installation.
And unless you're planning to sell 20 million copies of the game and live off it, your "audience" doesn't really matter that much, does it? What matters is putting the game out there so those who are interested can try it.
But a single-platform game is a lot better than an unfinished cross-platform nothing.
A game that requires me to install Unity is a lot better than something that takes you an additional 3 years to develop because you insisted on reinventing the wheel.
Yes you can have the best of both worlds.
It's perfectly possible to write a Java application that will run in both an applet (for your online users) while also running as a standalone application in downloaded form.
The key technologies are:
JNLP
JOGL for the graphics, which also has some good demos
I'm not so familiar with it but I think jMonkeyEngine looks very promising if you want more of a full-featured game engine
If it's any use, an old game I wrote called Tyrant supported running both as an applet and as a standalone downloaded .jar file, all the source is open if you want to look at it. This used simple AWT rather than 3D graphics.
And finally here's another example of converting an applet into an application with a pretty minimal amount of code.
If you really want that kind of penetration then I suggest HTML 5 + javascript depending on the performance you need.
First of all you start with the wrong question. Your decision for a technology should be driven by the concept behind the game. It seems that you are sure about the idea to write a game - so ask your self what the requirements for the game are. This will lead you to your technologie. If it doesn't get an idea of "what" you want to do.
To your Pro's and Con's:
Don't focus on things you will never need or be able to use. Thinking about the steam platform isn't interesting for a hobby developer. Also android isn't interesting if you are not really want to ship your application for android. This Pro's will actually never be a pro in reality.
To sum it up: Let this decision be driven by your idea, not the technology itself. If you have a clear idea of what you want to do you will get your answer.
(And btw.:
Think about what browsergames imply. Behind a Browsergame there is a huge service-area, only for keeping the game running. Companys working in such areas are basically service-providers.)
You might want to look into Google's Native Client, which allows you to write your application in C or C++ (or anything else that compiles to native code, really). A new feature coming to the SDK is LLVM support, which will (hopefully) allow NaCl software to target any platform that Google's Chrome browser runs on (or any browser that the NaCl plugin works with - currently x86 and ARM are supported, IIRC).
You mentioned Android in your question - have you thought about developing the game purely for Android?
In effect you get the best of both worlds, easy to maintain, easy to release new versions, easy to monetize and get some small income and you don't have write your own installer or update mechanisms either.
Yes. You can make something that will work in both. Basically, make your program work inside a JPanel. The applet can display the JPanel, and the desktop version is just a window with your JPanel in it.
You could also have a full Swing (or whatever) GUI, which the applet launches in a new window when they click the little "start" button you'd have on your applet.
There are a few other differences you'll have to take into account, like possibly loading resources, but I've done it before for simple games I've made.
I don't think you can really compare the two:
In my opinion:
Applet, flash and other browser based games are typically small "toy" games either written for free or supplemented with advertising. For examples, check out the Addicting Games website.
C++ games are more likely to be heavyweight studio-written games relying on dedicated physics engines, graphics engines, etc (particularly true of games distributed on Steam I would have thought). The learning curve is likely to be much steeper, as C++ is inherently a more difficult language than Java / Flash.
If you're unfamiliar with C++ my advice would be to steer towards Java with JOGL. That way you can scale the Open GL learning curve before having to tackle C++.
EDIT
To address the other section of your question regarding implementing a game in both browser and desktop form, you could consider implementing the game in Java and deploying an applet and standalone version, whereby the standalone version can take advantage of Java's full-screen exclusive mode API. You could base both applications on the same codebase. You could also consider shrinking the applet's footprint size by retaining data files (e.g. game levels) on the server-side and retrieving them dynamically when required.
While WebSense won't let me browse directly to the site, for obvious reasons, the first thing that came to mind when reading this question is a game like Wurm Online. It's written in Java with JOGL, implements content streaming and local caches, and seems to have touched on a lot of the points you're interested in. It's a desktop Java application rather than being truly "in-browser" but I think you could still learn quite a bit from its implementation.
The in-browser game is always in peril of having its window closed or refreshed, causing it to abruptly lose state unless everything is being kept server-side. This means you either have very simple games that can maintain synchronization using a call/answer model (such as the myriad of Facebook "Mob Wars" text-based games) or risk an inadvertent bump of F5 catapulting someone back to their last "saved game."
I'm not sure that refusing to use a plugin because you personally don't like it is a sensible choice. This option lets you write you app installable as a desktop app, or a browser plugin (with not much extra work) and you still get to write it in C++/GL. You said you don't think your users will install plugins... why not? If they will install an application then why not a plugin which basically boils down to the same thing?
You could look at Flash too, which is gathering some 3D functionality and can run in-browser or as an AIR dektop app. But then users would need a Flash plugin, which you presumably don't have either.
I have seen a lot of people try to make a web ui looks like a desktop ui. However, most of the time i feel web ui is much more interesting than the desktop ui, with the help of javascript toolkit like jquery, gwt-ext etc.
My question is, how to port the web ui to desktop ui? Do I need to embed a javascript engine in java? css engine? html layout engine? That sounds like a lot of work to do.
Any easy way of doing this?
you can embed a web server in your app and you can embed a browser inside your app window. i know eclipse does this pretty well. it uses SWT to do the heavy lifting
http://www.eclipse.org/swt/snippets/#browser
check the Browser section
your web server doesnt even have to be a proper web server, it just has to set the content, and can query / change it on the fly. the javascript on the page can even interact directly with your app.
you should be even able to use crazy web frameworks like
http://echo.nextapp.com/site/
or
http://code.google.com/webtoolkit/
or even run a ruby site through JRUBY
or make really complex apps using the new HTML5 engine [canvas/video tags] (if your client has the new mozilla installed)
Adobe AIR technology solves this exact problem. The code you develop using Flex can be rendered in the Flash player plugin of a browser or the same code can be easily packaged as a Desktop application that runs on the AIR runtime.
Have you seen Appcelerator's Titanium Desktop
This is one of the best solution for you (i think!)
You write the javascript and html code, and the titanium SDK creates the Desktop application of the same
There is support for Python and Ruby.
Must try :
http://www.appcelerator.com/products/titanium-desktop/
if you are a Ruby programmer then you must also see this
http://www.rubyinside.com/bowline-rails-for-the-desktop-2183.html
Prism from Mozilla is made for this goal, exactly. It's out of beta now too, I believe.
Check Google Gears y Adobe AIR
It not 'a lot of work to do', it's a huge amount of work to do - you would in effect be writing you own browser and it'd never come close to the poplar ones out there, simply because you wouldn't get the level of feedback something like Firefox gets.
If you're trying to avoid address bars, menu bars, etc these can be switched off in all the popular browsers and so to the user the appearance would be that it's more application like with only the rich content of the HTML visible.
Sounds like JavaFX would be good for you?
http://en.wikipedia.org/wiki/Javafx
Try XULRunner from Mozilla. If you have developed extensions for Firefox, then this is the exact same thing. XULRunner contains the Gecko engine, so it can render XUL and HTML with CSS, and it supports JavaScript with many useful XUL Components, like file read and write, directory browser and network tools.
Because it supports HTML you can in effect make a webpage and have it run like an application. Also it is cross platform, so it will run on Windows, Mac and Linux, anywhere Firefox runs actually.
There is some information on creating XULRunner applications on the net, but since it's so similar to making Firefox Extensions, you can just google for that. A good Tutorial for getting started is this one.