File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes How to implement an online game? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "How to implement an online game?" Watch "How to implement an online game?" New topic
Author

How to implement an online game?

jane tub
Greenhorn

Joined: Jun 14, 2012
Posts: 4
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!!!


[Thumbnail for ClassDiagramEnglish.png]

William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

Welcome.

Too many questions.

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

WP
jane tub
Greenhorn

Joined: Jun 14, 2012
Posts: 4
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

Joined: Feb 26, 2001
Posts: 4447
    
    5

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


Junilu - [How to Ask Questions] [How to Answer Questions]
jane tub
Greenhorn

Joined: Jun 14, 2012
Posts: 4
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.


[Thumbnail for ClassDiagram2.png]

William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

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

Joined: Jun 14, 2012
Posts: 4
Thank you so much!

Yesterday I had to present my diagram and the people liked it, so I`m happy
chloe brown
Greenhorn

Joined: Jun 22, 2012
Posts: 3
Thanks for this flow diagram.
Now i can understand it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to implement an online game?
 
Similar Threads
quick questions about part 2
Cheating at chess, how?
Why to certify?
Help me to confirm some uncertain questions, please!
Why to certify?