Basically I have the following constraints for an upcoming project/game:
Drawing should be done in the HTML5 canvas element
Use the Box2D physic engine (or equivalent physics engine)
Game logic (and as much code as possible) should be in Java, as I'm profficient in Java and it would be nice to be able to port the project to Android.
It can be summed up in this: I want to develop games/projects in the HTML5 canvas element, using some kind of physics engine while avoiding the mess of javascript. (preferably but not necessarily through Java)
Is this possible? Would it be viable?
I've looked at GWT but I'm unsure how efficient it would be for animation, and how I would go about to incorporate Box2D. (or another physics engine in Java for example, but would the translation to javascript be fast enough?)
I know that GWT compiles Java to JavaScript, but it does so in the boundaries of its framework, so I don't know how easy it would be to use GWT in your project.
If you find JavaScript too frustrating, check out CoffeeScript. It slim and sharp, can interoperate with JavaScript (in your case Box2D JS port) seamlessly.
Google's PlayN (formerly ForPlay) was used for the web version of Angry Birds, using Box2D. It's mainly intended to use WebGL for the rendering, but can use the canvas element when WebGL is not available (Angry Birds requires Flash, for the audio).
http://code.google.com/p/playn/
http://www.youtube.com/watch?v=F_sbusEUz5w
Related
I apologize in advance for what might be a terrible question... We are developing a MMO using mostly using LibGDX. Kryonet is being used for networking, and rendering is done using LibGDX functions. The current client seems to be a LwjglApplication, and I want to make it so that the game is playable using a web browser. It seems like I can implement it as a Java applet or using this GWT thing. What would be the easiest and most bug-free thing to implement for a novice such as I? (Links to tutorials especially welcome).
I would go with lwjgl applet. But I want to warn you that you should think twice if you actually want your game to be played through browser - if you want to look reliable, you have to sign your jars, which cost around 200$ / year.
If you want to use GWT then I recommend you to consider PlayN https://github.com/threerings/playn
Im about to start a small project using OpenGL and Java. Looking through this website and google it seems to be unclear what implenetation of OpenGL is best to be used within Java.
I've obtained this list from: Open GL
The JOGL Java/OpenGL bindings
Java 3D (SUN's retained mode library layered on OpenGL)
OpenGL for Java (GL4Java)
YAJOGLB (Yet Another Java OpenGL Binding)
jGL: a 3D graphics library for the Java
What would use recommend in terms of the amount of resources aviabale to learn it and simpleness of implementing a simple either car,helicopter or flight simulator in?
I'm just a beginner with OpenGL but I've been using LWJGL (http://www.lwjgl.org/), which Minecraft uses.
If you want something more high level, try an engine like jMonkeyEngine (http://jmonkeyengine.com/).
I would advise to look into LibGDX if I were you. LWJGL and JOGL are targeted towards PC games. LibGDX on the other hand targets computers with the help of LWJGL, but also Android and iOS; to top it off it supports "HTML 5" with the help of Google Web Toolkit (GWT) - all through a generic API.
I am a java developer and I would like to develop rich clients for the web. My problem is that I hate javascript, flash, etc. and most of the programming languages usually used for web client. I would be happy to keep doing java to develop web clients that may be used on common web browsers and, why not, on new fashion mobile devices. I am looking for some advices/warnings to make a good choice.
Java applet seems perfect for my case, but according to some rumors, it is not a really sustainable solution. Should I have a look at JavaFX? GWT? Are there some other possibilities?
What do you want to do? Vaadin is based on GWT and therefore utilizes HTML5 + JavaScript which is much slower than a Java Applet. I have tried boat and Applets with Swing is A LOT
faster than Vaadin.
With Java Applets, Swing and Hessian you have unbeatable performance for business applications. Hessian is a very fast binary web service protocol. With JavaScript you are usually limited to text-encoded web service protocols like Json and various XML-based protocols. Text-based protocols consume a lot of CPU, memory and bandwidth compared to binary protocols - and they don't really provide you with any advantage at all.
The weak point of Applets is hardware accelerated graphics like OpenGL and multimedia. If you are developing games or movie players Applets is not that great.
JavaFX promise to fix hardware accelerated graphics performance and video codecs. With your description it is not clear if you need to wait for that.
However if you really need more than what standard applets will provide you than web start may be a solution. Its a bit like the old ActiveX with signed or unsigned application that gets extra privileges - either by being signed by sun or by asking the user. This will allow you to use JOGL or a 3d scene graph engine.
You are a perfect fit for JavaServer Faces (JSF). Yes just try them on. Look, you look great in them. The appeal of JSF is 1. It is a standardardized technology, part of Java EE 2. It relies a lot on Java programming over any JavaScript coding (which is not done at all). 3. JSF has been around for awhile, and it works quite well. In addition, JSF works with Ajax, out of the box (an added bonus), without writing a single syllable of JavaScript. The only downside is that you will have to code some html, and the "facelets" are basically html pages with some extra tags thrown in that you need to learn. But the vast majority of the real processing is done in Java. JSF also works without the extra baggage of Java EE, it was built to work with a plain Tomcat like server (or Glassfish or JBoss, etc) and a browser, and Java SE (the desktop version).
I think JavaFX looks very promising as a Java-based RIA technology. It's cutting edge though. Mac OS X and Linux versions are only available as a preview yet. Mobile and other device support has been announced but its not out yet, AFAIK.
Vaadin would also be suitable, requiring no Javascript or HTML at all, even for new component development. Page layout is done using layout managers (like Swing). New components can be composed from existing components (again, like Swing), or written from scratch using GWT (fairly straightforward, and pure Java).
There is a reasonable selection of add-ons covering some features not in the core framework.
The framework is very easy to use for Java developers with Swing experience, and has a polished look and feel out of the box. However, the layout managers do make it difficult to change the look and feel using CSS - simple tasks like adding borders are hard.
The layout is also quite "heavy", which means that Vaadin websites can feel slightly sluggish. In my experience, the feel is still better than some of the heavier JSF frameworks.
It is compatible with all major browsers.
Demonstrator: http://demo.vaadin.com/sampler/
You could also consider Wicket. This has a similar component-based approach, but the components are defined using simple HTML fragments, which results in a much lighter DOM (and therefore better browser performance) and far better control over the look and feel. Wicket has a steeper learning curve, however.
After trying GWT and struggling with its so-called "super-dev mode", I discovered JavaScript programming was not so painful. I forced myself to learn and practice and I finally fully adopted it. There are numbers of nice things in JavaScript and a huge number of libraries. My recommendation for people in my case is just to persevere in learning JavaScript using for example w3schools tutorial.
Is there any library out there to create graphics without using AWT?
What I need is simple drawing functions (like to draw a line) and text drawing functions to create graphics in memory for a Google app engine application. App engine does not support AWT.
Thanks!
Not unless you want to implement your own image class (say, a bitmap) and rendering algorithms for lines, shapes, images.
If you have experience with computer graphics and rasterization, this may not be very hard, but otherwise it will be more than you want to bite off.
You might also try the appengine-awt project, though it's a bit experimental.
You might try using SenseLan. In the requirements section, it says they don't use awt or ImageIO. Of course, there is the Images api but it seems fairly limited in what it offers.
Edit:
It looks like there are a couple of Python possibilities that could offer you some limited drawing capabilities. You could probably write appropriate image functionality as python web services, and keep the rest of the app in Java:
Replacing Functionality of PIL (ImageDraw) in Google App Engine (GAE)
http://denislaprise.com/2008/08/21/drawing-images-on-google-app-engine/
Use Batik for GAE which is available as a dependency of FOP on GAE.
You can also track the issue further on the Google app engine bug tracker where others have shared other ideas in the comments.
'The Java 2D API is a set of classes for advanced 2D graphics and imaging, encompassing line art, text, and images'
http://java.sun.com/products/java-media/2D/index.jsp
Here's another possibility: org.eclipse.draw2d It probably relies on eclipse SWT.
TinyLine provides vector graphics support on the Google App Engine server side, and also provides SVG rendering support. See the SVG Thumbnail images demo.
Google Web Toolkit contains a nice graphics library designed for interfacing with the Google app engine.
edit to clarify: Google App Engine is designed for hosting applications on the web. You need to design graphics that can run in the browser. To do this, you need to write code in a web language, Javascript, for example. Google Web Toolkit contains a Java graphics library which compiles down to Javascript, saving you the effort of writing the Javascript yourself.
I hesitate to mention PJA, which appears to work if the AWT classes are present, but the security manager prevents you from using them.
If you can use Python on GAE instead of Java, then there's pybmp.
I'm currently searching for a 3d library that I could embed in a Swing application. This library doesn't necessarily have to be a huge thing as I mainly intend to give a 3D representation of some shapes, and certainly rotate around them.
My main concern is to get something as easy to set up and to deploy as possible.
Do you have any clue ?
Why not just embed Java3D in your application.
http://java3d.j3d.org/tutorials/quick_fix/swing.html
You can also embed Jogl (Java OpenGL) with Swing.
http://cld.blog-city.com/mixing_java_2d_and_3d_jogl_in_a_swing_application.htm
Java3D would be higher level so it may be a better choice.