World of Warcraft Trinity, starting from the source

Source: Internet
Author: User
Tags visual studio 2010

Cause of origin

In an idle weekend afternoon, suddenly think of World of Warcraft, the official account for a long time, the size of the number is now not even full level. Previously used to take the legendary and StarCraft network of the server to entertain, also heard that World of Warcraft has open source service simulation, since the spirit of the small research.

The current World of Warcraft is more popular is mangos and Trinity, both are simulated World of Warcraft server. Mangos "claims" is a research project, the purpose is to learn large-scale C + + project development, reasonable, but I do not believe. Trinity is a mangos-based code development that was previously built to incorporate user-submitted patch codes, but has now been independently isolated, with major development members including former mangos, and the main tasks now include cleaning up code, optimizing, Provide a better service-side core.

Both of the current code commits and updates are very frequent, but it is unclear whether the code will merge with each other. All in all, that is to say, I feel that Trinity probably should be the best one in the World of Warcraft server simulation at the moment. As a programmer, playing the game is still second, and looking at the code is an interesting thing. The entire process is documented http://log4think.com/setup_wow_private_server for subsequent inquiries.

Now try to start a World of Warcraft from the source of the server, starting from the source of the main or want to look at the code, based on Trinity to do. As for the client, as of June 12, 2011, the latest version of World of Warcraft in China is 3.3.5 13930-Wrath of the Lich King.

Install Basic Tools

Before installing, you need to prepare several tools and software to use, to download, compile and so on.

* * Version Control tool git * * since mangos and Trinity are both hosted on GitHub, Git is used to get down to the source:

    • Git for Windows
    • Git's graphical tool tortoisegit

compiling tools and libraries :

    • Openssl
    • CMake
    • Visual Studio Express, this is the free version of Visual Studio. If you have visual Studio 2010 for money, you don't have to install this.

Operating Environment:

    • MySQL, after installation, also contains the header files and libraries required for compiling.
    • Graphical Client for MySQL

Choose one of the following on demand

    • Microsoft Visual C + + Redistributable Package x86 version
    • Microsoft Visual C + + Redistributable Package x64 version

The following are not required

    • . Net Framework 3.5, Visual Studio 2010 It's like a band in there.
Build project file

Each tool is downloaded, installed (specific details can be Google, do not repeat), after the preparation of the work done, began to compile the code.

    1. Create a directory, such as D:\workspace\trinity

    2. Enter this directory, right-click Git Clone ..., url filled in https://github.com/ Trinitycore/trinitycore.git , click OK. Do not like the graphical tool can be directly into the new directory, the command line run   git clone https://github.com/TrinityCore/TrinityCore.git  . will automatically create a source directory called Trinitycore, and then wait for the code to finish.

    3. Build a directory under D:\workspace\trinity is a build-and-drop compilation result file
    4. run CMake graphical tool (CMake (Cmake-gui) under CMake in the Start menu)
    5. Point Browse Source ..., select D:\workspace\trinity\TrinityCore
    6. Browse Build ..., select d:\workspace\trinity\build
    7. Point Configure, a dialog box
    8. Make sure the Use default native compilers is checked, the drop-down box is selected for Visual Studio 10, as for the 32-bit or 64-bit version, select The/li>
    9. Point Finish,cmake Tool searches the source configuration and analyzes some compilation options. Make sure that Cmake-gui the following information is not in the error message, or according to the specific errors corrected after.
      1. Select SCRIPTS, SERVERS, TOOLS, use_corepch, use_scriptpch in the compilation options above Cmake-gui, and do not choose Use_mysql_sources.
      2. The last point Generate, CMake generates a project file for Visual Stdio 2010 below D:\workspace\trinity\Build.

After the configuration is complete, mine is this:

Problems that may occur: 1. The 10th step inside _git_exec should be msysgit in the absolute path of GIT, if not is msysgit install the time did not add themselves to the system path inside to 2. If a red error hint appears below, similar to

Could not copy From:d:/dev/cmake/share/cmake-2.8/templates/cmakevsmacros2.vsmacros to:c:/documents and Settings/ Administrator/îòµäîäµµ/visual Studio 2010/projects/vsmacros80/cmakemacros/cmakevsmacros2.vsmacros

This seems to be because CMake can not recognize the Chinese path, the "My Documents" location, changed to a path without Chinese. Or simply copy the Cmak>evsmacros2.vsmacros from the hint to Visual Studio 2010/projects/vsmacros80/cmakemacros/under My Documents.

Compiling source code

Note the following points:

    1. If your World of Warcraft client is 3.3.5 13930, then remember to give the code a certification patch to support 13930, specifically refer to another article Wow_3-3-5_13930_auth_patch
    2. In Visual Studio, open D:\workspace\trinity\Build\TrinityCore.sln, build-and-clean solution, and build-build solution
    3. The default is to generate Debug, the results under D:\Build\bin\Debug, from the MySQL directory in the installation directory of a libmySQL.dll to this directory, Libeay32.dll and Ssleay32.dll is OpenSSL , should be added by default to the system path, if the following prompt can not be found in the installation directory of OpenSSL to copy from.

Installing the Database

Short cut says:

    1. Download the latest World of Warcraft data files from https://github.com/TrinityCore/TrinityCore/downloads (or match your client version number),
    2. Using MySQL graphical tool, import D:\workspace\trinity\TrinityCore\sql\create\create_mysql.sql execute build three database

      Import D:\workspace\trinity\TrinityCore\sql\base\auth_database.sql execution in auth database, import D:\workspace\trinity\ in CHARACTE database Trinitycore\sql\base\character_database.sql executed, the world database is imported in the first step to download the Tdb_full_???. SQL file execution, the final establishment of Auth, character, world three databases.

Generate a Map file
    1. Under D:\Build\bin\Debug, build a Makevmaps3_simple.bat file with the contents of

      vmap3extractor.exemd vmapsvmap3assembler.exe Buildings vmapspause

      Save run, the map from the client directory of World of Warcraft will be decompressed to the server. Depending on the speed of the machine, it takes about 20 minutes to one hours. At the end of the run, you will be prompted to "press any key ..." and end with a key. The Vmaps and buildings directories are generated, and the buildings directory is useless to delete.

    2. Suppose that the client directory of World of Warcraft is under D:\WOW and runs under D:\Build\bin\Debug

      mapextractor.exe -i "d:\WOW"

      This will generate the maps and DBC directories. This tool will generate different DBC language versions in the DBC directory according to the client's rain. If it is a Chinese client, it will extract the DBC data from Chinese.

Configure the server
  1. Under D:\Build\bin\Debug, there are two files of worldserver.conf.dist and Authserver.conf.dist, respectively, the configuration template files of the game server and the authentication server.
  2. Duplicate a copy of worldserver.conf.dist and rename it to worldserver.conf, configure the game server

    LoginDatabaseInfo = "127.0.0.1;3306;root;trinity;auth"WorldDatabaseInfo = "127.0.0.1;3306;root;trinity;world"CharacterDatabaseInfo = "127.0.0.1;3306;root;trinity;characters"

    Is the authentication database, the world database, the Player role database address, root behind the Trinity is the root of the MySQL password, changed to you when installing MySQL set the root password.

    Previously generated the Vmap file, this is the map of the relevant data, the server can be based on this to determine whether the monster and the player is visible (whether there is a wall, whether on the same floor of the building). Without this, the monster will hit you through the wall, or from downstairs to hit you directly ... Server configuration here By default, VMAP data detection is turned on. If you do not want to turn on vmap detection, change the values of the following configuration to 0

    vmap.enableLOS = 1vmap.enableHeight = 1vmap.petLOS = 1vmap.enableIndoorCheck = 1DetectPosCollision = 1
  3. Duplicate a copy of authserver.conf.dist and rename it to authserver.conf, configure the authentication server

    LoginDatabaseInfo = "127.0.0.1;3306;root;trinity;auth"

    Similarly, change the Trinity to the root password of MySQL.

  4. Check the database auth inside the realmlist table inside the record, the value of port in the record should be the WorldServerPort = 8085 same as the value of this item in the worldserver.conf (here is 8085 ). At the same time, the value of gamebuild should be the same as the version number of your client (the bottom right corner of the login interface, currently the latest is 13930). If there is no record in the realmlist, you should add one.

Modify Client Configuration

The client default is to go to the official server, need to modify the address to let the client login to our own set up the game server. Assume that the World of Warcraft client is installed under D:\WOW, and under D:\WOW\Data\zhCN, back up realmlist.wtf files. The original content of the file is

    set realmList cn.logon.warcraftchina.com    set patchlist cn.version.warcraftchina.com    set realmlistbn ""    set portal cn

Change its contents to

    SET realmlist "127.0.0.1"    SET patchlist "127.0.0.1"
Registered user account

After the client login will find no account available, there are two ways to register an account:

    1. The first method is to use SQL statements directly in the database to add

      INSERT INTO account(username, sha_pass_hash, email)VALUES(‘用户名‘,SHA1(CONCAT(UPPER(‘用户名‘),‘:‘,UPPER(‘密码‘))), ‘邮件地址‘)

      Replace the user name, password, and e-mail address in the command.

    2. The second method is the simplest, after starting the game server Worldserver, in this command window can enter the GM command:

      create account 用户名 密码
Start the game
    1. Run D:\Build\bin\Debug\authserver.exe
    2. Run D:\Build\bin\Debug\worldserver.exe
    3. Running the client Wow.exe

If you're lucky ... Anyway, I had a good luck ...

The related may also need some configuration and changes, but now my version can run normally, the other future to write it. Before this, at least you can study the source code ...

How to play with friends

If you want to play with a friend, then you need a public IP address. Room inside no server no relationship, you can put in their own home server, and then go to ip138 to find their own IP address, the 127.0.0.1 related addresses are changed to their own IP address on it. If it is through the ADSL routing on the network, to the ADSL routing configuration inside the internal and external IP address set to the DMZ host address open to the outside network.

In addition, if the server running servers have peanut shell dynamic domain name or your own domain name (such as my http://log4think.com), you can change 127.0.0.1 to their own domain name. The 127.0.0.1 configured in the previous addresses in Wowserver and authserver are changed because the server has to provide this address to the client. MySQL-related 127.0.0.1 addresses need not be changed. You have to change it, but you have to go to the relevant security settings for MySQL extranet access.

At the same time, if it is to be on the public network to provide services, it is recommended to find a separate machine to do auth server (configuration not too good), different game areas run on different servers (this configuration is better), each server to run Worldserver. Add the list of servers to the Realmlist table inside the AUTH database.

Friendly tip: Provide public network services beware of the defendant.

Several minor issues related to:
    1. If the connection server goes down, the next patch here overwrites the installation.
    2. If there is no server list after login, look at the client version number (the bottom right corner of the login interface), and then the AUTH database realmlist the last item in the table Gamebuild to see the version number (such as 13930).
Development and commissioning

Since it is compiled from the source code, so if there are any problems in the middle can be solved by debugging way. Debugging method is very simple, a few simple means 1. Capture packet, analyze data record 2. Start the compiled program, open Visual Studio, attach to the process, and under breakpoint Trace 3. Enter the game and operate, and if the correct breakpoint is placed in Visual Studio, it will stop at the relevant location.

To retreat and to seek the second

If you feel that the above is too complex to make, if you just want to play for yourself, then you can next others do a good package, such as Tccn-3.3.5-trinity8400.exe, install the start Web server and WOW server, register an account can go in to play, Simple, no need to explain. However, this has the number of restrictions, the specific restrictions on how many people I do not know, in short, the public network services are not.

Resources

Some of the relevant sites are listed below:

    • Mangos Official website: http://getmangos.com
    • Mangos code Base: Http://github.com/mangos
    • More mangos Links: Http://getmangos.com/wiki
    • Trinity Official website: http://www.trinitycore.info
    • Trinity Project Home: http://trinitycore.github.com
    • Trinity code Base: Https://github.com/TrinityCore/TrinityCore

Post-site related articles can be found in http://log4think.com/category/practice/fun/wow-trinity/

This full text reference Trinity Official document Http://www.trinitycore.info/How-to:Win

World of Warcraft Trinity, starting from the source

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.