Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Contents of the GSC file "_clientids" !Question

Contents of the GSC file "_clientids" !Question

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
7 Posts 4 Posters 497 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    wrote on last edited by Kalitos
    #1

    Question: It is essential to keep the content of the file "_clientids.gsc", since it is the one we use to implement our own gsc, but personally I do not keep the original content of it, which would be this:

    init()
    {
    	level.clientid = 0;
    	level thread onplayerconnect();
    }
    
    onplayerconnect()
    {
    	for ( ;; )
    	{
    		level waittill( "connecting", player );
    		player.clientid = level.clientid;
    		level.clientid++;
    	}
    }
    

    Additionally, what is the logic of that code, what does the game need it for?

    RektInatorundefined 1 Reply Last reply
    0
    • RektInatorundefined Offline
      RektInatorundefined Offline
      RektInator Plutonium Admin
      replied to Kalitos on last edited by
      #2

      Kalitos the _clientids script is a leftover script. The clientid on the GSC objects aren't used anywhere else in the GSC code, therefore the script can be overwritten by something else.

      Ox_undefined 1 Reply Last reply
      0
      • Ox_undefined Offline
        Ox_undefined Offline
        Ox_
        replied to RektInator on last edited by
        #3

        RektInator said in Contents of the GSc file "_clientids" !Question:

        Kalitos the _clientids script is a leftover script. The clientid on the GSC objects aren't used anywhere else in the GSC code, therefore the script can be overwritten by something else.

        Seems like to me it's actually used quite a lot?
        Searching .clientid in a gsc dump gives quite a few results.

        Starting to wonder myself why we're able to just patch that out of the gsc.

        Kalitosundefined 1 Reply Last reply
        0
        • Kalitosundefined Offline
          Kalitosundefined Offline
          Kalitos
          replied to Ox_ on last edited by Kalitos
          #4

          Ox_ I agree with you, although since you mentioned the gsc dump search, I got on it, and if you talk about ".clientid", the game does refer to it, but it directly includes "player.clientid". On the other hand, if we search for level.clientid, we only see that it refers to a single file "_clientids.gsc". It's strange.

          Ox_undefined 1 Reply Last reply
          0
          • Sassundefined Offline
            Sassundefined Offline
            Sass Plutonium Staff
            wrote on last edited by Sass
            #5

            I know the file existed back in CoD4, and wasn't even used back then IIRC.

            To clarify, player.clientid's do indeed exist and is (somewhat) used in the game. However this file doesn't handle them at all as you can already tell.

            Edit : level.clientid was probably either supposed to distribute a clientid to every client that connects, or be an array that stores every player's clientid. In the COD4 version of the file, you can find this comment :

            // Is this safe? What if a server runs for a long time and many people join/leave

            1 Reply Last reply
            0
            • RektInatorundefined Offline
              RektInatorundefined Offline
              RektInator Plutonium Admin
              wrote on last edited by
              #6

              Probably overwritten by the C++ code of the game then, which would make sense because the C++ code knows the actual client id of the client.

              1 Reply Last reply
              0
              • Ox_undefined Offline
                Ox_undefined Offline
                Ox_
                replied to Kalitos on last edited by
                #7

                Kalitos said in Contents of the GSc file "_clientids" !Question:

                Ox_ I agree with you, although since you mentioned the gsc dump search, I got on it, and if you talk about ".clientid", the game does refer to it, but it directly includes "player.clientid". On the other hand, if we search for level.clientid, we only see that it refers to a single file "_clientids.gsc". It's strange.

                The level.clientid part doesn't seem very interesting or relevant, it just increases and then gives the next player the next number.
                But each player getting their own clientid field is that interesting part.

                Searching for uses of that field (the field owner by a player, not the level) in patch_mp comes back with 70 matches (few of them in dev blocks though) across 14 different gscs.

                Sass said in Contents of the GSc file "_clientids" !Question:

                I know the file existed back in CoD4, and wasn't even used back then IIRC.

                To clarify, player.clientid's do indeed exist and is (somewhat) used in the game. However this file doesn't handle them at all as you can already tell.

                If you replace the _clientids gsc with e.g. this

                init()
                {
                    level thread onPlayerConnect();
                }
                
                onPlayerConnect()
                {
                    for(;;)
                    {
                        level waittill("connected", player);
                        player thread onPlayerSpawned();
                    }
                }
                
                onPlayerSpawned()
                {
                    self endon("disconnect");
                    level endon("game_ended");
                    for(;;)
                    {
                        self waittill("spawned_player");
                	self iprintln(isDefined(self.clientid));
                    }
                }
                

                You'll see that that field indeed doesn't exist if we patch _clientids to not create it.
                (As opposed to that field working just as expected if we don't patch _clientids)

                Makes me wonder how come we're not breaking the functionality in those aforementioned 15 different gscs.
                Or perhaps we are, but the functionality there isn't essential. I cba'd to study/test that.

                1 Reply Last reply
                0

                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Donate