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 Support] Add the ability to define a list of file extensions that match the target scenario to be copied. #397

Open
CCHyper opened this issue Dec 1, 2022 · 6 comments
Assignees
Labels

Comments

@CCHyper
Copy link

CCHyper commented Dec 1, 2022

The Tiberian Dawn map setup requires the .BIN file to be present alongside the scenario .INI.

Add the ability to define a list of file extensions that match the target scenario name to copy on game start, these files will be picked up and copied, then renamed to spawnmap.<ext>.

For example;
CopyAdditionalSpawnFileFormats=BIN,MIX

@devo1929
Copy link
Contributor

devo1929 commented Dec 21, 2022

So, I think I understand some of the request here, and if I do, I don't think it's as simple as copy another file. The spawnmap.ini file isn't simply copied. It's constructed from the values of other various files:

  • the map selected
  • map rules specified by the current game mode
  • global map settings
  • multiplayer map settings (if currently in multiplayer scenario)
  • checkbox and drop down values from the settings area

Now, everything I listed above is simply from reading the code. So, forgive me if I'm misunderstanding something. I'm not entirely familiar with the process, but I'll do what I can.

Are you saying that there's a BIN or MIX file for every map?
Or, is there a BIN or MIX file for every scenario INI file? If so, how are they named? I was looking through the TD client package repo and couldn't find any examples. Can you provide something more visual as a example? I just want to make sure I'm understanding the situation/need.

@CCHyper
Copy link
Author

CCHyper commented Dec 21, 2022

I'm not familiar with the relevant code, but I would assume there is a path stored to the map selected to be played (before any generation of spawnmap.ini)? For example, if the player chose scb01ea.ini, the new feature would need to explicitly copy the file scb01ea.bin (not modified). This is because Tiberian Dawn and Sole Survivor maps have a sister BIN file which contains the terrain data.

I suggested a new INI control key to ensure this feature is usable long term, for example, allowing custom MIX files to be loaded alongside maps.

@devo1929
Copy link
Contributor

Is it guaranteed that the BIN file would be named exactly as the INI file and in the maps directory?
In your INI key suggestion, you had MIX listed, too. Is that another possible file that could be copied? If so, is it also guaranteed to have the same base filename as the INI?
And last question that I think you already answered with your "not modified" comment, when the BIN file is copied over, is it done so with the exact same filename (scb01ea.bin)? Or, is it copied and renamed to spawnmap.bin?

If the answer is yes to the above questions regarding the same base filename, then it might not be necessary to add an INI key to tell the client to copy those files. Having an identical filename like that per map file might be enough for the client to just say, "if there are BIN or MIX files for the same map name, copy them over too."

My only concern would be if the BIN files were copied over with their exact filename and not renamed to spawnmap.bin, because they we need to take action on cleaning them up after the game exits. Else, that folder could get cluttered by new bin files every time you play a new map.

@CCHyper
Copy link
Author

CCHyper commented Dec 21, 2022

Is it guaranteed that the BIN file would be named exactly as the INI file and in the maps directory?

Yeah, it must always match the scenario filename.

In your INI key suggestion, you had MIX listed, too.

This was used as an example for the feature if the developer using the Client would like to copy additional files that match the filename (without the extension). For example, a YR map called a_new_world.map could be made to copy a_new_world.mix.

And last question that I think you already answered with your "not modified" comment, when the BIN file is copied over, is it done so with the exact same filename (scb01ea.bin)? Or, is it copied and renamed to spawnmap.bin?

It is to be renamed to spawnmap.bin otherwise the game would fail as the BIN file must match the scenario name.

@devo1929
Copy link
Contributor

@Metadorius
To summarize the conversation:
Each map file could have additional files associated with them, in this specific case, a bin file. Similar to how we write spawnmap.ini with the same filename every time, the bin file would be copied and renamed to spawnmap.bin.

My question to you is:
Is there any reason why the client couldn't just check for a bin file or any other file that has the same exact basename as the map file and then copy them over to spawnmap.<ext>?

@devo1929 devo1929 self-assigned this Dec 21, 2022
devo1929 added a commit to devo1929/xna-cncnet-client that referenced this issue Dec 21, 2022
devo1929 added a commit to devo1929/xna-cncnet-client that referenced this issue Dec 23, 2022
devo1929 added a commit to devo1929/xna-cncnet-client that referenced this issue Dec 23, 2022
devo1929 added a commit to devo1929/xna-cncnet-client that referenced this issue Dec 24, 2022
devo1929 added a commit that referenced this issue Dec 24, 2022
@devo1929
Copy link
Contributor

devo1929 commented Jan 25, 2023

@CCHyper this issue can be closed, right?

The PR for it is here:
#420

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🔍 In Testing
Development

No branches or pull requests

2 participants