Tower Defense online game based on Netty and Raphael demo (i)

Source: Internet
Author: User

This is a hobby in the spare time to write the project, the purpose of the first edition is to understand the game service side of some design ideas, so basically think of what to write down what, and did not do too detailed design, and premature optimization. In this version, the main function is to complete the following functions:
    1. Customize a simple communication protocol
    2. Handle Simple game logic
    3. Server and client that can run

I. Service-side design

The entire service side is divided into the following sections:

  1. Basic Communication Module
  2. Logic Processing Module
  3. GM Modules
  4. Server Status Monitoring module

Several high-level abstractions on the server side:

1) Context

The context represents the lifecycle of the entire service and is responsible for starting and stopping all games

2) Game

The game represents different games, each of which customizes its own protocol, and is responsible for creating and destroying the

3) Guest

The hostel is responsible for handling the game logic and controlling the game's progress

4) Charactor

Each charactor represents a player and stores some basic information about the player.

5) Dispatcher

Dispatcher responsible for the distribution of messages

6) Processor

Processor is the final processing terminal of the message

Throughout the server, Netty is responsible for establishing connections, receiving and sending messages, and Netty receiving messages, distributing messages from Netty threads (Netty-initiated threads) to the user thread (processing game logic), where Jactor2 is used to complete communication between threads

Two. Client Design

The client is relatively simple, reference here, the UI based on the Raphael Library, there are only a few basic functions,

The following will take out some of the basic components, and finally refine into a small engine

Project Address: https://github.com/occume/D3000

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.