Hi, my daughter is struggling a bit with maths and logic and I was thinking of doing some programming with her hoping that a different approach to the field might help a bit. I've had some look at Java syntax and I think I should be able to write some code for some simple games with her. My problem though is that last time I did any sort of programming there was no Internet, and I would love for us to play the games we make with/against each other. I've been looking into communicating over network from java applications and quite frankly it seems like a daunting task to learn. My initial thought was to set up a MySQL db to store scores and the like, but I'm guessing some sort of server would be better so that we can store gamestate etc there. I think we would start up with some turnbased games(othello or chess type games) so would need some sort of synchronization from the server I guess.

I was wondering if there's any skeletons (frameworks?) available to make this task less daunting, or some tutorials for people like me who have no idea what a socket or anything regarding networking is. Also, if I try to set up a server of sorts, do I need to use other languages than Java serverside?

Really sorry about how open this question is for interpretation, but as I'm more confused now on what to use than I was before I started reading through the forest of suggestions from Google I'm not sure how to narrow it down. Any suggestions on where to start with the networking part of a turnbased game would be greatly appreciated.

PS: Decided to start up with Java as I eventually want us to make some applications on Android that we can play together, other than the different UI syntax there's not much else to learn going from Java, correct?

Recommended Answers

All 4 Replies

This sounds like a very advanced project for a beginner.

Client/server coms via Java internet Sockets really isn't hard - here's a good short tutorial to start with.

A server for synch and gamestate etc is a perfectly reasonable way to go. SQL would be another area of complexity to master, so maybe better left for version 2?

Java language is pretty ordinary stuff in 2012, its the API (class library) that's really huge and takes a long time to get into. Just take it one step at a time, ie don't try to start with comms, GUI,state storage etc all at the same time.

This sounds like a very advanced project for a beginner.

Sorry I wasn't all that clear about that part, I'm not an absolute beginner. I've looked into Java and remembering the logic part from Basic, Assembly and some other languages I've already written a turnbased game (battleships) that works fine (far from optimal code of course, but it works). As far as my daughter is concerned she's completely new to this, but she would more be observing and coming with input while I do the actual coding to start. I'm thinking if we start off with some Hangman type games she can at least observe the logic part of programming and start to think about structuring problems in a different way. The reason I ask about networking is that I want to be some steps ahead of her and be able to set up some multiplayer functions on my own and the adapt the games we make to be playable online in some way.

Client/server coms via Java internet Sockets really isn't hard - here's a good short tutorial to start with. A server for synch and gamestate etc is a perfectly reasonable way to go.

Thank you for that link will look into it and see what I'm able to understand. Would this solution make it possible for the server to await some sort of input from both playing parties before sending out new information? (Example: in a 10 questions type game would it be possible that both machines get asked a question, and once both have answered we both recieve the next question at the same time?)

Would this solution make it possible for the server to await some sort of input from both playing parties before sending out new information?

Yes, no problem. Once you have established the socket connections you open a two-way link between each client and the server so the clients can send to to server, and the server can send info to any of the clients whenever it likes

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.