I keep making updates to the Fwatch 1.16 / OFP Game Schedule and I felt like writing about the more important changes.
Island Cutscenes
Operation Flashpoint (also known as Arma: Cold War Assault) has a nice feature where it will display a premade cutscene for the currently loaded island.
The blunder (one among many) is that the cutscene has to be in an external location instead of being packed in the same addon. So either you store it in the dta\scripts.pbo (which you do not always want to replace) or in one of the game directories (usually addons) which complicates the installation process and creates a mess.
Up until now my solution to this problem was to store the cutscene in a modfolder and change the island’s configuration so that it will read cutscene from that mod. The shortcoming of this fix is that the cutscene is now locked to a specific modfolder and you can’t change the mod’s name. Also I have to investigate and edit addons which is time-consuming.
Rożek suggested to simply move data from the mod to the game directories (when the mod is loaded) just like I already do it with missions (since Fwatch 1.14 from 2015). I’ve implemented this and now cutscenes are moved from the mod\IslandCutscenes to the addons folder.
I appreciate the tip but I don’t appreciate that I had to went back and revert changes in 8 mods 😉 Still, this is much better because I don’t have to modify addons anymore which means less work and less confusion when identifying addon versions.
I was surprised by this idea because I haven’t thought of it and it made me wonder what other simple things I’m not seeing.
Modfolder Missions
While coding this feature I thought that I might as well handle other types of missions: the ones for the Mission Wizard (I don’t think anybody ever used them but just in case) and for the Mission Editor.
See list of folders that Fwatch moves.
This is convenient because:
- missions are easier to access
- you can segregate them and reduce mess
- all the necessary files are contained within the modfolder so it’s easier to transfer it to other computers
Mods are truly modular now and I’m really happy about it.
Correcting PBOs
While reverting changes to the islands I’ve noticed that addons wouldn’t match. Apparently Mikero’s MakePbo.exe 1.75 DLL 3.52 shifts modification dates by one hour while packing files into a PBO archive. At first I thought every user would have different files but after an investigation it turned out it shifts timestamps exactly the same way everywhere – it’s not time zone dependent (thanks to Seth Barcello for testing).
As long as every user follows the same installation scripts from the GS website then there’s no cause for concern but I’ve still implemented a fix:
- Addon Installer will correct timestamps when using MAKEPBO command
- Fwatch 1.16 will correct timestamps when using :exe makepbo command
- It can be done manually via PBOfilelist program
I revisited all the installation scripts that ever used MAKEPBO command and redone the PBO packing in 10 mods.
Why is having completely identical PBOs important?
I probably wouldn’t pay attention to this issue if it wasn’t for Rożek using checkfiles[]
feature on his dedicated server which can be used to identify cheaters. If player’s PBO is different from the server’s PBO then a message will show up informing that this user has modified files. It will appear even if the files inside a PBO are identical but timestamps aren’t (because the file hash will be different).
Another benefit is that players won’t have to download missions from the server if they already have them on their own computers and you can start playing the game much sooner.
It’s also convenient when you’re investigating contents of the addons and comparing versions. Different file dates cause a confusion: why is modification time different if the contents are identical?
Timestamps in Installation Scripts
To make files identical on every computer Addon Installer will set the file modification date (when using EDIT and MAKEPBO commands) to the date the particular mod version was added.
I’ve recently added FILEDATE command so that you can control timestamps manually.
While working on the PBO timestamps issue I’ve noticed there was a bug in the GS: when you’ve added a version jump then Addon Installer would use the date of that jump instead of the date of the version being jumped to. It’s fixed now.
However, there is a problem with applying future changes to a version jump that includes EDIT and MAKEPBO commands. If I add a new version of the mod and modify the existing version jump to link to that new version then Addon Installer will set different timestamps and new users won’t have identical PBOs anymore. Obvious solution is to modify the script and add FILEDATE after every EDIT and MAKEPBO but it’s easy to forget about this! I could make the website do this automatically but it only creates further problems:
- if you want update the addon in the future the don’t forget to remove the FILEDATE command
- the same installation script can’t be shared between sequential updates and version jumps
I’m not sure yet how I’m going to tackle this issue.
Localization
OFP Game Schedule is now available in Polish. While translating I’ve noticed that my English writings on the website were overly terse and probably confusing for the users so I’ve elaborated some phrases and I hope it’s clearer now.
Character Encoding
The unfortunate reality of OFP is that it’s an old game that’s not Unicode compatible (now that I think about it even COD4 from 2007 wasn’t). Languages have their own coding, different files, they’re not compatible with each other and now you need to handle it somehow (or don’t if you’re smart and have moved to ARMA).
Unicode characters that users input on the website have to be converted to the Windows code page before sending them to the game. Second problem is that non-Russian users won’t see Cyrillic alphabet because they have different set of fonts.
The approach I took in 2019 was to convert cyrillic to the English phonemes. Now that there are three localizations every language has to have its own conversion key. When the user requests information from the website, current language setting (from flashpoint.cfg or ColdWarAssault.cfg) is sent along and afterwards the site responds in the following manner:
- English players receive Russian in English phonemes and Polish stripped of diacritics
- Russian players receive English without changes and Polish stripped of diacritics
- Polish players receive English without changes and Russian phonetically in Polish
Surprisingly I had fun coding this. It’s a niche that I believe few care about and I like filling it by making the game more comfortable for people from other countries. Also coming up with phonemes was amusing.
See source code of the function.
Conversion in the Installation Scripts
While adding ECP mod to the database I had a need for the installation script to contain Windows code page characters. I’ve typed them as html entities and made the website decode it when serving a request. It’s not a great solution but it will do for now. Would have been more convenient if conversion was done automatically but what if you want to have both Unicode and Windows code page in the same text? For example Unicode Cyrillic as a comment in an OFP script and Windows-1251 Cyrillic as a string for the game. I’m not sure yet how I’m going to tackle this issue.
Automatic Update Check
Alex Mercer had a feature request to check for mod updates when you launch the game. This is done through dta\anims.pbo replacement. If applied the game will show how many mod updates there are, whether new Fwatch build is available and current installation status.
I’ve updated 10 mods so that they’ll get the new file. For vanilla replace it manually or use installer.
The challenge I had with this part was that processing downloaded information would cause the game to freeze for a second or two. This is not pleasant so I moved the code from SQF to SQS making the work done across multiple frames rather than all of it in a single frame (but with less convenient syntax). That’s an improvement but it would still stutter so I’ve added a sleep line to the script (aka intentionally slowed it down) when performing automated check (but not when user is doing it manually through the menu).
Now the FPS is fine but it takes a few seconds for the message to show up. As the number of mods on the website increases I might perform this calculation on the server-side in the future.
Addon Installer
As my ideas for the installation standard change the code has to follow and so I’ve done a major restructuring which I’m proud of. This is more relevant to me than to other users but nevertheless some practical changes have been made.
Mirror URLs can now be placed between curly brackets so that it’s more convenient to edit them. In my installation scripts (example) I’ve made files.ofpisnotdead.com a top domain. This site is hosted by retrocz and it’s fast and reliable. Thanks!
Automatic installation algorithm has been upgraded. Folders that were previously ignored will now be processed. Mission type detection was improved and they’ll be sorted into appropriate folders. Of course it doesn’t handle every case but I think it should work for most of the addon / mod packages that were made.
See changelog for more details.