Skip to content

Instantly share code, notes, and snippets.

@GreepTheSheep
Last active April 7, 2023 16:38
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GreepTheSheep/d36e841add96213d5ed481a8de9a505d to your computer and use it in GitHub Desktop.
Save GreepTheSheep/d36e841add96213d5ed481a8de9a505d to your computer and use it in GitHub Desktop.
Collisions on a TM dedicated server

Create a file on UserData/Scripts/Modes/Trackmania/collisions.Script.txt , with the content on file linked with this gist

Then you need to edit your matchsettings file like this :

<playlist>
    <gameinfos>
        <script_name>Trackmania/collisions.Script.txt</script_name>
    </gameinfos>

    <map>
        <file>[YOUR MAP FILE HERE]</file>
    </map>
</playlist>

Then load it.

For information: collisions on servers are not recommended on public servers (very buggy...) I advise you to use it on private servers with your friends (in RPG/Trial session for example)

Additional: if all players have a good connection, you can set these values to your dedicated config to reduce weird collisions :

<packetassembly_packetsperframe>0</packetassembly_packetsperframe>
<packetassembly_fullpacketsperframe>0</packetassembly_fullpacketsperframe>
<delayedvisuals_s2c_sendingrate>255</delayedvisuals_s2c_sendingrate>
<trustclientsimu_c2s_sendingrate>255</trustclientsimu_c2s_sendingrate>
// In the next line, put the game mode you want to add collisions to:
#Extends "Modes/TrackMania/TM_TimeAttack_Online.Script.txt"
// Gamemode setting overrides that are needed for collisions:
// Keep in mind, these can be overridden by the server config or controller, so check these first if it doesnt work for you.
// TrustClientSimu: Setting this to False will make the server compute and validate the car physics instead of relying on the clients to make correct physics calculations.
// The collision calculations are server-side, so we need this to be false.
#Setting S_TrustClientSimu False
// UseCrudeExtrapolation: Setting this to False will stop the server making assumptions of the cars positions and physics based on the last info it knows, and instead just base it on the ground truth.
// We need the raw data for the collision calculations, so we set this to False.
#Setting S_UseCrudeExtrapolation False
// This will enable collision calculations when the server starts.
// Keep in mind that if you base this on a custom gamemode, that gamemode itself may override this.
***Match_StartServer***
***
UsePvPCollisions = True;
UsePvECollisions = True;
// Disable globally records so new records on a map will not be sended to Nadeo Services
// This is to prevent "cheating" with collisions
Race::SetupRecord(
MenuConsts::C_ScopeType_Season,
MenuConsts::C_ScopeType_PersonalBest,
MenuConsts::C_GameMode_TimeAttack,
"",
False, //C_UploadRecord
False, //C_DisplayRecordGhost
False, //C_DisplayRecordMedal
False, //C_CelebrateRecordGhost
False //C_CelebrateRecordMedal
);
// Aditionally, you can hide the records pannel by removing the comment on the next line
//UIModules_Record::SetSpecialVisibility(False);
***
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment