Author: yahle
Used Network Name: dogvane
Original: http://www.cnblogs.com/yahle
Copyright. The author and original source must be indicated in the form of links during reprinting.
1. Architecture
1.1 traditional website architecture
Traditional websites generally adopt N-layer structure, n is generally 3, which is what we often call a three-layer architecture.
The three-layer architecture consists of the data layer, business logic layer, and page display layer.
1.2 architecture of webgame
Webgame can be seen as a combination of websites and games, so it has the characteristics of these two types of systems. We can not only regard webgame as a website, but also an online game.
The website is in the B/S structure, the online game is in the C/S structure, and the webgame is the combination of the two. For now, we call it the B/C/S structure. In the eyes of users, it is a website within a browser. In the server system, it is a traditional online game with a C/S structure.
From the analysis, when users access the server through a browser, they first access the Web server, such as IIS on Windows and Apache on Linux. In a special way (distributed access, such. net remoting) to access the game server, notify the game Logic Server to perform player operations, and obtain game-related information from the game logic server, or directly obtain game data by accessing the database.
1.2.1 why divide servers into game servers and web servers?
The Web Page Server triggers execution and executes the webpage only when a user accesses the webpage.ProgramCode. However, our common webgame (ogame, travian) games actually require 24 hours of uninterrupted execution. Therefore, web server execution is not suitable for games. Therefore, we need another application to perform these 24-hour tasks without interruption. That's why we need to add a game server.
1.3 architecture of webthree
Currently, Websearch is a non-commercial development. If we copy the above webgame architecture to design it, the development cycle will be too long and the development efficiency will be low. In fact, at the initial stage of development, webthree developed according to the above architecture and changed the structure only when they encountered the above problems.
In practice, the structure of webthree is similar to that of webgame, but the game server is integrated into the Web server. The project divides the game into the following categories based on the traditional website architecture: data layer, game logic layer, and page layer.
As for how to implement 24-hour uninterrupted processing, the developer creates a thread for processing when the game starts. This is a function in Asp.net. I Don't Know If PHP has such a function.