Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TD][RA?] Remastered Issue: GlyphX Client is Passing Garbage Scenario Numbers #854

Open
ChthonVII opened this issue Nov 25, 2022 · 0 comments

Comments

@ChthonVII
Copy link
Contributor

(I've verified the following in TD. Most of the issues probably also impact RA.)

The value of Scenario is used for a bunch of hard-coded stuff specific to particular missions, and also for some generic AI behaviors. So it causes problems when the GlyphX client is passing us garbage (or nothing) in most cases:

  • Official SP missions: Correct scenario number
  • Custom SP missions: Always Scenario = 1
    • AI-controlled infantry won't scatter (like the early missions)
    • Threshhold for AI to start repairing buildings is 25% hp (like the early missions)
    • AI cannot sell buildings it can't afford to repair. (like the very early missions)
  • Official MP maps: Scenario = number in the map's filename. Often very large.
    • When the AI has a damaged building it can't afford to repair, it always passes the random roll to sell it on the first tick it makes the check.
  • Custom MP maps: Always Scenario = 0
    • AI-controlled infantry won't scatter (like the early missions)
    • Threshhold for AI to start repairing buildings is 25% hp (like the early missions)
    • AI cannot sell buildings it can't afford to repair. (like the very early missions)

A related issue is that the range for the random roll whether to sell a building the AI can't afford to repair didn't get updated for Covert Ops or the console missions, so the odds on the first tick can be higher than intended, sometimes even 100%. WW fixed this in RA by using a value derived from BuildLevel instead.

Note: You cannot just change Scenario to a sane value because Decode_Pointers() will use it to rewrite ScenarioName during a save operation, and we can't be sure that GlyphX client won't call later call CNC_Get_Game_State() which would use the now-incorrect ScenarioName.

The fix I used for my mod is to make a new global variable EffectiveScenario to replace Scenario where it impacts the AI. When Scenario gets set, so does EffectiveScenario. Additionally, EffectiveScenario can be set by a value passed in through a custom mission's INI file, or, failing that, to a sane default value when initializing a custom mission. For MP maps, EffectiveScenario is set to a value derived from BuildLevel similar to how RA does it. EffectiveScenario needs to be added to he save file. I also added an option to cap EffectiveScenario for the random roll to sell a building.

(It's also possible to support custom dino missions by looking for a value in the mission's INI file and setting some flags accordingly.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant