jQuery in Action, 3rd edition
The moose likes Game Development and the fly likes 2player online game with java backend Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "2player online game with java backend " Watch "2player online game with java backend " New topic

2player online game with java backend

hasan atlasan

Joined: Jul 01, 2012
Posts: 2
Hi all,
I am planning a small game project but I'm not sure which way to do it.

My programming knowhow is limited, I feel most comfortable with Java. That's why I prefer it for the serverside.

The game itself:
2 players playing in browser, boardgame similar to chess (no artificial intelligence). What I basically need is to drag and drop pieces into squares (positions) and the gameserver should tell me if that move is allowed or not.

I played around a little with struts2 and struts2jquery. Is that a good approach? any recommendations to do it differently? HTML5 also has drag and drop but how would I call java methods from html tags?

I'd be thankful for some pointers


Stephan van Hulst

Joined: Sep 20, 2010
Posts: 4638

Hi Hasan, welcome to CodeRanch.

You could send an asynchronous request to the server using jQuery. The server can then interpret the request, do game checking and communicate with the opponent, etc. When the server is done, it can send a response in some format like JSON which is then read by the jQuery in your browser. I believe Spring MVC 3.0 can handle such requests and deal with JSON as well. It also has a nicer architecture than Struts2.

The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
hasan atlasan

Joined: Jul 01, 2012
Posts: 2
Thanks Stephan; so I'm more or less on the right track

I'll come back when I'm stuck
I agree. Here's the link: http://aspose.com/file-tools
subject: 2player online game with java backend
It's not a secret anymore!