Jump to content
You need to play a total of 10 battles to post in this section.

[How To] Add CustomPorts to your game (

1 comment in this topic

Recommended Posts

86 posts

With WG deactivated a certain file which was responsibel to add custom ports into the client. Instead they activated an even better way for including custom ports into your client which is easier to manage for modder and for people that want to use them.


How does it work?

We will use the mod api, where the customports class got unlocked with


But before we create the code, we will start with the basic things:


Step 1: Create the port

Basically some stuff stays the same. You insert your port into the space folder (which is in your [current version] folder) and name the folder like you want. Important should be that people might add other ports as well. So try to find an unique way of naming your port. My group uses for example the group shorttag before the real name of the port. An example: "wem_fog_arpeggio" (i will use this name btw for further explanations)




Step 2: Prepare the image for the port

The next step is creating an one color image for the port image as a placeholder. The name should be the same as above and you place your image into the following folder: "gui/ports".




Step 3: Activating the MOD API

Now we add the port into the game. We create a new file in any editor you use. (windows standard editor, notepad++ etc.). We make the file blank and save it as "PnFModsLoader.py".

This makes it possibel to load python mods from the python api. We place this file into the "current_version" folder of the game. In case of => "res_mods/"




Now we create a folder at the same place where the PnFModsLoader.py is located. We call it: "PnFMods".




Step 4: Creating a Code for your CustomPort

In step 3 we activated the Mod API and created a PnFMods folder. In this folder we create a new folder. Keep in mind that this folder should have an unique name which doesn't confilct with other names. So the best thing is for example your name and then the name of the port. Just as above with your port folder in the space folder.


After that we go into the new created folder and create a new file called: "Main.py".

It is important that this file is named like that. Otherwise your game won't recognize it.


In this Main.py file we copy paste this code:




print 'wem_fog_arpeggio loaded'

class MyMod:

    def __init__(self):
        customPorts.addCustomPort(portName = 'wem_fog_arpeggio', portDisplayName = 'Fog Arpeggio', isPremium = False, peculiarities = [ 'arpeggio' ])
        print 'Fog Arpeggio added'
g_myMod = MyMod()



What is it doing?


The first thing it does is it tells the game that it should use the API v1.0. (I think that this line of code should prevent old code for older API versions to run. So if they go up to 2.0, 1.0 might not work anymore, but noone knows that so far)


With the next line it writes "wem_fog_arpeggio loaded" into the log file.

This is usefull for debugging. There is a python.log file located in [worlf of warships installation folder]/profile. If you close your game, the game will update it and you can read the following lines for example:


[2016_12_02 15:22:56] [ModsAPI] 'PnFModsLoader.py' was found at: G:/World_of_Warships/res_mods/
[2016_12_02 15:22:56] [ModsAPI] 1 mods found, loading...
[2016_12_02 15:22:56] wem_fog_arpeggio loaded

[2016_12_02 15:22:56] Fog Arpeggio added
[2016_12_02 15:22:56] [ModsAPI] Loading mods completed


Which basically means that your mod worked. (The "Fog Arpeggio added" line gets written into the file when your game could sucessfully activate the customport.)


The next thing the code does is that it defines a new class with the call to create a new custom port as soon as the class gets created.


Now to the important part:


customPorts.addCustomPort(portName = 'wem_fog_arpeggio', portDisplayName = 'Fog Arpeggio', isPremium = False, peculiarities = [ 'arpeggio' ])

This is the line of code which creates the custom port.


You can basically add here an infinite amount of ports. I won't suggest doing this because i think it is better to create an own main.py file for each port you create. so that people can download those ports that they wanna have and a simple drag and drop from the files solves everything.


How to modify this part of code?


The "portname" should be always the same as the folder name from step 1 and the image name of step 2.

The "portDisplayName" is repsonible for the name ingame.

isPremium should be either "True" of "False" depending on if your mod should be a premium port or a normal one.

peculiarities: this one is also important. This is responsible for ARP ships, china arpeggio ships and other future content.

Ships can have a peculiaritie assigned. If they have one assigned it is impossible to see the "real" version of it as long as the assigned peculiatitie wasn't added to the port. Which basically means: You can't see the Arpeggio ships if the peculiaritie arpeggio wasn't added. Right now (02.12.2016 DD::MM::YYYY) there are 3 of them available.

  • arpeggio
  • ch_cragons
  • halloween_16

If you wanna add all of them you simply exchange the [ 'arpeggio' ] with [ 'arpeggio', 'ch_dragons', 'halloween_16' ].

If you only wanna have 2 of them you use it like this: [ 'ch_dragons', 'halloween_16' ] (keep in mind: with this version you can't see arpeggio ships, not in a battle, not in port)

If you wanna have 0 you exchange [ 'arpeggio' ] with None


The port is basically finished now. You can go ingame, select and activate it, make a nice screenshot for your port and edit the placeholder. I suggest using this tutorial for even better screenshots


I hope i could help you guys and have fun adding new ports for this game

  • Cool 2

Share this post

Link to post
Share on other sites