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

Feature request: add "CustomMissionID" for saved games #18

Open
SadPencil opened this issue Feb 19, 2024 · 4 comments
Open

Feature request: add "CustomMissionID" for saved games #18

SadPencil opened this issue Feb 19, 2024 · 4 comments
Assignees

Comments

@SadPencil
Copy link
Member

SadPencil commented Feb 19, 2024

A .sav file is an OLE document that can be considered as a "dictionary". For example, the OLE key Scenario Description refers to a UTF-16 LE string corresponds to the title of a saved game file.

I am currently working on a feature to let xna-cncnet-client support loading custom missions. In order to support this feature, xna-cncnet-client must have a way to identify which mission corresponds to a saved game file, along with other restrictions to prevent user loads a different mission (to prevent potential conflicts; as supplemental files are copied by the client)

Thus, I request an addtional data field, described as below.

CustomMissionID

This value will be specified via the spawn.ini file, given when the spawner is launchered.

; Generated by DTA Client
[Settings]
Scenario=spawnmap.ini
CustomMissionID=12345678
IsSinglePlayer=Yes

CustomMissionID is an int32 integer. If this value is omitted, consider it 0.

In a .sav file, the OLE key CustomMissionID should corresponds with 4 byte-values that contains such an int32 integer in little-endian order. The number is untouched, saved as-is.

Rename of missionmd.ini file

When CustomMissionID is specified and not 0, the access of missionmd.ini shall be redirct to spawn.ini file. This enables the client automatically generates the corresponding mission info without interrupting the game.

Full example of a spawn.ini file:

; Generated by CnCNet Client

[Settings]
Scenario=Maps\CustomMissions\vnsepa.map
GameSpeed=1
Ra2Mode=False
CustomLoadScreen=Resources/l600s02.pcx
IsSinglePlayer=Yes
SidebarHack=False
Side=0
BuildOffAlly=True
DifficultyModeHuman=0
DifficultyModeComputer=2
CustomMissionID=-715243874

[Maps\CustomMissions\vnsepa.map]
Briefing=Brief:AREDDAWN
ShowBriefing=true
UIName=MAP:TITREDDAWN
LSLoadMessage=LoadMsg:AREDDAWN
LSLoadBriefing=LoadBrief:AREDDAWN
LS640BriefLocX=20
LS640BriefLocY=20
LS800BriefLocX=20
LS800BriefLocY=20
LS640BkgdName=custommission.shp
LS800BkgdName=custommission.shp
LS800BkgdPal=custommission.pal
LoadScreenText.Color=LightGrey

Saved games list filter

When CustomMissionID is specified and it is not 0, only saved game files with the same CustomMissionID shall be displayed.

Otherwise, when CustomMissionID is not specified or is 0, only saved game files without CustomMissionID or with a zero-valued CustomMissionID shall be displayed.

Reading CustomMissionID from saved game file

When loading a saved game, the spawner loads CustomMissionID based on the OLE key CustomMissionID in a .sav file. CustomMissionID will not be specified in spawn.ini in this case.

@chaserli chaserli self-assigned this Feb 19, 2024
@SadPencil SadPencil changed the title Feature request: add additional meta information of a saved game file Feature request: add additional meta information "UniqueCampaignID" of a saved game file Feb 19, 2024
@SadPencil
Copy link
Member Author

@Belonit

In CnCNet/cncnet-yr-client-package#288 you said "At the moment, the client does not have a mechanism for processing saves from different game modes."

.sav file is an OLE document, which means the spawner is able to deliver arbitrary information from the client to save files (e.g., PR #19), for example, the game mode number. The client is then able to read these additional information (it does not require much time to implement) from the save files, and does whatever needs to be done based on these information.

This design should be better than the current workaround.

@Belonit
Copy link
Member

Belonit commented Feb 19, 2024

@Belonit

In CnCNet/cncnet-yr-client-package#288 you said "At the moment, the client does not have a mechanism for processing saves from different game modes."

.sav file is an OLE document, which means the spawner is able to deliver arbitrary information from the client to save files (e.g., PR #19), for example, the game mode number. The client is then able to read these additional information (it does not require much time to implement) from the save files, and does whatever needs to be done based on these information.

This design should be better than the current workaround.

This is already contained in the .sav file.
image

@Belonit
Copy link
Member

Belonit commented Mar 5, 2024

To let identify which mission corresponds to a saved game file, I request an addtional data field, described as below.xna-cncnet-client

@SadPencil Maybe it's worth using the meta information that already exists? It seems to me that it is quite enough:
Campaign - indicates the campaign index
Scenario number - indicates the scenario index
Version - indicates the unique identifier of the mod
Internal Version - indicates the unique identifier of the engine (including Ares and Phobos)

What really needs to be done is to force the spawner to correctly write the Campaign and Scenario number fields.

@SadPencil
Copy link
Member Author

To let identify which mission corresponds to a saved game file, I request an addtional data field, described as below.xna-cncnet-client

@SadPencil Maybe it's worth using the meta information that already exists? It seems to me that it is quite enough: Campaign - indicates the campaign index Scenario number - indicates the scenario index Version - indicates the unique identifier of the mod Internal Version - indicates the unique identifier of the engine (including Ares and Phobos)

What really needs to be done is to force the spawner to correctly write the Campaign and Scenario number fields.

According to @chaserli 's investigation, Scenario number seems to be used in game, and I don't know if it is safe to use this field.

Besides, now I start questioning what should happen if a player wins a campaign and then the next campaign starts. Should the Scenario number increase itself by 1? In original RA2/YR, Scenario number will be increased by 1 on next mission, and correctly loaded when user loads a saved game from in-game menu.

@SadPencil SadPencil changed the title Feature request: add additional meta information "UniqueCampaignID" of a saved game file Feature request: add "CustomMissionID" for saved games Mar 10, 2024
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

3 participants