Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4322066
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:49:34+00:00 2026-05-21T08:49:34+00:00

I am trying to make a client/server turn based game. I want this to

  • 0

I am trying to make a client/server turn based game. I want this to be a 2 player game. I will be using a Java applet as the client so that people can play online through a browser.

What I know so far is that I can create a server that accepts all incoming connections and create a thread to handle clients that connect. I can also write the client that will connect to the server. What I don’t know is how to get two separate clients to interact with each other.

Applets cannot talk to each other so communication must be done via the server/threads (I assume).

I am not new to Java, but I have never done any networking before. Can someone help me out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:49:35+00:00Added an answer on May 21, 2026 at 8:49 am

    In my opinion the best strategy to approach a turn based game such as this, is to decide on some basic architectural approaches. Diagram out the componenents and some basic game flow diagrams.

    You should put the bulk of the game engine logic in the server component. The clients should be kept as thin as possible, focusing primarily on

    1. Communication with the game engine
    2. Accepting user inputs
    3. Interpreting game engine responses
    4. Drawing the screens

    Your server/game engine should be relatively stateless, yet maintain a list of current game sessions in play. Stateful SOAP web services or even HTTP Servlets would be a good choice because they maintain session for you by placing and reading session cookies in the request.

    Everything web works on request response so it is by nature stateless, but certain technologies like Java servlets will help you maintain sessions so that you don’t have to. No need for physically creating seperate threads, each request causes the application server to spawn a new thread of execution, while the session by nature is volatile.

    On the server side I would persist all data for a particular active game in the session. In this way, your game engine will maintain the orderly communication between the two players.

    1. Player 1 sends end of turn request with all of the game state change information.
    2. Game engine interprets request, makes necessary changes to the game state.
    3. Player 2 sends frequent requests to check and see if it is Player 2s turn yet.
    4. Game engine acknowledges Player 2 request for its turn and sends the new game state in response.
    5. Player 2 receives the response, updates its copy of the game state making note of the changes since its last turn.
    6. Rinse and repeat.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.