August 05, 2020, 01:24:54 pm
Username:

Password:

Topic: FOClassic tutorials  (Read 1399 times)

Slowhand

  • Posts: 263
  • Go for the eye, Boo! Go for the eyes!
    • View Profile
FOClassic tutorials
« on: January 03, 2020, 10:17:24 am »
This is a brief development tutorial for developing FOClassic. I'll give step by step instruction how to set FOClassic up using Mojuk's PReloaded example.
 
Another copy of this tutorial can be found at fodev.

FOClassic tutorials.

Contents:
« Last Edit: January 03, 2020, 10:22:21 am by Slowhand »

Slowhand

  • Posts: 263
  • Go for the eye, Boo! Go for the eyes!
    • View Profile
General Questions and Answers about PReloaded, FOClassic and this guide.
« Reply #1 on: January 03, 2020, 10:18:12 am »
1.1 General Questions and Answer about PReloaded, FOClassic and this guide.

First of all, please note that these are my views and experiences, and that they may differ from PReloaded and FOClassic creator's views. Consider their comments or answers in this regard.

Q: Shall I use FOClassic, Reloaded or the original SDK to implement my own ideas and share with the public?
A: That depends on what you want to do, and you current experience with FOnline
  • Important: If you have 0 experience with FOnline, you better check out the Reloaded source and the Basic tutorials as that's the easiest to start out with.
  • If you want contribute maps, then again, Reloaded source, the basic tutorials and the mapper tutorials floating around are best to start with.
  • If you want to contribute in scripts, you might have to install both Reloaded and PReloaded+FOClassic, depending what the script does. For example: The Caravan packer script I made some while ago, would need Reloaded to have a caravan packer ready, but the Blackjack module would require PReloaded instead, to be up to date with server code and engine.
  • If you want to do fixes or contribution that are hard coded into the engine, obviously you'll have to use either FOclassic or the original SDK.
  • If you want to do script contributions specifically for FOnline: Reloaded, do not use the original SDK, but PReloaded (with or without FOClassic) as this will make the Reloaded devs have an easier integration.

Q: Why make this guide?
A: For same reasons I did the Basic and Advanced FOnline tutorials. First, because I tend to forget stuff, second because I believe in the laziness of people. If you put a step-by-step guide in front of them, the likelihood for them to try or not give up after the first/second pitfall, is much higher. This doesn't mean that we will get flooded by FOnline devs, it's just people get an easier time passing the first few tests..

Q: Who is this guide aimed at?
A: People who would like to see/test/mod FOClassic along with engine source. As far as I know, only FOnline Reloaded uses FOClassic as engine base, however the engine source should help anyone figure out stuff, that was not possible without external help before, as long as the code they work with is close to the 4.12 version of the engine. Also, as every guide I made, is aimed for myself as well, I get long breaks between FOnline devving, so I don't have to reinvent the wheel or bother people with same questions all the time.

Q: Why PReloaded?
A: Because the other options are getting a 4.12 version working from the SDK, and adding all the FOClassic changes up to the latest version which at the point when this was written which is V7. In short, it is very easy to set up FOClassic using the PReloaded example for the first time, however it has some pitfalls to be aware of, hence the guide.

Q: What does PReloaded contain?
A: It contains features from FOnline Reloaded, without the actual content. It's useful for testing, setting up FOClassic for the first time, but mostly for that only. Actual content has to be added to be playable, which is a lot of work. If you have mods, new content or new features you coded yourself, you can use PReloaded to share it, keeping it up to date with FOClassic, thus helping anyone depending on FOClassic features.

Q: How does this help me as a server owner?
A: I don't know to be honest, it's just a general setup. If you have difficulties setting up FOClassic, at least this was you have a working example and maybe you are able to solve issues comparing yours to this. Also, I believe that the old server owners are familiar with this stuff, I highly doubt they will ever need to use this guide.

Q: What is the purpose of FOClassic?
A: That is answered elsewhere, but if you want to know my opinion, I look at it like this: Server owners main concern should not be Engine changes, for this, you got FOClassic devs. Server owners main concern should be managing the server (keeping rules, up time, etc) and adding content to it. This leads to the conclusion, that FOClassic should be the solution for hardcore changes or improvements for those servers who cannot afford such features themselves but are obviously desired by most iterations. In short, solving the underlying structural changes to have a less hard coded interface, readable sized text, etc.

« Last Edit: January 03, 2020, 10:57:13 am by Slowhand »

Slowhand

  • Posts: 263
  • Go for the eye, Boo! Go for the eyes!
    • View Profile
