Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a very simple 2d multiplayer browsergame in html5. Something like Scalatron

I mainly want to do this to improve my scala skills, the problem is I would have to code the clientside code in javascript and the serverside code in scala. This would result in duplicated code.

Another option would be to ignore the html5 part and write it in opengl. But I would still prefer to have a html5 game.

I could do this is in javascript, but then it would destroy the whole purpose of learning scala.

Is there a way to use scala with html5? Or what would you recommend me to do?

share|improve this question
There is one valid question though: Is there a way to use scala with html5? – Valmond Oct 29 '12 at 14:37
up vote 2 down vote accepted

The programming language for HTML5 is Javascript. Web browsers can't interprete any other programming languages. When you want to create a HTML application in Scala, you will need a transcompiler which turns your Scala code into Javascript.

I found a project with that goal via Google, but I have no idea if it's usable yet:

By the way: I am currently developing a client/server application with the client in Javascript and the server in Java. There is surprisingly few duplicate code, as long as you follow a strict separation of concerns between client and server (the server does all the game logic, the clients job is taking user input and displaying the game state as told by the server).

share|improve this answer
How do you keep the client in sync? Do you use ajax to do this? Also the physics should only be on the server, what library do you use to do this? – Maik Klein Oct 29 '12 at 16:27
That's all very off-topic, but I use WebSockets for client/server communication. I don't use a library for the game mechanics, I wrote them myself. – Philipp Oct 29 '12 at 16:34

Have a look to - it is Scala to JavaScript compiler. Supports source maps and since version 0.6 is not longer experimental.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.