BF2Statistics Web Edition tutorial and tips

Discussion in 'BF2Statistics discussion' started by Hjaldrgud, Sep 20, 2021.

  1. Hjaldrgud

    Hjaldrgud New Member

    Intro
    Hey! I spent around a week fumbling around in the dark trying to get the web edition to work after being an avid user of Statistics Control Center. I've decided to make a tutorial for people like me who had problems setting it up and other people who have no idea where to begin.

    Step by Step installation, configuration and set-up.
    Don't worry. It's easier than it seems. I've tried to write as detailed as possible. That's why it's long.

    YOU NEED TO DOWNLOAD:
    BF2Statistics Web Edition v3 (3.1.0) - Found in resources here
    BF2 Gamespy Redirector (1.0) - Found in resources here

    Xampp (7.4.23 / PHP 7.4.23) - Google xampp, first link (apachefriends).
    Battlefield 2 Dedicated Server (1.41 or 1.5) - Just google preferred version of the game.

    Part 1: Download and installation of tools
    1. Download all the files needed.
    2. Create a folder on your machine titled "Battlefield 2 Server Tools" or something similiar
    [​IMG]
    3. Start Xampp installation
    4. Change the installation path of xampp to the folder you just created. The path should look like this: /*your location/Battlefield 2 Server Tools/xampp
    5. Click next until installation starts.
    6. Finish installation without entering control panel. (that comes later)
    7. Install Battlefield 2 Dedicated server into the catch-all folder. The path should look like this: /*your location/Battlefield 2 Server Tools/Battlefield 2 Dedicated Server.
    8. Finish that installation.

    Part 2: Set up Database and user. (Please don't panic).
    1. Enter xampp folder.
    2. Start up xampp-control.exe.
    [​IMG]
    a. Start Apache. Let it through firewall.
    b. Start MySQL. Let it through firewall.
    3. Open your browser.
    4. type in "localhost" in address-bar (alternatively 127.0.0.1).
    5. In top right corner there is "php myadmin". Click it.
    [​IMG]
    6. Click "New" in the left bar.
    [​IMG]
    7. In "database name", type in "bf2stats".
    [​IMG]
    8. Create. You've now enter inside the newly created database.

    9. In the top bar, click privileges(Far right on picture).
    [​IMG]

    10. Click "Add User account"
    [​IMG]
    a. username = bf2statslogger
    b. hostname = Local (from drop down tab)
    c. password = bf2
    d. Grant all privileges as well as global privileges
    [​IMG]
    e. Click Go.
    f. Check if you've granted all privileges.
    g. Click go again.

    Part 3: BF2Statistics ZIP.
    1. Open up the BF2Statistics_3.1.0_Release zip.
    a. Transfer python folder located in 'bf2 Server files' into the Battlefield 2 Dedicated Server folder. Overwrite when asked.
    b. Transfer the Gamespy Emulator folder into the Battlefield 2 Server Tools folder.
    c. Transfer the ASP located in 'Web files' into "htdocs" folder inside xampp.
    [​IMG]
    2. Exit the zip. We're done with it.

    Part 4 Enter the ASP:
    1. Open browser again.
    2. type in localhost/asp
    3. A login screen will appear
    a. username: admin
    b. password: admin
    4. When inside, click next.
    5. enter "bf2statslogger" as user, "bf2" as password. database should already be correct (bf2stats)
    [​IMG]
    6. Click next. It will now connect to MySQL
    7. Run systems test.
    8. Database version will fail. Click "Upgrade database schema"
    [​IMG]
    9. Click once more.
    10. click "return home".
    11. You should now be inside.
    12. Run a System test to be sure. (You find it inside "System" in the left bar).
    13. You have now set up the ASP.

    Part 4 Install Gamespy Redirector:
    1. Let's install "Gamespy Redirector" now.
    2. Install it in the server tools folder. The path should look like this: /*your location/Battlefield 2 Server Tools/Gamespy Redirector
    3. Install it.

    Part 4 Fixing bot names and adding into database
    1. Head into the ai folder in the mod you want to run in Dedicated server. The path should be something like this: C:\Battlefield 2 Server Tools\Battlefield 2 Dedicated Server\mods\bf2\AI
    2. Open up botnames.ai
    3. Delete all names and make new ones. The game is really strange when it comes to bot names. I had loads of problems when naming my bots.
    a. But this should work: aiSettings.addBotName (B) *bot name*. Using a prefix like (B) has the added benefit of making it easier to see if you killed a bot or your human friend. You do have friends right? :p
    b. Remember that the names only accepts one space. So name two names with _ like this:
    "aiSettings.addBotName (B) Han_Solo".
    c. Also make loads of them. If you decide to play with 96 bots, make sure you at least have 96 unique bot names or else there is trouble.
    [​IMG]

    4. Head into localhost/ASP again. Log in.
    5. Head to "Player Manager"
    6. Click "import bot names"
    [​IMG]
    7. A new window will open up
    8. Click "Browse.."
    9. Locate your botnames.ai file that you have edited inside the bf2 Dedicated Server.
    10. Submit. Now you have filled the database up with bot players!

    Part 5. Authorise your stats provider to automate snapshots
    1. In the ASP, click "Stats Admin".
    2. In the tab that opens up, click "Manage ranked providers".
    3. "Local Stats Provider" should be there.
    4. Select the small box left of it.
    5. Click "Authorise Selected".
    [​IMG]
    6. The providers' ranked status should now have changed to "Authorized".
    7. This makes it so that round snapshots are automatically written and saved into the database without the need of you manually accepting them.

    Part 6. Set up Dedicated Server
    1. Head to mod settings in the Dedicated server.
    Example path here: C:\Battlefield 2 Server Tools\Battlefield 2 Dedikert Server\mods\bf2\Settings
    2. Open up serversettings.con
    3. Write server name.
    4. Change sv.numPlayersNeededToStart to 0 or 1.
    5. Set amount of bots and ticket ratio and whatever you want.
    a. IF you want to play LAN with others, then you should set your IP4 address as the server's IP address.
    b. To do this, go to Start->search "cmd"->enter command prompt.->
    Type "ipconfig"->Copy IP4 adress into server IP.
    c. If you're never gonna play with friends over LAN this is not necessary.
    6. Save it.
    7. Open up maplist.con in the same folder as serversettings.con
    8. Change the map to something you want.
    a. Keep in mind formatting. Start with mapList.append. *map name* *mode* *layer*
    b. The database is somewhat case sensitive. I would advise to write map names in all lower case just in case.
    c. For bots, set the gameplay mode as gpm_coop.
    d. Select layer. By default, bf2 only have 16 player layer available for coop mode.
    e. Example I used in video for Gulf of Oman 16p Coop:
    "mapList.append gulf_of_oman gpm_coop 16"
    f. Set up as many maps as you want. Server starts with the map on top and works it's way down the lines.
    g. When done, save.

    Part 7 Set up Gamespy Emulator
    1. Go into the Gamespy Emulator folder: Example path: C:\Battlefield 2 Server Tools\Gamespy Emulator
    2. Open up config.ini.
    3. Scroll down.
    4. Edit like the lines like this:
    ; The user name for MySQL
    Username=bf2statslogger
    ; The password for MySQL.
    Password=bf2
    [​IMG]
    5. Save.
    6. Now the Gamespy Emulator can log in and talk to the database.

    Part 8 Set up Gamespy Redirector
    1. Open up Gamespy Redirector folder.
    2. Run BF2GamespyRedirector.exe.
    3. Select "Service Providers".
    4. Click "Create new service provider".
    5. Name the provider. An example is "This machine".
    6. Type in 127.0.0.1 in stats address and gamespy address (The machine's IP4 also works).
    [​IMG]
    (If you're gonna have LAN party, the other guys need this program to run. They need to enter the IP4 address to the computer that's gonna host game.)
    7. exit for now.

    Part 9. ACTUALLY playing the game :p This procedure should be done WHENEVER you gonna play
    1. Head back to C:\Battlefield 2 Server Tools folder.
    2. Open xampp folder and start xampp
    control panel.
    a. Start Apache.
    b. Start MySQL.
    3. Open up Gamespy Emulator folder.
    a. Start LoginServer.exe.
    b. Start MasterServer.exe.
    4. Open up Battlefield 2 Dedicated Server Folder
    a. Start bf2_w32ded.exe.
    5. Open Gamespy Redirector folder
    a. Start BF2GamespyRedirector.exe
    b. Select the wanted mod.
    c. Select Service Provider.
    d. Edit Launch paramaters to your liking.
    e. LAUNCH BATTLEFIELD!!
    6. Create Multiplayer account.
    7. Change options to your liking.
    8. Click Multiplayer.
    9. Join local.
    10. Join your own server.
    11. ???? Wait for 62% to be over...
    12. Frag some bot n00bs and earn medals and stats!


    Installation video


    This took way longer than I imagined. I will probably read through this more thorough later and check for errors, but I'm too tired now.
     
    Last edited: Jan 14, 2022
    Sunnyghost, NUKE and MrNiceGuy like this.
  2. Hjaldrgud

    Hjaldrgud New Member

    Reservation post for a future guide on quality of life tips and tricks when using the program... ;)

    EDIT: Time to use this reservation.. I recently formatted my PC, and my video got many questions with people getting errors. I was going to reinstall anyway, so I figured a new follow along install guide was easy to make. Please, if you have had any problems, just follow along to everything I do. If I go too fast, just pause the video. If you still get any errors even after following me 100% accurately, then I cannot help you.

    BF2Statistics Web Edition v3 install "follow along" guide



    I also made a video showing how handy the BF2 Statistics Control Center program is to manage your private server even though you use the web edition. The BF2SCC has many QoL features that makes changing settings much easier.

    BF2Statistics Web Edition Easy Server Management


    I will maybe show how to add some constants like new weapon types and stuff, but I myself haven't had the time to experiment with it thoroughly. It's still in experimental phase.
     
    Last edited: Jan 16, 2022
    Wilson212 and MrNiceGuy like this.
  3. MrNiceGuy

    MrNiceGuy Founder Staff Member

    Great work :D

    Thanks for the contribution @Hjaldrgud
     
  4. Hjaldrgud

    Hjaldrgud New Member

    Here are some videos where I ramble about the database and game constants. Sadly I my PC crashes every time I edit in Adobe Premiere, so these are unedited and pretty bloated with me talking for way too long about a 17 year old game.

    Modding constants to add weapons, vehicles, armies, weapon types, vehicle types etc..
    Video about the constant file and how to add new stuff like new weapon, weapon types. The video should have been ten minutes, but I go on a long rant about bad award design/balance on Dice's part. Learn everything you need in order to get new equipment to register in the database!


    Modding database queries for better medal requirements
    Video about diversifying the award requirements by adding more to the database query. I had an eureka moment when trying to incorporate global revive requirements. Watch me live test and get excited.
     
    Last edited: May 10, 2022

Share This Page