Adventure Game Studio | Forums

AGS Development => Editor Development => Topic started by: Snarky on 12 Jul 2018, 20:51

Title: Build is wrong after project rename
Post by: Snarky on 12 Jul 2018, 20:51
If you rename the AGS project (by renaming the root folder where the project files are stored), things get weird when you build.

If you launch the game through the IDE, everything appears fine: if you make a change to the code, it's reflected in the game that runs.

However, the EXE file from the Compiled/Windows folder does NOT update. It sticks to the version of the game from before the rename. Even if you delete it and rebuild it, it's still the old version that gets recreated. Only if you delete the files in the Compiled/Data folder and then recompile does it catch up. I think what happens is that the name change means that the .ags data file in Compiled/Data now has a different name (and this new file is used when you run it through the IDE), but for some reason the compilation step that creates the EXE still refers to the old file.

From a user POV this is extremely confusing: if you run the game through the IDE and it works, you expect the game in the Compiled/Windows folder to behave the same way.

My suggested solution: The build step that creates the .ags data file in Compiled/Data should first delete any files in the directory (any build process I've seen usually includes Clean as the first step). Also, the step that creates the game EXE file in Compiled/Windows (and the other platform executables) should always use the current data file.
Title: Re: Build is wrong after project rename
Post by: Crimson Wizard on 12 Jul 2018, 21:09
While I agree with everything, deleting random stuff from Compiled folder is somewhat complicated. Since the project structure does not have explicit subfolder for user data, people may put files into Compiled by hand.
This may seem far fetched, but there is currently no way for AGS to know if the *.ags or *.exe found in Compiled are remains of previous compilation before project rename and not files that user put there for some unknown purpose.
Perhaps saving "previous name" in temp program config could hint that project was renamed.

This is also why I was reluctant to make AGS clear Compiled folder after upgrade from 3.4.0 to 3.4.1 (where its structure changed a little).
Title: Re: Build is wrong after project rename
Post by: Snarky on 12 Jul 2018, 21:43
But you can have user data in a separate subfolder of Compiled/, so there's no need to mix up user data files with compiled files (at least until the final distribution).
And even if someone for some reason decides to put it in Compiled/Data/, surely they won't name it with a .ags extension, so it would at least be safe to delete those. And finally, clearly some part of the compilation process maintains a reference to the old name (since it uses it to generate the incorrect .exe file), so if you want to be maximally careful, it would be possible to only delete that file.

I also note that AGS deletes the game .exe file from Compiled/Windows/ at the drop of a hat (which is very annoying as well). I think after every time you run it, for some inexplicable effing reason.
Title: Re: Build is wrong after project rename
Post by: Cassiebsg on 12 Jul 2018, 22:06
I also note that AGS deletes the game .exe file from Compiled/Windows/ at the drop of a hat (which is very annoying as well). I think after every time you run it, for some inexplicable effing reason.

Yes, I noticed that and annoys the heck out of me also. I just tested the game and then I need to recompile it.