Jump to content

Can a serverside modlet override sleeper volume flags for POI's?


Tehnomaag

Recommended Posts

The question is in the title. The motivation for the present thread is a discussion about failures of stealth gameplay in the general section of the present forums and an issue some people have with auto-agro sleeper volumes (link in the end of this post). 

In that thread on page 9 Kalen posted a simple VB script that should, in theory, go over the POI XLM files in a given directory and change all auto-agro sleeper volumes (flag 2) into "normal" sleepers (flag 0)

Const ForReading = 1
Const ForWriting = 2

sFolder = "C:\[Folder where prefabs are]\"
Set oFSO = CreateObject("Scripting.FileSystemObject")

For Each oFile In oFSO.GetFolder(sFolder).Files

  If UCase(oFSO.GetExtensionName(oFile.Name)) = "XML" Then
    ReadFiles oFSO, oFile
  End if
Next

Set oFSO = Nothing
msgbox("Processing Complete")

Sub ReadFiles(FSO, File)

	Set oFile2 = FSO.OpenTextFile(File.path, ForReading)

     Do Until oFile2.AtEndOfStream
       strLine = oFile2.ReadLine
       
	   if instr(strLine, "SleeperVolumeFlags") <> 0 then
	       strLine = replace(strLine, "2", "0")
	   end if
	   
	   strText = strText & strLine & vbCrLf
	   
     Loop

     sFile = File.path
     oFile2.close
     set oFile2 = Nothing

     Set File = FSO.OpenTextFile(sFile ,  ForWriting)
     File.Write strText
     File.Close
     Set File = Nothing
	
 end Sub

That is pretty cool, in my opinion. However, what this basically means is doing a custom POI pack which means that both the server and clients would need to have it. It is not clear at all to me if it is even possible to do that change after the map has been already generated or if such an change would need to be done even before a map generation. 

What I would like to try, actually, would be a situation where ALL sleeper volumes in all POI's are set to "awake" state (flag 1). Now before I start messing about with scripts doing changes to the POI files I would need to understand a bit more about what does what in the POI xlm files, exactly. Is there such a resource available somewhere? Must the sleeper volume changes be made before map generation? Or are the sleeper volumes loaded from a file only after a player enters the POI and, thus, could the changes made to a already running server? Are the sleeper volumes loaded from the server side or must they be both server and client side?

 

For example, I look at the "red mesa" POI xlm file

<?xml version="1.0" encoding="UTF-8"?>
<prefab>
  <property name="CopyAirBlocks" value="True" />
  <property name="ExcludeDistantPOIMesh" value="False" />
  <property name="ExcludePOICulling" value="False" />
  <property name="DistantPOIYOffset" value="0" />
  <property name="AllowTopSoilDecorations" value="False" />
  <property name="QuestTags" value="clear,fetch,hidden_cache" />
  <property name="ShowQuestClearCount" value="2" />
  <property name="DifficultyTier" value="4" />
  <property name="TraderArea" value="False" />
  <property name="Zoning" value="industrial" />
  <property name="AllowedTownships" value="wilderness" />
  <property name="RotationToFaceNorth" value="2" />
  <property name="EditorGroups" value="government" />
  <property name="YOffset" value="-23" />
  <property name="SleeperVolumeSize" value="29, 3, 17#13, 3, 27#9, 3, 1#24, 3, 16#16, 3, 2#1, 2, 1#10, 3, 12#11, 3, 11#10, 3, 6#16, 1, 10#24, 3, 13#5, 4, 7#16, 4, 19#9, 2, 9#4, 5, 4#11, 7, 24#4, 3, 2#14, 6, 13#3, 3, 9#8, 3, 5#7, 3, 7#11, 2, 13#21, 3, 3#11, 3, 2" />
  <property name="SleeperVolumeStart" value="31, 23, 31#18, 23, 44#40, 18, 60#32, 14, 30#40, 14, 46#37, 15, 47#39, 29, 48#16, 14, 42#19, 18, 68#30, 2, 57#33, 2, 27#56, 2, 41#32, 8, 29#48, 8, 15#28, 8, 37#31, 6, 49#27, 6, 46#15, 19, 30#26, 26, 33#18, 26, 34#17, 14, 63#60, 8, 12#49, 10, 15#18, 26, 31" />
  <property name="SleeperVolumeGroupId" value="1,1,1,2,2,1,1,0,0,0,0,0,3,0,3,4,4,0,5,5,0,0,0,5" />
  <property name="SleeperVolumeGroup" value="S_-_Group_Zom_Soldier,0,1,S_-Group_Generic_Zombie,2,2,S_-Group_Generic_Zombie,1,1,S_-_Group_Zom_Soldier,3,3,S_-Group_Generic_Zombie,2,2,S_-_Group_Zom_Soldier,0,1,S_-Group_Generic_Zombie,1,1,S_Zom_Utility_Worker,1,1,S_Zom_Utility_Worker,2,2,S_-Group_Generic_Zombie,2,2,S_-Group_Generic_Zombie,2,2,S_-Group_Generic_Zombie,1,2,S_-Group_Generic_Zombie,3,3,S_Zom_Utility_Worker,1,1,S_-_Group_Lab_Worker,1,1,S_-_Group_Lab_Worker,4,4,S_Zom_Utility_Worker,2,2,S_-Group_Generic_Zombie,1,1,S_-_Group_Zom_Soldier,4,4,S_-Group_Generic_Zombie,0,0,S_-_Group_Lab_Worker,1,1,S_Zom_Utility_Worker,1,1,S_-Group_Generic_Zombie,1,1,S_-_Group_Zom_Soldier,4,4" />
  <property name="SleeperIsLootVolume" value="False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False" />
  <property name="SleeperIsBossVolume" value="False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False" />
  <property name="SleeperVolumeFlags" value="2,0,0,0,2,0,0,0,0,0,0,0,2,0,0,2,0,0,0,2,2,0,0,0" />
  <property name="SleeperIsQuestExclude" value="False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False" />
  <property class="Stats">
    <property name="TotalVertices" value="1905279" />
    <property name="TotalTriangles" value="1876287" />
    <property class="BlockEntities">
      <property name="Vertices" value="1406927" />
      <property name="Triangles" value="1513608" />
    </property>
    <property class="ChunkMeshes0">
      <property name="Vertices" value="396055" />
      <property name="Triangles" value="252024" />
    </property>
    <property class="ChunkMeshes1">
      <property name="Vertices" value="0" />
      <property name="Triangles" value="0" />
    </property>
    <property class="ChunkMeshes2">
      <property name="Vertices" value="3000" />
      <property name="Triangles" value="1548" />
    </property>
    <property class="ChunkMeshes3">
      <property name="Vertices" value="438" />
      <property name="Triangles" value="244" />
    </property>
    <property class="ChunkMeshes4">
      <property name="Vertices" value="62781" />
      <property name="Triangles" value="50311" />
    </property>
    <property class="ChunkMeshes5">
      <property name="Vertices" value="0" />
      <property name="Triangles" value="0" />
    </property>
    <property class="ChunkMeshes6">
      <property name="Vertices" value="0" />
      <property name="Triangles" value="0" />
    </property>
    <property class="ChunkMeshes7">
      <property name="Vertices" value="36046" />
      <property name="Triangles" value="58536" />
    </property>
    <property class="ChunkMeshes8">
      <property name="Vertices" value="0" />
      <property name="Triangles" value="0" />
    </property>
    <property class="ChunkMeshes9">
      <property name="Vertices" value="32" />
      <property name="Triangles" value="16" />
    </property>
  </property>
  <property class="IndexedBlockOffsets">
    <property class="FetchContainer">
      <property name="0" value="60, 3, 43" />
    </property>
    <property class="Rally">
      <property name="0" value="53, 23, 1" />
    </property>
  </property>
</prefab>

It appears, that red mesa, as an example, has altogether 24 sleeper volumes? Can I just change all the 24 flags in "SleeperVolumeFlags" to "1" to turn all volumes into "awake" volumes? Or is it a bit trickier than that?

Or would it be truly that simple that I could walk through all the XLM files in a the prefabs directory and change any "SleeperVolumeFlag" that is not "1" into a "1" server-side and that would do it? If it could be made post-map-generation then an server side xlm modlet overrriding given prefabs would be possible?

This is the link to relevant thread in "general": 

 

Link to comment
Share on other sites

59 minutes ago, Tehnomaag said:

That is pretty cool, in my opinion. However, what this basically means is doing a custom POI pack which means that both the server and clients would need to have it. It is not clear at all to me if it is even possible to do that change after the map has been already generated or if such an change would need to be done even before a map generation.

I'm just estimating, but either that setting is compiled into the map and so needs to be modified before map generation, or the xml is used during runtime, but then it should be pushed from the server to the client, otherwise a player could use a local modified xml without any spawns and just walk through any POI.

 

In both cases, you don't need anything modified on the client side.

 

Aren't the POIs included in the map? Iirc Compopack is only required for map generation. Once a map is generated with Compopack, a client doesn't need to have the compopack locally installed?

Link to comment
Share on other sites

33 minutes ago, Liesel Weppen said:

I'm just estimating, but either that setting is compiled into the map and so needs to be modified before map generation, or the xml is used during runtime, but then it should be pushed from the server to the client, otherwise a player could use a local modified xml without any spawns and just walk through any POI.

 

In both cases, you don't need anything modified on the client side.

 

Aren't the POIs included in the map? Iirc Compopack is only required for map generation. Once a map is generated with Compopack, a client doesn't need to have the compopack locally installed?

That would make sense. If such a change would be required only at map generation and POI's would be "cooked in" during generation that would simplify things to a degree, as then it could be indeed, only server-side. 

 

I'm not sure about compopack to be honest. As we usually play with a pretty closed group of players when we do a fresh map using a different compopack I'll just ask the players to install the relevant compopack on their side as well usually. This time one of the guys claimed he forgot to install the latest compopack and that the map loaded fine for him, so maybe nowadays they are cooked in? I think that back in a18.4 it used to fail if the player did not have compopack installed? Maybe I'm misremembering though. 

 

The install instructions of the current compopack just ask the user to copy the right stuff into prefabs folder without specifying if its needed only on server side or both server and client side. 

 

However, based on what you say - it seems to me very logical that the sleeper volumes would be handled strictly server side because, as you pointed out, it would be too open for abuse to have anything from clientside to override what the server has in this regard as that way a player could just "switch off" zombies in the POI's client side. So it would be logical that the POI's are either cooked in during map generation into the map itself (which is downloaded by the clients during first joying the server) or the server is using prefab files from the server prefabs folder (in which case it would be possible to update sleeper volumes of an already running server, I suppose). 

Link to comment
Share on other sites

It appears that the answer to the question I asked in the first post is "yes".  With the help of Kalen on page 17 of the linked thread inspiring this question I have managed to get the scripts working and a dedicated server was able to boot up using the modified prefab files. There is 2 scripts - one changes all the auto attack volumes into normal passive sleeper volumes (2_to_0 script) and a second one changes all the normal passive sleeper volumes into "awake" sleeper volumes (the 0_to_1 script) where the sleepers are a bit more alert and tend to take note of your presence if you step into their field of vision. 

If someone wants to use them then change the path to the prefabs folder to the one used in the machine running the script. The attached scripts assume default steam installation on disk C. 

 

If the map is already running any POI that has been already visited might not update. Preliminary testing (on an already running multiplayer server) did not highlight any game-breaking problems, although it must be noted that in one of the tested POI's one room still did the scripted attack event on player - its unclear if it was because the POI had been already visited in the past or there was a separate trigger rigged up for that event. 

AAA_script_2_to_0.vbs AAA_script_0_to_1.vbs

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...