-
-
Notifications
You must be signed in to change notification settings - Fork 32
Attempt to implement Random Map Survival Together #155
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
base: main
Are you sure you want to change the base?
Changes from all commits
30d51cd
f2df646
a7a4af6
35eda59
692a9e2
9babf16
7dbce04
a772430
7078125
c5b2d1a
d9a5cb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
); | ||
UI::EndChild(); | ||
|
||
if (UI::Button("Close")) { | ||
m_visible = false; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
Json::ToFile(SAVE_DATA_LOCATION + gameMode + ".json", RMC::CurrentRunData); | ||
} | ||
|
||
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)) { | ||
|
There was a problem hiding this comment.
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