• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implement an online game?

 
jane tub
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! This is my first try to write a topic.
Normally I can find the information I need at the internet.
But now this is a special case. I have to create a class diagram (only create, not implement) for a nine men`s morris game (also called mills, but it doesn`t really matter). The user should be able to log in and to choose an opponent is actually online for this game and to play the game. The information about the users should be saved in the database. So I only need to show which classes we need for this game, without methods and variables.
I created such a class diagram, but on some places I think I`m wrong, but I don`t know how I can do it right. This is the presentation layer (pres): maybe I need the jsp files for the view? Now It`s just java, but in this case the users would need to install java locally on the client. Or the servlets? I don`t have any experince with both of them.
The second point I think I`m wrong is: do I need something special to implement the possibility for users to log in and to choose an opponent for a play?

The diagramm is attached as an PNG-Image.

I would be very very happy if I could get some advices!!!
ClassDiagramEnglish.png
[Thumbnail for ClassDiagramEnglish.png]
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome.

Too many questions.

Are you looking to use a web-application or stand-alone java programs?

WP
 
jane tub
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your first replay! Yes, it should be a web application, running on Apache Tomcat and maybe using ZK as an AJAX Web Framework.
The really important question for me now is: I don`t know how to implement the possibility for users to choose an opponent from the others logged in on the webpage. I just have one user class representing one single user and so I could for example implement the game between the user and the computer, I mean my program simulating an opponent. But how could the user choose one real opponent?

thank you for help!

jb
 
Junilu Lacar
Bartender
Posts: 7466
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to maintain some kind of collection of users on the server. See java.util.List for an idea or look at the Java Collections Framework for more information
 
jane tub
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I added a new class named UserConnectionManager, who will manage the communication between two users and help, to choose one. Here is the new image of my class diagram.
ClassDiagram2.png
[Thumbnail for ClassDiagram2.png]
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice diagrams, (user should be User I presume).

Anyway, I would step back and design this in a different manner.

For one thing, how would you many Users? Have a UserManager is great as it will allow other Users
to see who's online and join games.

I would not have the UserManager manage the game though. I would create a class "Game",
that has references to the two users playing and deal with the logistics there.

WP
 
jane tub
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much!

Yesterday I had to present my diagram and the people liked it, so I`m happy
 
chloe brown
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for this flow diagram.
Now i can understand it
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic