Author Topic: FOClassic tutorials  (Read 943 times)

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
FOClassic tutorials
« on: January 01, 2020, 08:41:55 pm »
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 Reloaded forum but I belive you need to log into the forums to be able to see it.

FOClassic tutorials.

Contents:
« Last Edit: September 16, 2020, 04:20:51 pm by Slowhand »

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
General Questions and Answers about PReloaded, FOClassic and this guide.
« Reply #1 on: January 01, 2020, 08:42:18 pm »
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: 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: Shall I use FOClassic, Reloaded or the original SDK to start a new server where I want to implement my own ideas?
A: If you have 0 experience with FOnline, you better check out the Reloaded source on the other tutorials as that's the easiest to start out with. That also has a lot of content available, compared to this one. Next step would be to install and use FOClassic, and import any content you want to keep from the Reloaded source, or from the SDK. This was you will get a lot of experience with it, and have better control. Engine wise, either go with SDK or FOClassic. I do not have much experience with the SDK, so you might ask someone else about that.

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 02, 2020, 10:07:17 pm by Slowhand »

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
Setting up PReloaded
« Reply #2 on: January 02, 2020, 01:50:50 pm »
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.
« Last Edit: January 02, 2020, 07:46:59 pm by Slowhand »

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
Setting up FOClassic
« Reply #3 on: January 02, 2020, 01:51:43 pm »
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.
      • Recommended: 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.
      • Recommended: 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.
  • If you want to back up and use a working copy in a different folder, make sure to delete the SDK folder and recompile with cmake in powershell otherwise the solution file will reference to the old version, and you might work in a different folder than you think.
  • Use VS2017 if you can, much better than 2010 express. I changed it in the guide from Optional to Recommended. 
« Last Edit: January 17, 2020, 11:50:14 pm by Slowhand »

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
1.4 What's next?
« Reply #4 on: January 02, 2020, 08:23:46 pm »
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.
  • Merging content into FOClassic/PReloaded:
    • As you could have found out by now, PReloaded doesn't have much content available, so let's merge the Season 2 content from Reloaded into it. I'll do this and mention honorable pitfall I encounter if any. It will be available as a git repo when it's done.
    • Next step, creating/finishing up the tutorial for newcomers.
« Last Edit: September 15, 2020, 10:50:38 am by Slowhand »

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
1.5 FOClassic - Brave New World update (some modifications I made and shared)
« Reply #5 on: September 15, 2020, 06:04:55 pm »
1.5 FOClassic - Brave New World update (some modifications I made and shared)

  • Source/Content:
    • FOClassic and PReloaded - source is based on the two repos above. If you had trouble setting them up and working together, you can use this version with some tweaks and a starting proper location. Check installation section for instructions.
    • Lander's Point - this is the tutorial zone from Reloaded S3. Kilgore from the FOnline: Reloaded team shared and allowed me to use this gem, providing I do some updates to it. Improving of this zone is a work in progress... I did more generic changes but plan to improve this zone as well.
    • I think I added half of Hub from Reloaded S2, but I didn't finish it, no other content is available from previous public FOnline iterations.
  • Feature list:
    • Jinxed Jack interface - this interface was created for Reloaded years ago by Stanislaw Bieniek and I have updated it to work on Reloaded and ofc on FOClassic/PReloaded as well.
    • Item highlighter - is a new feature that will show a yellow outline for items and containers, making cave searching easier and community made interface hacks obsolete.
      • Press W for toggle.
      • TODO: Pressing W while on login or registration screen will toggle this behaviour, so new players could log in with it enabled, which is not desired. Add a fix to this.
    • Quest notifier - quest progress will visualize on the screen as a big tab on the left side. Different colors are used depending if quest has been started, failed, completed or repeatable.
      • The Pip-boy messages will be used, as defined in the /Server/text/engl/FOQUEST.MSG file, lines starting with the following will be processed as:
        • Quest start (header):
          • Story - main quest line, colored orange, prefixed with STORY.
          • Job - repeatable tasks, colored yellow, prefixed with JOB.
          • Quest (default) - not repeatable side quest, colored sand, prefixed with QUEST also if there is no prefix, this is the default for backwards compatibility.
        • Quest progress (message):
          • Done (default) - when the quest is done and player can return for the reward, colored light green, prefixed with DONE.
          • Soft failed - repeatable quest failed, but player can try it again later, colored dark orange, prefixed with SOFT_FAILED.
          • Hard failed - quest failed and player cannot try again, colored red, prefixed with HARD_FAILED.
          • Repeatable finished - repeatable quest finished and player may do this quest at a later time, colored blue, prefixed with SOFT_COMPLETED.
          • Finished - non repeatable quest finished, colored dark green, prefixed with HARD_COMPLETED.
      • TODO: Move quest coloring to ini/cfg file to make it configurable, atm you can change colors in the /PReloaded/Server/scripts/client_questTracker.fos script file.
      • TODO: When player relogs, the last quest progress will pop up. This may not be desired, to be suppressed.
    • Inventory tracker - items gained will pop up on the right side of the screen, notifying the players if they gain or loose items.
      • There are some minor visual bugs, that I couldn't fix, for example when split dropping something the amount will not be shown.
      • TODO: Make it configurable via ini/cfg files and later on the fly in game.
      • TODO: When dropping via split, replace '?' with 'some'.
    • Right click move combat crosshair - mouse behaviour is updated to modern standards:
      • Ctrl + F1 - toggle legacy mouse behaviour. (Bug: you have to press F1 again, because the help screen would pop up)
      • In all cases - except legacy mode - left click will perform selected action, while right click will move to location. While in attack/default mode, moving with right click will show the hex distance and the location the move command was issued. This is for convenience and better look and feel.
      • Q - set crosshair to default interact mode, left click with interact/look, right click will move to location.
      • A - set crosshair to attack mode as before, left click with attack, right click will move to location.
      • M - set crosshair to move mode, both left click and right click will move to location.
      • TODO: Minor - Add a click 'animation' to right click or move mode for look and feel. Atm the indication that the mouse pressed was registered is that the character will try to move toward location.
    • Hard coded default hotkeys changes - keys that are not vital during game play have been moved to less reachable keys, away from WASD keys.
      • Q now sets mouse mode to default interaction mode (the line of sight range outline has been moved to [)
      • W now toggles item highlighter (the weapon range outline has been moved to ])
      • S is now free and later should be used to 'stop' current action/animation (the skills panel has been moved to Y)
      • F is now free (the fix-boy panel has been moved to U)
      • M now sets mouse mode to move (old behaviour preserved in legacy mode only)
  • Bug fixes:
    • Click through fix-boy bug: Fixed a bug where you could click through fix-boy and register it as a move or interaction command, making your character move instead of select which item to craft.
  • Todo:
    • Cleanup - there are some unwanted debug messages, logs that need to be cleaned up.
    • Release branch - currently the master branch is being used as dev and many of the feature changes have cross commits that make it harder to introduce to other repos one by one. Need to add a clean release branch that includes features or bug fixes in one separate commit only.
  • Installation:
    • To integrate to your own repo, you must check the change lists and import the code manually.
    • To just try it out you can:
      • Download the as a zip file from https://github.com/Sasabmeg/FOnline-BraveNewWorld
      • Due to some git phenomenon the JinxedJack.zip, nevada_art.zip and new_critters.zip files need to be downloaded separately as a zip and added to the respective location: /PReloaded/Client/data/
      • As usual, the fallout.dat file is not included, so you need to download that from any other game client or use the fallout data files from original Fallout installation.
      • As usual, delete cache - contents of the /PReloaded/Client/data/cache/ folder.

« Last Edit: Yesterday at 04:53:36 pm by Slowhand »