Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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
3  
There is one valid question though: Is there a way to use scala with html5? –  Valmond Oct 29 '12 at 14:37

1 Answer 1

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: http://scalagwt.github.com/

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

Your Answer

 
discard

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.