Jump to content

Strange replay !


gameboy
 Share

Recommended Posts

@elexis Today, I sent replay a strange bug:, when I started a new single game, the game for more than a minute, I built the house in the game, and then I saved the game, quit the game. More than an hour later, I reloaded the game and continued the game until the end of the game, playing a total of 30 minutes and 59 seconds. When I replayed the game, and when I chose to replay the 30:59 replay file, I found that the house had not been built before, and the workers went directly to build other buildings. Why?

Link to comment
Share on other sites

You see those two commands.txt files right?

The first one ends at turn 312, the second one should start at turn 312 where it now says turn 0.

One could write a script to add 312 to every turn number in the second file.

Then one can copy&paste the files together.

Hm. Actually I have an old patch somewhere that plays replays from a savepoint.

Digging. Found. Alpha 21. You are lucky, the patch still applies.

You have to compile the game with the patch, unzip the savegame, then start pyrogenesis with -replay-visual="/path/to/second_replay/commands.txt" -load="/path/to/simulation.dat" and it should work in theory. I guess we could commit this part as a debugging feature if we don't priortize implementing it for the average user.

Index: source/ps/Game.cpp
===================================================================
--- source/ps/Game.cpp	(revision 18875)
+++ source/ps/Game.cpp	(working copy)
@@ -37,10 +37,11 @@
 #include "ps/LoaderThunks.h"
 #include "ps/Profile.h"
 #include "ps/Replay.h"
 #include "ps/Shapes.h"
 #include "ps/World.h"
+#include "ps/GameSetup/CmdLineArgs.h"
 #include "ps/GameSetup/GameSetup.h"
 #include "renderer/Renderer.h"
 #include "renderer/TimeManager.h"
 #include "renderer/WaterManager.h"
 #include "scriptinterface/ScriptInterface.h"
@@ -52,10 +53,12 @@
 #include "tools/atlas/GameInterface/GameLoop.h"
 
 extern bool g_GameRestarted;
 extern GameLoopState* g_AtlasGameLoop;
 
+extern CmdLineArgs g_args;
+
 /**
  * Globally accessible pointer to the CGame object.
  **/
 CGame *g_Game=NULL;
 
@@ -189,11 +192,21 @@ bool CGame::StartVisualReplay(const std:
 	JSContext* cx = scriptInterface.GetContext();
 	JSAutoRequest rq(cx);
 
 	JS::RootedValue attribs(cx);
 	scriptInterface.ParseJSON(line, &attribs);
-	StartGame(&attribs, "");
+
+	CStr savegame = "";
+	if (g_args.Has("load"))
+	{
+		std::ifstream file (g_args.Get("load").c_str(), std::ifstream::in);
+		std::stringstream buffer;
+		buffer << file.rdbuf();
+		savegame = buffer.str();
+	}
+
+	StartGame(&attribs, savegame);
 
 	return true;
 }
 
 /**

 

  • Like 1
Link to comment
Share on other sites

I didn't actually test the patch since a year ago, so I don't knowif it will be successful, but it should work  because the relevant code didn't change.

Apply the patch and compile the game.

Rename your savegame to something.zip and you can use any zip program to unzip it.

The zip folder contains a simulation.dat file. The replay contains a commands.txt file. You need both.

If you are on Windows, you need to execute the following command: pyrogenesis.exe -load="C:\folder\simulation.dat" -visual-replay="C:\folder\commands.txt"

load_simstate+visual_replay.diff

  • Like 1
Link to comment
Share on other sites

@elexis If I only use the patches you give, instead of using commands: can pyrogenesis.exe -load=, "C:\\folder\\simulation.dat", "-visual-replay=", "C:\\folder\\commands.txt" connect two replays together? To achieve the same effect as using commands?

Ah, A bad news : I tested this patch, and two replay files were not connected. The first replay was 2 minutes, and the second one had six minutes. When I loaded second repeats, the first replay of the house wasn't built.

Edited by gameboy
Link to comment
Share on other sites

@elexisYes, I'm sure I used your patch, I tested it, I did the same test, but the two replay files didn't connect.

D:\trunk\binaries\system>pyrogenesis.exe -load=C:\Users\lg2015\Documents\My Games\0ad\replays\0.0.23\2017-11-16_0003\metadata.json -visual-replay=C:\Users\lg2015\Documents\My Games\0ad\replays\0.0.23\2017-11-16_0003\commands.txt

Edited by gameboy
Link to comment
Share on other sites

-load=C:\Users\lg2015\Documents\My Games\0ad\replays\0.0.23\2017-11-16_0003\metadata.json

NOT metadata.json but simulation.dat!

The simulation.dat is inside the savegame of that replay.

The savegame has the fileending .0adsave, must be renamed to .zip and unzipped as I mentioned above.

Link to comment
Share on other sites

I didn't find the file simulation.dat. I don't know where it is            There's no file here: C:\Users\lg2015\Documents\My Games\0ad\replays\0.0.23

Please tell me. thank you my friend.

Do I use the win10 64bit operating system to prevent the generation of this file: simulation.dat????

Edited by gameboy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...