Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing for HTML5 canvas using Box2D engine but NOT in Javascript

Basically I have the following constraints for an upcoming project/game:

  1. Drawing should be done in the HTML5 canvas element
  2. Use the Box2D physic engine (or equivalent physics engine)
  3. 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?)

like image 940
user967041 Avatar asked Nov 20 '25 01:11

user967041


1 Answers

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.

like image 77
Infeligo Avatar answered Nov 22 '25 16:11

Infeligo