Is There a Way to Disable User-Created Prisoner Names/Bios?

Is There a Way to Disable User-Created Prisoner Names/Bios? - Girl with leg amputation on asphalt road in gloomy weather

Just as the title says. There are a LOT of terribly written names and biographies for prisoners that really ruin what immersion there is, and I haven't seen anything pertaining to this yet. So, there it is. Can it be done with a mod/simple option I have yet to see?



Best Answer

As of now (Alpha-29) this is currently not possible with a mod, because the game does not recognize when you try to override "names_in_the_game.txt". If it annoys you enough you can modify main.dat directly though.

I've created a mod on steam that provides the files, and same instructions, as this answer: http://steamcommunity.com/sharedfiles/filedetails/?id=402505971.

IMPORTANT: This answer modifies gamefiles directly. The answer is provided as-is, and could very well break the game completely. You are strongly recommended to back up your game files and your save files before trying this out. You'll likely need to repeat the steps after the game auto-updates.

First we need WinRar. You can download a free trial version from the official website if you don't have it already.

Go to your game files. By default they are located in C:\Program Files (x86)\Steam\steamapps\common\Prison Architect. Open "main.dat" in WinRAR. You might need to rename the file to "main.rar" to get this to work. Extract all the files to a place you can find, such as your desktop.

There should be a Data folder in the files you just extracted. Replace "names_in_the_game.txt" with a version you like better. An empty file will remove all the custom prisoners from the game. I personally prefer to run a script on the original file to normalize some of the crazy stuff. I'll include the sourcecode of a python script I wrote in the bottom.

Once you are done, replace the file "names_in_the_game.txt" in the Data folder. Right-click on the Data folder and "add it to archive". This should open WinRar. Set the outputfile to be main.dat. The output format should be "rar". You have to turn on the option "make compact archive" or something along those lines in the archive options. Click "Ok" and it will start recreating main.dat. Last, move "main.dat" back into your game folder.


import re, random

sourcebiographies = "biographies.txt"
sourcefile = "names_in_the_game_original.txt"
outputfile = "names_in_the_game.txt"

forenames = []
surnames = []
validpresurname = ['mc', 'von', 'van', 'de', 'da', 'di', 'du', 'la', 'le', 'der', 'the', 'af', 'of', 'el', 'vi', 'v/d', 'den', 'al', 'del', 'se']

i = open( sourcebiographies, "r" )
for line in i:
  x = re.split( "[\t ]+", line.strip(), 1 )
  if x[0] == "Forename":
    forenames.append( x[1] )
  elif x[0] == "Surname":
    surnames.append( x[1] )

i.close()

i = open( sourcefile, "r" )
o = open( outputfile, "w" )
for line in i:
  x = re.split( "[\t ]+", line.strip(), 1 )

  if len(x) > 1:
    val = x[1][1:-1]

  if x[0] == "Bio":
    #Blank out every bio. Most of them are crap
    o.write( "  Bio \t\t\"\"\n" )
  elif x[0] == "LastName" and len(val.strip().split( " " )) > 1 and val.strip().split( " " )[0].lower() not in validpresurname:
    #Some people abused the LastName field. If our educated guess of finding out
    #if the name is valid, we replace it with a random name
    o.write( "  LastName \t\t\"%s\"\n" % random.choice( surnames ) )
  elif x[0] == "LastName" and len( val ) <= 1:
    #If the last name is 1 or 0 characters long, we replace it with a random one
    o.write( "  LastName \t\t\"%s\"\n" % random.choice( surnames ) )
  elif x[0] == "FirstName" and len( val ) <= 1:
    #Similary if the first name is 1 or 0 characters long, replace it with a
    #normal name
    o.write( "  FirstName \t\t\"%s\"\n" % random.choice( forenames ) )
  elif x[0] == "NickName" and (len(val.split( ' ' )) > 2 or len(val) > 15):
    #Some people write entire stories in their nickname; if there are more
    #than 2 words in the nickname, or the nickname is very long (15+ characters)
    #we just ignore it
    pass
  elif x[0] == "FirstName" and re.match( "^(?P<rep>.+)(?P=rep)(?P=rep).+$", val.lower() ):
    #If the first name is a repetition of some kind, let's replace it
    o.write( "  FirstName \t\t\"%s\"\n" % random.choice( forenames ) )
  elif x[0] == "LastName" and re.match( "^(?P<rep>.+)(?P=rep)(?P=rep).+$", val.lower() ):
    #Same for the surname
    o.write( "  LastName \t\t\"%s\"\n" % random.choice( surnames ) )
  elif x[0] == "NickName" and not re.match( "^[a-z ]+$", val.lower() ):
    #Some people have weird characters in their nickname; we don't want that
    pass
  elif x[0] == "FirstName" or x[0] == "LastName" or x[0] == "NickName":
    #Some people don't know how to capitalize a name. On the off-chance
    #that we misspell 1 or 2 names we just title-case the first and last name!
    o.write( "  %s \t\t\"%s\"\n" % (x[0], val.title()) )
  else:
    #Everything else we just write back unchanged
    o.write( line )

i.close()
o.close()



Pictures about "Is There a Way to Disable User-Created Prisoner Names/Bios?"

Is There a Way to Disable User-Created Prisoner Names/Bios? - White disabled parking sign on post located on empty asphalt parking lot with marking line on street in foggy weather
Is There a Way to Disable User-Created Prisoner Names/Bios? - Alpenwanderweg
Is There a Way to Disable User-Created Prisoner Names/Bios? - Wooden Bridge on Rainforest





How to find Inactive AD users and disable them using PowerShell script




More answers regarding is There a Way to Disable User-Created Prisoner Names/Bios?

Answer 2

Like Landric said you can now report bad bios but there is no way (at least not yet) to turn them off.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Ahmed akacha, Erik Mclean, Mirko Bellmann, Pixabay