Mobile phone online production of data processing articles

Source: Internet
Author: User

Development Program: Crazy Bombs

Development progress: Phase III

The main point of this issue: Design server-side data processing capabilities

Development platform: Java Platform

Mobile games only the client can not play, must have server side. Development server side, the most core is the design of server-side data processing functions (complete instance program, please go to http://www.shudoo.com/bzsoft download).

In the general server-side program, the server-side program mainly includes data storage, program logic control and network programming, data storage and program logic control are closely combined, can be collectively referred to as data processing. In order to facilitate the transmission of network data and the maintenance of the entire program, the server side of the program is best consistent with the client's development language.

The server-side development of the program on the PC, the security and response time requirements are more stringent, requiring fast data processing, storage security, short response time. But the mobile phone program's network transmission speed relative to the PC slower, so the server side of the mobile games is relatively low demand, development is also easier.

Design idea of server-side data processing

When the client first connects to the server side, the server side assigns a unique user ID to the client, after the client obtains the user ID, at a certain time to the server side of the query to see if the server side has a matching user can play.

If there is no instruction to continue to wait for the client feedback, if a matching user assigns the room ID to the two clients and generates the map data information, start the game. After entering the game interface at a certain time to get the map data, when the user moves the role to the server to send mobile instructions, the server side according to the client's mobile request for logical processing and corresponding to modify the map data (see figure).

When the client connects to the server side, the server side logically processes and assigns a unique user ID to the client. When you get the room ID to achieve the same idea and user ID implementation, but for the game interface map data, including each map block data and player position, direction and other information, then use a custom class in Java representative, each room data is an object of this class.

Analytical Data processing Technology

In the crazy bombs game, there are three main types of data to be processed: User ID allocation logic, player allocation logic, and player movement control logic. The User ID assignment logic is to assign a unique number to the player, relatively simple; player allocation logic is to assign two clients in a waiting state to a room and initialize the logic of the game data; The player's mobile control logic is to determine whether the player can move, and fix the game data after moving, more complex.

The principle of player mobile control logic is as follows: In the game interface, sequentially stores the image number displayed in each cell, the player also stores the position according to the line number and the column number, the entire interface is a 11 row 10 column area, so the movement is according to the cell Judgment movement. When moving, first determine whether the current user ID is against the user 1 or User 2, and then determine if the next cell beyond the map area, if not beyond the map area, according to the direction of movement, modify the player's line number and column number.

Server-side data processing design steps

First step: Create a project

Start Eclipse, select "File→new→java Project", set the project name "Bomberserver", and select "Next" to complete the project setup. Then create a new entry class, select "File→new→class", set the name "Server", and click "Finish". The code download address for creating the project is Http://www.shudoo.com/bzsoft.

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.