Design Ideas of 100,000 online webgame in a single world (III)-map module design ideas

Source: Internet
Author: User
Tags radar


Map module:

Maps are displayed and stored in a face-to-face manner in traditional webgame strategies. Map movement is implemented on this plane. However, generally, the design capacity of a flat map has an upper limit. Generally, the number of map users is 400*400, and the maximum number of map users is. In fact, the server can accommodate 3 ~ After people, the whole map will become very crowded. If you want to accommodate millions of online users, the size of a flat map needs to be expanded to a considerable extent, so that the time for players to move from the middle of the map to the edge is quite scary, therefore, a flat map is not suitable here. Therefore, a map cannot be constructed using a plane. It must be constructed using a three-dimensional method. Here I have designed two sets of solutions:

Three-dimensional plane space:

As described above, a three-dimensional plane space is to combine multiple maps to form a three-dimensional space. In this way, if the user is not enough, just add a new plane. The background of the game can be adjusted as needed (for example, the whole world is made up of five continents separated by the sea, and there are other super space outside the five continents, these spaces are independent from each other, but can be transferred through a transport array ). The advantage of this is that users are easy to understand and do not need to change their operation habits. After all, they are fighting on flat maps. However, there will be problems in the mobile computing of cross-plane combat (the logical problem is: whether to allow cross-continent expeditionary force)

User coordinate representation method: Map level, X coordinate, Y coordinate

Database Design Scheme:

With a layered structure, you only need to add a map level field, and this geo chart can be used. (Reference Field: ID, map level, X coordinate, Y coordinate, map type, player ID, city id)

Although adding a map level field can solve the problem of map representation, because the game world is a single-world server, when map information is stored in a table, this data volume cannot be underestimated. During the previous webgame project, the whole map generates database records in advance. When a player joins the game, modify the player ID and city ID in the table. At the same time, because the map size is only 400*400, the whole table will have records. However, if you want to create a server that hosts 800 million people, the map size should be 800 *, and the map level should be 15 ~ 20 layers, even if the minimum is 15 layers, at least records need to be inserted in advance according to the original design philosophy.

The data volume seems exaggerated, but it cannot be processed by sqlserver, and we plan to use only one server to process map forms, which is much less pressure. However, you cannot ignore the optimization processing when a performance bottleneck occurs. There are two optimization methods:

1. Split: Split the table into 15 to 15 levels based on the map hierarchy ~ 20 tables, or 15 to 15 ~ 20 databases

2. Use sparse matrix storage: A map does not generate user's map information in advance, but inserts data only when a player joins the map. This solution achieves good performance when the number of users on the server is small in the early days. However, when the number of users reaches a certain level, the overhead caused by too many record functions cannot be avoided.

 

Full three-dimensional space:

The full three-dimensional space cancels the coordinate display of the plane. Users all fight in a three-dimensional map. The advantage is that maps do not need to be so scattered. Mobile computing makes it easy to handle them. The problem is that it is difficult for the game to display the 3D effect of the map.

Representation of user coordinates: X coordinate Y coordinate zcoordinate

Database storage solution:

The database table design structure of a three-dimensional space can be the same as that of the above table, and can only be stored in sparse matrix mode, because after being made into a three-dimensional space, more records can be displayed.

The concept of a mobile base in a full three-dimensional space:

As early as two years ago, when I saw "super time and space fortress F", I came up with an idea. During the game, the player's mother ship has moved around the world at a certain speed.

Key Points of mobile system design:

1. the user's base can be moved

2. the user base can only have one (three kingdoms in Wulin and multiple zones in travian)

3. The spatial coordinate is composed of X coordinate Y coordinate zcoordinate, and the coordinate value should be decimal.

4. Multiple players are running in the same coordinate, and the gamer's route crossover does not affect the player (just to facilitate calculation and reduce the judgment process)

5. Regularly refresh mobile data through the background

A) Each short cycle (1 ~ 60 s) Update coordinates in memory

B) each long cycle (10 ~ 100) databases that update coordinates

6. The attack fleet was moved in two phases.

A) The first phase is the time from the mother ship to the target coordinate.

B) In the second stage, when the arrival time (60 minutes before), make a judgment to determine whether the radar of the attack fleet can find the target mother ship coordinate, if yes, a new correction of attack coordinates will be made. If not, the coordinates will be moved according to the original coordinate points. The above judgment will be performed once every one minute until the target coordinate point is reached. If the target coordinate point still cannot be regarded as an attack failure, the fleet will return

7. The moving distance of the fleet is related to the energy carried by the fleet. If the coordinates beyond the moving range are reached, the fleet cannot start.

8. Troops and mother ships should be able to perform spatial jumps to achieve long-distance movement. However, spatial jumps can be achieved only when a large amount of energy is consumed at a specific location.

9. By default, the Mobile speed of the mother ship is 1 grid (x, y, and zcoordinate)/day.

10. The radar query range of the default fleet is 1 grid.

11. The default radar query range for the mother ship is 3

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.