This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "2player online game with java backend " Watch "2player online game with java backend " New topic
Author

2player online game with java backend

hasan atlasan
Greenhorn

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

Cheers,
h.

Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3600
    
  14

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
Greenhorn

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
 
It is sorta covered in the JavaRanch Style Guide.
 
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.