Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions src/Interface/ModalDialogs/Modes/RMSTHelpModalDialog.as
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dialog doesn't seem to be used anywhere

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
class RMSTHelpModalDialog : ModalDialog
{
UI::Texture@ clubIdTex;
UI::Texture@ roomIdTex;

RMSTHelpModalDialog()
{
super(Icons::InfoCircle + " \\$zRandom Map Survival Together###RMSTHelp");
m_size = vec2(Draw::GetWidth(), Draw::GetHeight()) * 0.6f;
@clubIdTex = UI::LoadTexture("src/Assets/Images/help_clubId.jpg");
@roomIdTex = UI::LoadTexture("src/Assets/Images/help_roomId.jpg");
}

void RenderDialog() override
{
float scale = UI::GetScale();
UI::BeginChild("Content", vec2(0, -32) * scale);
UI::PushFont(Fonts::Header);
UI::Text("Random Map Survival Together");
UI::PopFont();
UI::Markdown(
"Random Map Survival Together is a multiplayer survival mode where players work together to survive as long as possible.\n\n" +
"The game mode requires all players to join the server you have set up. Players have no plugins to install and is compatible with console players.\n\n"
);
UI::NewLine();
UI::Separator();
UI::PushFont(Fonts::Header);
UI::Text("Prerequisites for a good functioning of the RMST mode");
UI::PopFont();
UI::Markdown(
"- You need to have a **Club** with at least **Admin** permissions\n" +
"- You need to have a **Room** in this club\n" +
"- You need to **join the room** before starting the mode\n" +
"- All players must **join the same room**\n\n"
);
UI::Separator();
UI::PushFont(Fonts::Header);
UI::Text("How RMST works");
UI::PopFont();
UI::Markdown(
"**Collaborative Survival:**\n" +
"- All players share the same timer and work as a team\n" +
"- When **any player** gets a goal medal, the **entire team** gets +3 minutes\n" +
"- When **any player** skips a map, the **entire team** loses -1 minute\n" +
"- The session ends when the shared timer reaches 0\n\n" +
"**Team Progress Tracking:**\n" +
"- Team achievements (total medals and skips) are shared\n" +
"- Individual contributions are tracked for recognition\n" +
"- MVP is determined by individual goals vs skips ratio\n" +
"- Real-time team progress updates\n\n"
);
UI::Separator();
Comment on lines +37 to +52
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to explain how the gamemode works

UI::PushFont(Fonts::Header);
UI::Text("How to get Club ID and Room ID");
UI::PopFont();
UI::Markdown(
"**Club ID:**\n" +
"Go to your club page on the Trackmania website and look at the URL. The Club ID is the number at the end.\n\n"
);
if (clubIdTex !is null) {
UI::Image(clubIdTex, vec2(clubIdTex.GetSize().x, clubIdTex.GetSize().y) * 0.5f * scale);
}
UI::NewLine();
UI::Markdown(
"**Room ID:**\n" +
"Go to your room page in the club and look at the URL. The Room ID is the number at the end.\n\n"
);
if (roomIdTex !is null) {
UI::Image(roomIdTex, vec2(roomIdTex.GetSize().x, roomIdTex.GetSize().y) * 0.5f * scale);
}
UI::NewLine();
UI::Separator();
UI::PushFont(Fonts::Header);
UI::Text("Tips for a successful RMST session");
UI::PopFont();
UI::Markdown(
"- **True teamwork:** Any team member getting a goal medal helps everyone!\n" +
"- **Coordinate skips:** Discuss as a team before anyone skips a difficult map\n" +
"- **Divide and conquer:** Players can focus on different types of maps they're good at\n" +
"- **Watch the shared timer:** Keep track of team time and plan accordingly\n" +
"- **Use voice chat:** Communication is crucial for team coordination\n" +
"- **Celebrate together:** Every goal medal is a team achievement!\n" +
"- **Support each other:** Help teammates learn difficult sections\n\n"
Comment on lines +74 to +83
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

);
UI::EndChild();

if (UI::Button("Close")) {
m_visible = false;
}
}
}
19 changes: 18 additions & 1 deletion src/Interface/Views/RMCMenu.as
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ namespace RMC
selectedGameMode = GameMode::Together;
startnew(CoroutineFunc(Together.StartRMT));
}
if (RMT_isServerOK && !TM::IsInServer()) {
UI::BeginDisabled();
UI::GreyButton(Icons::Heart + " Start Random Map Survival Together");
UI::Text("\\$a50" + Icons::ExclamationTriangle + " \\$zPlease join the room before continuing");
UI::EndDisabled();
}
if (RMT_isServerOK && TM::IsInServer() && UI::GreenButton(Icons::Heart + " Start Random Map Survival Together")){
selectedGameMode = GameMode::SurvivalTogether;
startnew(CoroutineFunc(SurvivalTogether.StartRMST));
}
#endif
UI::TreePop();
}
Expand Down Expand Up @@ -227,6 +237,12 @@ namespace RMC
Together.RenderBelowGoalMedal();
Together.RenderScores();
}
else if (selectedGameMode == GameMode::SurvivalTogether) {
SurvivalTogether.RenderGoalMedal();
UI::HPadding(25);
SurvivalTogether.RenderBelowGoalMedal();
SurvivalTogether.RenderScores();
}
#endif
}
}
Expand All @@ -237,6 +253,7 @@ namespace RMC
else if (selectedGameMode == GameMode::Survival || selectedGameMode == GameMode::SurvivalChaos) Survival.Render();
else if (selectedGameMode == GameMode::Objective) Objective.Render();
else if (selectedGameMode == GameMode::Together) Together.Render();
else if (selectedGameMode == GameMode::SurvivalTogether) SurvivalTogether.Render();
}

void RenderBaseInfos()
Expand Down Expand Up @@ -305,4 +322,4 @@ namespace RMC
MXNadeoServicesGlobal::isCheckingRoom = false;
}
#endif
}
}
29 changes: 27 additions & 2 deletions src/Utils/DataManager.as
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ namespace DataManager
void CreateSaveFile() {
string lastLetter = tostring(RMC::selectedGameMode).SubStr(0,1);
string gameMode = "RM" + lastLetter;

// Handle SurvivalTogether mode separately to avoid conflict with Survival
if (RMC::selectedGameMode == RMC::GameMode::SurvivalTogether) {
gameMode = "RMST";
}

Comment on lines +59 to +64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary because we don't create save files for online modes. The Start function in GlobalProperties is only called for RMS, RMC, RMO, etc.

Json::Value SaveFileData = Json::Object();
SaveFileData["PBOnMap"] = -1;
SaveFileData["TimerRemaining"] = 0;
Expand All @@ -74,13 +80,25 @@ namespace DataManager
void RemoveCurrentSaveFile() {
string lastLetter = tostring(RMC::selectedGameMode).SubStr(0,1);
string gameMode = "RM" + lastLetter;

// Handle SurvivalTogether mode separately to avoid conflict with Survival
if (RMC::selectedGameMode == RMC::GameMode::SurvivalTogether) {
gameMode = "RMST";
}

Comment on lines +83 to +88
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

IO::Delete(SAVE_DATA_LOCATION + gameMode + ".json");
RMC::CurrentRunData = Json::Object();
}

void SaveCurrentRunData() {
string lastLetter = tostring(RMC::selectedGameMode).SubStr(0,1);
string gameMode = "RM" + lastLetter;

// Handle SurvivalTogether mode separately to avoid conflict with Survival
if (RMC::selectedGameMode == RMC::GameMode::SurvivalTogether) {
gameMode = "RMST";
}

Comment on lines +96 to +101
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Json::ToFile(SAVE_DATA_LOCATION + gameMode + ".json", RMC::CurrentRunData);
}

Expand Down Expand Up @@ -126,8 +144,15 @@ namespace DataManager
bool LoadRunData() {
string lastLetter = tostring(RMC::selectedGameMode).SubStr(0,1);
string gameMode = "RM" + lastLetter;
if (IO::FileExists(SAVE_DATA_LOCATION + gameMode + ".json")) {
RMC::CurrentRunData = Json::FromFile(SAVE_DATA_LOCATION + gameMode + ".json");

// Handle SurvivalTogether mode separately to avoid conflict with Survival
if (RMC::selectedGameMode == RMC::GameMode::SurvivalTogether) {
gameMode = "RMST";
}

string saveFilePath = SAVE_DATA_LOCATION + gameMode + ".json";
if (IO::FileExists(saveFilePath)) {
RMC::CurrentRunData = Json::FromFile(saveFilePath);
Comment on lines +147 to +155
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

if (!EnsureSaveDataIsLoadable(gameMode, RMC::CurrentRunData)) {
Log::Error("Deleting the current" + gameMode + " save file, as it is corrupted!");
Log::Error("Please create an issue on github if this repeatedly happens");
Expand Down
7 changes: 7 additions & 0 deletions src/Utils/MX/Methods/LoadRandomMap.as
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ namespace MX
return;
}

if (RMC::selectedGameMode == RMC::GameMode::SurvivalTogether && map.ServerSizeExceeded) {
Log::Warn("Map is too big to play in servers, retrying...");
sleep(1000);
PreloadRandomMap();
return;
}

Comment on lines +152 to +158
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather just change the if statement above to

if ((RMC::selectedGameMode == RMC::GameMode::Together || RMC::selectedGameMode == RMC::GameMode::SurvivalTogether) && map.ServerSizeExceeded) {
    Log::Warn("Map is too big to play in servers, retrying...");
    sleep(1000);
    PreloadRandomMap();
    return;
}

// Check if map is uploaded to Nadeo Services (if goal == WorldRecord)
if (PluginSettings::RMC_GoalMedal == RMC::Medals[4]) {
if (map.OnlineMapId == "" && !MXNadeoServicesGlobal::CheckIfMapExistsAsync(map.MapUid)) {
Expand Down
5 changes: 4 additions & 1 deletion src/Utils/RMC/GlobalProperties.as
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace RMC
RMS@ Survival;
RMObjective@ Objective;
RMT@ Together;
RMST@ SurvivalTogether;

enum GameMode
{
Expand All @@ -51,7 +52,8 @@ namespace RMC
ChallengeChaos,
SurvivalChaos,
Objective,
Together
Together,
SurvivalTogether
}
GameMode selectedGameMode;

Expand All @@ -72,6 +74,7 @@ namespace RMC
@Survival = RMS();
@Objective = RMObjective();
@Together = RMT();
@SurvivalTogether = RMST();
}

string FormatTimer(int time) {
Expand Down
Loading