Weird (but probably simple) problem with 'RunAGSGame' [SOLVED]

Started by Creator, Wed 15/10/2008 08:02:09

Previous topic - Next topic

Creator

I'm trying to run a previous game I've made with AGS 3.0.2 SP1 from another game made with the same version. My code is:

Code: ags

RunAGSGame("Game.exe", 0, 0);


The problem is that when I try to run 'Game' from the previous game I get this:

---------------------------
Adventure Game Studio
---------------------------
An error has occurred. Please contact the game author for support, as this
is likely to be a scripting error and not a bug in AGS.
(ACI version 3.02.1025)


Error: Unable to load 'room1.crm'. This room file is assigned to a different game.

---------------------------
OK   
---------------------------

I know the problem is something to do with room1.crm and the two different game files, but I don't know exactly what, so I was hoping that someone could help me solve this.

RickJ

Here are a couple things that come to mind that you can check out.  I've not seen or heard of this before so I can't be certain of anything.problem

Do you have both exe files in the compiled folder?   
Are there any room.crm files in the same folder as the exe files?   
Have you tried doing a "rebuild all" on both games?

monkey0506

I've actually experienced the same error when I copy a CRM from one game project to another...any relation here? The rebuild all may fix it if that's the case.

Creator

Thanks for the quick replys.

Quote from: RickJ on Wed 15/10/2008 08:25:05
Do you have both exe files in the compiled folder?   
Are there any room.crm files in the same folder as the exe files?   
Have you tried doing a "rebuild all" on both games?

Yes.
No.
Yes.

EDIT:
I just tried running the exe (of the first game) from the compiled folder. When I click on the button that activates the (second) game, it works. It was only in the editor that it didn't work. I guess that if I want to test the second game I'll have to run it from the compiled exe (of the first).

Gilbert

From what I'd read it's actually a [not very well-known] feature of AGS which causes this problem.

In Sierra SCI games, when they made a patch (to fix bugs mainly) you usually didn't need to replace (or patch) a whole data file of the original game. In fact they usuaily came in as small separate files which were to be placed in the games' folders. Remember that?

Actually you can do similar things with AGS. If you put individual CRM files, sound/music files, and the like in an AGS game's folder, the game will load the individual files instead of the data packed into the original game files (thus you can patch a game fixing minor bugs, etc. without users redownloading the whole game again, but things like modifying the global script and adding new sprites may still require recompilation).

When you test a game in the editor, because of speed issues and the features to trace/debug games I think, it actually loads the .agf, .crm, etc. files in the game's folder directly instead of creating a single .EXE file and then launches it(at least in V3+ I think, in V2.72 and earlier the editor will create the game.exe file before launching it, so people using old versions may not encounter this problem). This will cause a problem if RunAGSgame() is used while testing a game, when the external GAME.EXE is launched the engine may look for individual CRM files in the current folder (the parent games' folder) and decide to use it instead of those inside GAME.EXE.

I'm not sure if that is considered a glitch or limitation, it's worthy to bring this up the the technical forum though. I'll wait until CJ sees this topic. (Don't know whether it is fixed in newest 3.1 beta or not, I bet not, but you may try it as you like.)

Even though running the .EXE directly form the compiled folder is a workaround, the lack of the benefit of using the debug features of the editor is a let-down.

Creator

Quote from: Gilbet V7000a on Wed 15/10/2008 09:54:56
Even though running the .EXE directly form the compiled folder is a workaround, the lack of the benefit of using the debug features of the editor is a let-down.

Just to clarify, since the game/patch is made with AGS separately from the actual game itself, wouldn't you be able to debug the patch in the editor (hard to explain, sorry if it doesn't make sense)?

Pumaman

Interesting point, yes RunAGSGame won't work if you're using the editor debugger at the time, for the reasons Gilbet explains. I'll change the next version to display an explicit error message if you do this, to explain the situation.

The error message you're seeing at the moment is because it's trying to load the ROOM1.CRM file from the first game, into the second game. Room files are linked to the game they're part of in order to stop people maliciously inserting their own room files into your game as a "patch", though in this case the mismatch has been picked up due to what is effectively an AGS bug.

SMF spam blocked by CleanTalk