Setting up PReloaded
« Reply #2 on: January 03, 2020, 10:18:43 am »
1.2 Setting up PReloaded

  • Install git:
    • Check external sites for details, here is an example, you can download git from here.
    • Once done, you will be able to start a git-bash by Right Click -> "Git Bash Here", first navigate to the folder you would like to set FOClassic up to.
    • My choices when installing Git, this should work:
      • Notepad++ as default text editor when option was available, but it doesn't really matter.
      • "Git as comand line and also 3rd party tools."
      • Use the OpenSSL library
      • Checkout Windows-style, commit Unix-style line endings.
      • Use MinTTY (the default terminal of MSYS2)
      • Note: Do not open git-gui, we will use git-bash instead.
  • Getting PReloaded using git clone: (might be slow / several hours, but try it, this is the proper way)
    • Navigate to a folder where you want to set it up, then Right click -> Git Bash Here to open the git console.
    • Open Mojuk's PReloaded example on Github in a browser and click on <Code> -> Clone or download -> Copy the URL (it should be https://github.com/mojuk7/PReloaded.git)
    • In your git-bash console type: git clone https://github.com/mojuk7/PReloaded.git
    • You can also use Shift + Ins to paste from clipboard to git-bash console. The last command will take a while, wait it out.
    • There is/was one problem with this method, (I believe) that the base.zip file makes some of the checks git makes extra slow as it contains shitton of small files. I do not know how long it took exactly, but I went to sleep while checking out and in the morning it was done. (PC not too old: Intel Core i7-7700K CPU @4.20GHz / 16 GB RAM / SSD)
    • Copy the fallout.dat file from any other version to the Client main folder, right where the exe's are. If you do not do this, you get a message that the game needs update.
  • Getting PReloaded via download as zip: (alternative way, not recommended)
    • Open Mojuk's PReloaded example on Github in a browser and click on <Code> -> Clone or download -> Download ZIP
    • Navigate to the folder where you extracted the zip, then Right click -> Git Bash Here to open the git console.
    • In your git-bash console type: git init
    • git status - you should see some red text of untracked files, don't worry.
    • Manually download the following 3 zip files and copy them to their respective place (overwrite):
    • Copy the fallout.dat file from any other version to the Client main folder, right where the exe's are. If you do not do this, you get a message that the game needs update.
    • git add . - this will add all untracked files to be ready to committed.
    • git commit -a -m "Fix: Added missing zip files." - this will add commit all changes, the -m makes sure Notepad++ doesn't pop up ad confuse you, otherwise you could use that as well to add longer commit message. You will get a lot of white text, something create mode bla bla, that is good.
    • Do a git status again to see if everything all right. At this point, your server/client should be able to run, test it as described in the next step.
    • Optionally add remote so you can get updates later on: git remote add origin https://github.com/mojuk7/PReloaded.git
  • Try out if it works.
    • Start the Server and wait for the scripts/everything to load, when it's done, you will see something like this: ***   Starting game loop   ***
    • Start the Client, create new char, log in. If no errors, then you are done with the setup.

Additional notes:
  • The fallout.dat file cannot be found in FOclassic or PReloaded due to copyright reasons, but you can find it in any iteration of FOnline in the Client folder. You can go on top of this web page to Home -> Status and download a client from any of the working servers website, or simply from the FOnline Reloaded distribution mentioned in previous tutorials.

Slowhand

  • Posts: 263
  • Go for the eye, Boo! Go for the eyes!
    • View Profile
Setting up FOClassic
« Reply #3 on: January 03, 2020, 10:19:12 am »
1.3 Setting up FOClassic

