![]() |
Do-It-Yourself Multiplayer Java GamesAn Introduction to Java Sockets and Internet-Based Gamesby Annette Godtland Quantity discounts available! |
Do-It-Yourself Multiplayer Java Games: An Introduction to Java Sockets and Internet-Based Games is the fourth book in the . You'll use Java sockets and TCP/IP to create games to play with your friends within a home network or over the internet. There are a few more files you need to do the lessons in the book. Download to your computer and extract the files into your Java work folder. .
The Advanced Do-It-Yourself Java Games: An Introduction to Java Threads and Animated Video Games .
in the series isYou'll create seven client/server programs that use Java Sockets and TCP/IP:
This project will demonstrate how to use Java sockets to send a request and a response between two computers. It shows how to communicate across a private home network or over the public internet, and suggests how to minimize internet security issues.
The server of this program counts each visitor and sends a visitor number to each client that contacts it.
![]() |
This project demonstrates how to maintain connections between one server and many clients. Any number of clients may join or leave the game at any time. It also demonstrates how use a graphical user interface for both the client and the server. Type a message in the input field and click Send to broadcast a message to all clients currently connected to the chat server. |
![]() |
This project demonstrates how to pair up any two clients that connect to the server in multiple, simultaneous sessions. This project uses what is probably the easiest approach to writing client/server games: the clients take turns, and each client maintains its own copy of the game. For this project, all the game logic is maintained in the client code. Dots and Boxes is a two-player, turn-based game. The object of Dots and Boxes is to complete the most boxes, as you and your opponent take turns connecting dots. If you complete a box, you get an extra turn. |
![]() |
The Word Hunt program uses an authoritative server approach: the game state and logic are maintained on the server. The client provides the user input to the game, but the server determines the response to the input and instructs all the clients how to react. This project also demonstrates how to allow only invited players to the game. Word Hunt is a timed word game for any number of players. Each player receives the same 5x5 grid of letters. The object of the game is to find as many words as you can in three minutes. After three minutes, you will receive points for any words you found that your opponents did not find. Longer words are worth more points. |
![]() |
The Snakes project shows how to create a game with continuous animation. It uses an authoritative server to control object movement and perform collision detection. This project also demonstrates how to create a base set of abstract client/server classes to more easily create additional client/server games. Snakes is a two-player animated video game. The object of the game is to outlive your opponent's snake. Guide your snake to eat as many apples as it can--making it grow longer--so it may more easily block the other snake. If your snake collides with either snake or with the borders of the game, part of your snake will deaden. The game is over when one of the snakes dies off completely. When that happens, the other snake wins. |
![]() |
Double Solitaire is a two-player, fast-paced action game. The authoritative server handles all the game logic and collision detection, while continuing to receive nonstop movement input from both clients. This project demonstrates how to manage fast-paced action in both the client and the server by queueing the data, using timer threads, and synchronizing processes. In this game you'll see just how little lag there is between computers when playing games over the internet. The object of this double solitaire game, also known as "Spit", is to get rid of all your cards, playing as fast as you can to the two discard piles, while your opponent is also playing as fast as he can onto the same two discard piles. Discards must be played in sequence, either up or down, regardless of suit. The first player to get rid of all his cards wins. |
![]() |
Voice Chat is a simple two-player audio streaming application. Voice Chat allows two people to talk to each other over the internet using WiFi and their computer's microphone and speakers. This small bonus application is a very basic voice chat program, provided to allow reasonable conversation when playing the games introduced in this book. However, it does have a noticeable delay from the time a recorded voice is sent from a client to when it is played on the speakers for the other client. |
The book provides complete instructions for creating each of these games youself.
Would you like to improve your Java programming skills while having fun doing it? Learn more about the
of books. Learn why these books were written, why learn computer programming, and why Java. Learn how these books are organized, why they were written as electronic books, and what's next.The books ccurrently available in the series:
Do you have a program that you would like to share with others, maybe even sell? You have much more to consider if you want to make it easy for others to use, to protect it, and to sell it safely and securely online. It's time to make your program market-ready.
.