arescentral / antares

A tactical space combat game
http://arescentral.org/antares/
GNU Lesser General Public License v3.0
99 stars 18 forks source link

New plugins fail to load without changing title inside info.pn - Mac OS #354

Open dome2048 opened 4 years ago

dome2048 commented 4 years ago

As mentioned in #332 , I am testing a nightly build and am building a basic plugin. I'm starting with just modifying the campaign files with simple modifications; for example, I took mission 6 and changed the Gaitori to Audemedons for added difficulty. I changed it to use ch01.pn so it would appear first, changed the chapter tag in the scenario file to 2 (to replace what was originally there), and changed the next tag to ch02, so it would advance properly and not skip levels 3-6.

I noticed that if I made any changes to my ch01.pn (or whatever chapter), the plugin would not load properly. Instead, the stock missions would load. In my case, it offers Chapter 1 (Easy Street), which doesn't even exist anymore in my plugin. It also forgets progress and offers Easy Street (interestingly, not the Moons for Goons tutorial).

If I open info.pn and make any change to the plugin title, the plugin then works properly until I make a new change.

I located the path where the stable version places the plugins: ~/Library/Containers/org.arescentral.antares/Data/Library/Application Support/Antares/Downloads

And where they are apparently unzipped: ~/Library/Containers/org.arescentral.antares/Data/Library/Application Support/Antares/Scenarios/

For what it's worth it doesn't look like my plugin is getting copied to either of these locations by the nightly build. I was unable to locate any other info.pn files anywhere else, so if the nightly is copying them somewhere I'm not looking in the right place at all.

sfiera commented 4 years ago

As mentioned in #332 , I am testing a nightly build and am building a basic plugin. I'm starting with just modifying the campaign files with simple modifications; for example, I took mission 6 and changed the Gaitori to Audemedons for added difficulty. I changed it to use ch01.pn so it would appear first, changed the chapter tag in the scenario file to 2 (to replace what was originally there), and changed the next tag to ch02, so it would advance properly and not skip levels 3-6.

If I understand correctly:

If that’s the case, you should change ch06’s chapter number to 1 and delete tut1. The requirements on chapter numbers are:

The names ch01, ch06 etc. don’t have any meaning to the game, so there’s no need to rename files. I could probably clarify that here.

I noticed that if I made any changes to my ch01.pn (or whatever chapter), the plugin would not load properly. Instead, the stock missions would load. In my case, it offers Chapter 1 (Easy Street), which doesn't even exist anymore in my plugin. It also forgets progress and offers Easy Street (interestingly, not the Moons for Goons tutorial).

If I open info.pn and make any change to the plugin title, the plugin then works properly until I make a new change.

Ah, there’s definitely some unexpected behavior in there, but yes, you need to change the plugin title. If you keep it the same, you’re claiming that your plugin is a new version of the factory scenario. Progress tracking is based on the plugin title and the chapter numbers.

However, even given that interpretation, it should probably still be loading resources from your plugin, whereas it sounds like it’s somehow mixing the two data sources at present. I can see why this might happen and I’ll look into it.

And I still don’t understand why it would be necessary to change the plugin name a second time, because the Antares nightly isn’t supposed to be saving the plugin data anywhere

I located the path where the stable version places the plugins: ~/Library/Containers/org.arescentral.antares/Data/Library/Application Support/Antares/Downloads

And where they are apparently unzipped: ~/Library/Containers/org.arescentral.antares/Data/Library/Application Support/Antares/Scenarios/

For what it's worth it doesn't look like my plugin is getting copied to either of these locations by the nightly build. I was unable to locate any other info.pn files anywhere else, so if the nightly is copying them somewhere I'm not looking in the right place at all.

Yes, these are no longer used in the nightly. However, there should be a sibling “Registry” folder. That’s where progress is stored, so it might be useful.

dome2048 commented 4 years ago

If I understand correctly:

ch01.pn (Easy Street): deleted ch06.pn (…Into the Fire): renamed to ch01.pn set chapter: 2 set its win action to next: "ch02" everything else (tut1/2/3.pn, ch03.pn, etc.): unchanged

I made some basic changes to the ch01.pn like changing the CPU player and their ships to "aud" and adding some build options (hvd and carrier). But otherwise, yes, that looks right.

If that’s the case, you should change ch06’s chapter number to 1 and delete tut1.

Done. It actually appears that this solved the problem. Unfortunately for the sake of troubleshooting I also reinstalled Mac OS tonight (for unrelated reasons) so I suppose that could have had something to do with this. What bugs me about this as a solution is that I left the tut1 file as chapter 1, then just skipped it to play ch01 which was chapter 2. It seems like that should have worked, since Antares looked at tut1, then ch01, then ch02 (because that's how I configured it. This worked fine until I made a change in one of the files. I'm glad it's working now, I just don't understand why...

Ah, there’s definitely some unexpected behavior in there, but yes, you need to change the plugin title. If you keep it the same, you’re claiming that your plugin is a new version of the factory scenario.

I should make this clearer: I did change my plugin title in the info.pn file, to "The Dome Levels dev" Each time I want to reload the file after I made a change, I incremented a number on the back of the plugin in order to get it to load. Most recently I called the file "The Dome Levels dev010".

However, there should be a sibling “Registry” folder.

I'm finding long hex string .pn files that store unlocked chapters. There appears to be one for each iteration of the plugin I've loaded, which makes sense.

I can see why this might happen and I’ll look into it.

Do you want me to leave this open? Or are you satisfied? I can always come back and reopen if these problems pop back up again. I attached a zip of my current plugin state if you're curious.

The Dome Levels.zip

sfiera commented 4 years ago

Oh, if you intended to keep tut1 around as chapter: 1, then it should have been fine to have your replacement ch01 be chapter: 2.

I think there are two things to investigate:

I’m still having trouble understanding what could cause the latter. Is the following what you did?

  1. Create The Dome Levels dev001
  2. Open directory in Antares
  3. See plugin levels
  4. Quit Antares
  5. Change plugin level
  6. Open directory in Antares
  7. See factory levels
  8. Quit Antares
  9. Change plugin title to The Dome Levels dev002
  10. Open directory in Antares
  11. See plugin levels

Before, I thought you were seeing the older version of your plugin at (7), which seemed impossible. If you’re seeing the factory scenario, that’s hard for me to understand, but that seems like a possible bug.

sfiera commented 4 years ago

I updated the nightly build so it’s stricter about duplicate chapter checking. I don’t know if that was related, but it can’t hurt.

On the other hand, I looked closer at the code that handles fallback to the factory scenario, and I didn’t see any obvious reasons it would do the wrong thing, unless maybe you deleted ch01 without renaming ch06? tut1 specifies that the player can skip to ch01, so if your plugin lacked any ch01, it’s possible you would end up playing Easy Street. But then that would unlock chapter 2, and if you exited Easy Street and went back to the level selection screen, it would show your replacement chapter: 2 level.

dome2048 commented 4 years ago

My apologies for the delay.

What happens if a plugin has the same title as the factory scenario (but to be clear, this wasn’t ever the case for you?) Correct, this is not what I did. The levels maintained the same (for the most part) name as the stock levels, but the plugin itself was always named something different.

  1. Create The Dome Levels dev001
  2. Open directory in Antares
  3. See plugin levels
  4. Quit Antares
  5. Change plugin level
  6. Open directory in Antares
  7. See factory levels
  8. Quit Antares
  9. Change plugin title to The Dome Levels dev002
  10. Open directory in Antares
  11. See plugin levels

That's exactly what I did, and repeated it through several changes as I made incremental changes to the ch01 scenario.

I updated the nightly build so it’s stricter about duplicate chapter checking. I don’t know if that was related, but it can’t hurt.

I'll try it and attempt to duplicate the issue.