First, look at the Readme.md of the FOClassic source at GitHub. The steps I described below will be more detailed, but essentially the same.

  • Getting and preparing FOClassic source:
    • Start up git-bash in the folder you want to get the source to, (suggested the root of your ../PReloaded/ folder) and use git clone https://github.com/rotators/foclassic.git to clone it.
    • Typing git status should return and error (Fatal: Not in a git repo..) so do a cd foclassic to get in business. Next git status should be okay.
    • Next, to avoid Pitfall #1, do a git checkout dev to use the 'dev' branch, which is the latest and currently compatible version with PReloaded.
    • Following the read-me, do the sub-module update: git submodule update --init --recursive
    • Create a build folder, (recommended SDK*) you can do this using the git-bash: mkdir SDK_V7 Make sure that the folder you make starts with SDK, because this is added to .gitignore already, meaning that git status and other commands will ignore it, which they should.
  • Building from source:
    • First, you need to install cmake if you haven't:
      • Download from here, I used the msi installer using default options.
    • Next, you need to install Visual Studio 2010 Express (and optionally Visual Studio 2017 Community Edition both of them being free):
      • Download from here, you need to scroll to bottom and find 2010 and need to to log in into your Microsoft Account to be able to download. If you don't have one or don't want to create one, you can use chocolatey to install from Windows Power Shell having administrative rights. (For me, for some reason it did not allow to download, not even logging in into MS, hence the chocolatey option mentioned)
      • To install chocolatey check the full guide here or just:
        • Run PowerShell as administrator and issue following comamnds:
        • Set-ExecutionPolicy AllSigned
        • Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
      • Run choco install vcexpress2010 in the same powershell you installed chocolatey with.
      • Optional: To install Visual Studio 2017
        • Run choco install visualstudio2017community
        • If you try to build now with VS2017, cmake will not find any VS, so additional setup is required to enable C++ build tools from console. Launch Visual Studio 2017 from start menu.
        • Go to Tools -> Get Tools and Features
        • In the Workloads tab, check in Desktop development with C++ and click on Modify
    • Once both tools are ready, navigate to the SDK* you created before and issue the following command in powershell/console: cmake -G "Visual Studio 10" FOclassic/Main/Folder/ - replace the last part with your main folder of FOClassic.
      • Optional: To compile with VS2017 use the following command instead: cmake -G "Visual Studio 15" -T v100 FOclassic/Main/Folder/
    • You might get two failures on HAVE_STRUCT_TIMESPEC and pthread.h but everything else should be okay.
    • Notice that your SDK folder gets filled with a lot of stuff. Launch Visual Studio 2010 and load the solution file at: ../foclassic/SDK_V7/FoClassic.sln
    • Wait for it to finish loading and press F7 or select build solution from the menu: Debug -> Build solution
    • You should see the following line at end, or something similar without any errors: ========== Build: 22 succeeded, 0 failed, 0 up-to-date, 4 skipped ==========
    • The new exe files for the client, server and mapper should be in the ../foclassic/SDK_V7/FOClassic-v7/ folder. Make sure you copy the pdb files as well to the respective locations with their exe files, and you are ready to test the game.
  • Try out if it works.
    • Copy (overwrite) the server and the client files compiled in the last step to the PReloaded server and client folders as followed:
      • ../foclassic/SDK_V7/FOClassic-v7/ClientDX.exe -> ../PReloaded/Client/
      • ../foclassic/SDK_V7/FOClassic-v7/ClientDX.pdb -> ../PReloaded/Client/
      • ../foclassic/SDK_V7/FOClassic-v7/ClientGL.exe -> ../PReloaded/Client/
      • ../foclassic/SDK_V7/FOClassic-v7/ClientGL.pdb -> ../PReloaded/Client/
      • ../foclassic/SDK_V7/FOClassic-v7/Server.exe -> ../PReloaded/Server/
      • ../foclassic/SDK_V7/FOClassic-v7/Server.pdb -> ../PReloaded/Server/
    • Optionally the mapper files as well for future use:
      • ../foclassic/SDK_V7/FOClassic-v7/MapperDX.exe -> ../PReloaded/Mapper/
      • ../foclassic/SDK_V7/FOClassic-v7/MapperDX.pdb -> ../PReloaded/Mapper/
      • ../foclassic/SDK_V7/FOClassic-v7/MapperGL.exe -> ../PReloaded/Mapper/
      • ../foclassic/SDK_V7/FOClassic-v7/MapperGL.pdb -> ../PReloaded/Mapper/
    • Start the Server and wait for the scripts/everything to load, when it's done, you will see something like this: ***   Starting game loop   ***
    • Start the Client, create new char, log in. If no errors, then you are done with the setup.

Additional notes:
  • In the future, if the PReloaded and FOClassic gets desynced, you can try to check GitHub or use git commands to get the latest version of both before 2020 jan 1, and use that as your first working example. Otherwise bug Mojuk or Wipe on Rotators/FOclassic discord.

Slowhand

  • Posts: 263
  • Go for the eye, Boo! Go for the eyes!
    • View Profile
1.4 What's next?
« Reply #4 on: January 03, 2020, 10:19:47 am »
1.4 What's next?

  • Finding and using the right tool for you:
    • Visual Studio 2010 Express is very outdated. The one I installed didn't even have 2010-ish, basic development features, making it a worse editor or viewer than an up to date Notepad++. Autocomplete, Go to definition/implementation, Call hierarchy and etc. features (to say the least) are a must have to operate on huge projects.
    • Visual Studio 2017 Community Edition has already enough features to work with, at least on cpp files.
    • For Angel Script files, even Visual Studio 2008 can do the trick, some devs use that, I used Code::Blocks before, any tool is good enough as long is it has code completion/intellisense and jump to definition functions, it's good enough. For this reason using Notepad++ is not recommended anymore.