File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 3576

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.
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:
subject: 2player online game with java backend
Similar Threads
drag and drop applet
Drag and Drop in Applet
drag and drop questions
Feedback: Info for SCJP Tiger beta
how to implement Jar file in GUI.