Does the game have to be running for this to work?
Game does not have to be running for this to work!
The .exe does take a little while to load. Did you close it yourself, or did the command prompt (black box) open and then close by itself?
If you run the .exe from the command prompt directly, it won't automatically disappear when it completes. If there was an error, you can then see what it is and report what you see here.
Things to double-check: make sure that the ai_wars.txt file is pointing to your game in the file="..." line. For instance, if you want to run this for Game7, make sure it is "./Game7/Autosave.bcs". Switch Game7 to a different game number to run for a different game -- the tensions will be stored.
Post by tortugapower on Jun 20, 2019 16:43:45 GMT -5
Updated to v0.305, which mostly changes how the settings file is parsed and loaded.
clevebro If you have a chance to download the new version and check how it works, I'd be curious if at least it works with spaces in the directory now. (I don't think it will work with the localization issues yet.)
I'm leaving v0.302 as I haven't stress-tested v0.305, so it could have some big issue (although it ran for me).
Edit: ALSO. I am shifting my time to develop the Combat Auto-Resolve Simulator for RtW2. I can't do what I want to do with this one until we can somehow feed the game updates without having to quit and load the game. I'm happy to continue supporting this if people find issues.
And if any API-like structure is implemented into the game, I'll resume work on this.
I can't do what I want to do with this one until we can somehow feed the game updates without having to quit and load the game.
I gave a few minutes (no more) of thought to that. i have an idea that still needs some changes to RTW2, but should be a lot easier to implement than an API.
If the game .exe could take as an argument the game save, and if the game was activated (with licence and so on) directly load the save, we could be doing something like:
0) start the game throught a script 1) the script looks at the savegame every second or so 2) if the save game changes, after a short delay (to make sure that all files are saved), the script close the game 3) the script runs the AI wars 4) the script restart the game with something like "rtw2.exe -game1" 5) the game is restarted with the AI wars done.
So the player would have to suffer a few seconds delay when saving the game but that's it.
Bonus for the testers: The testers also could use the command line argument, and have a cycle of modify the game file => test => modify the game file => test... that would be lot faster than if they have to manually load the save game each time.
And finally this has no impact at all on the "normal" player.
Last Edit: Jun 27, 2019 1:17:39 GMT -5 by Capsized
Post by tortugapower on Jun 27, 2019 2:54:19 GMT -5
Capsized I'm all ears! Closing a program and opening another program worries me in that it might be considered malaware by most virus protection or security software.
I think even a simple "Load Game" button from inside the game itself, next to the Resign and next turn buttons, might even help this mod along.
The best way is if the game can look at a file (e.g. "input.txt") and check a parameter there (e.g. load=0). If load=1, then it pulls in data from the file, overwriting the existing game state for those variables. That would allow full interactions.
And that gives some useable results. In a few minutes I made a macro will double click on my AI wars shortcut, close it as soon as it shows its window, then double click the RTW2 shortcut, confirms that yes I want to play, and finally click "continue" to load the savegame. It would be easy to modify it to first save and close RTW2 before starting the AI wars.
The macro is very brittle: it uses the screen coordinates so if a window is a few pixels left or right (or up or down) from the expected position it will not work correctly.
On my PC it takes around 17 seconds from starting the macro until the game is ready to play, with something like 12s for the AI war script part. So not very fast but OK if it is run every few months.
Post by tortugapower on Aug 19, 2019 11:00:06 GMT -5
Capsized actually (unwittingly) gave me an idea. I think I can upgrade this mod's usefulness by simplifying the save/reload interaction. I think I can store the ships that should be sunk in a log, and then allow the user to tell the GUI when they want to update the game files.
This will allow the mod to run wars over months without exiting to refresh the game and then apply these to the game when the user chooses. The game just won't know about any ship sinkings until the mod is told to refresh the game (and the usual Save/Load + mod restart is done).
Post by captainsilver on Nov 10, 2019 6:40:15 GMT -5
Having some issues with installing the mod, similar to what clevebro was having. It spits out the error message of the file not being found before closing the command prompt window immediately. I don't really understand the difference between the Japanese or German localisation (thingy) so I don't exactly know how to fix this.
I am trying to get ver 3.06 to work. I get to a scenario in the game. Save and exit. Run the .exe from the save folder, Game1 and the chart appears showing the current war along with a command window. I close both windows. When I reenter the game the scenario has not been played. My question is what file should the script be accessing. In one response you have Autosave.bcs and the other RTWGame1.bcs ( I am playing Game1). In the video you reference a RTWGame1.sac when you talk about the backup save. I also have no log.txt created. Any ideas
# File settings file='D:\NWS\Rule the Waves 2\Save\Game1\Autosave.bcs' refresh=0.255
# AI War Parameters chance_of_peace = 0.15 chance_of_battle = 0.40 pct_small_battles = 0.80
Game installed ion D drive
This is what appears in command prompt Settings: 0.255, 0.15, 0.4, 0.8.
Could not load existing tensions file.
[[ 1 4 53 8 4 3 3]
[ 0 0 2 0 3 3 1]
[ 0 0 1 1 1 1 1]
[ 0 0 0 5 3 2 2]
[ 0 0 0 0 0 2 0]
[ 0 0 0 0 0 2 1]
[ 0 0 0 0 0 0 1]]
Start up wars:
File changed: same date.
I am an Administrator on the computer.
Last Edit: Nov 22, 2019 17:34:26 GMT -5 by rtello45
Post by tortugapower on Dec 23, 2019 16:44:05 GMT -5
rtello45 : sorry, I didn't check the Mod forum recently!
For you and any others, feel free to mention me directly: @tortugapower
As for your problem, rtello, this mod is designed to run at the same time as the game. So you run the AI mod, then run the game, and advance the months in the game. You will see what happens each new month in the AI mod GUI.
If ships are being sunk, you have to exit the RtW game (without saving) and reload the Autosave.
I think Fredrik is working on having load-game functionality from within the game, which will help smooth out this tedious process in the future.