Skip to content

Contribution Guide

OrsellGaming edited this page Jan 31, 2024 · 2 revisions

Contributing To P2MM:

Q: Can I add support for P2MM to a workshop map?

A: Yes, you will need extensive knowledge of how to program in Portal 2's VScript language, Squirrel, or have experience making/editing Hammer maps for Portal 2. There are two methods to add support to a workshop map: Making a map support file and making the map support for P2MM directly in Hammer.

Map Support File:

Our map supports are categorized into four categories: standard, speedrun, deathmatch, and futbol. Currently, as of version 2.1.0, only standard map supports are functional. The standard involves map support for regular play without any specific modifications by P2MM. To create a map support file, you will need to use the release/main version of P2MM. Head to the GitHub repository (see Resources below) and download the main branch. You can download the repo anywhere you want. In the src/mapmaking directory of the downloaded repo, you can find a map support file template named #mapsupport-template.nut. This file is what you will need to get started. Make a copy and change the file's name to the map you want support for. Example: mp_coop_lobby_3.nut. Once you have made your file, go to where your release P2MM installation is, it's in the Documents folder on Windows and in the .local folder on Linux. Next you will want to grab the workshop folder id for the map you're making a support for, this can be determined if you already have the workshop map downloaded in the Portal 2/portal2/maps/workshop folder in your Portal 2 installation. Once you have the id, make a folder that is named the id in p2mm/ModFiles/Portal 2/install_dlc/scripts/vscripts/multiplayermod/mapsupport/standard/workshop It should look like p2mm/ModFiles/Portal 2/install_dlc/scripts/vscripts/multiplayermod/mapsupport/standard/workshop/(workshop map folder id)/(map support file).

Now it's time to add the support for the workshop, but first, you need to determine what needs to be fixed for P2MM to work. Try to complete the workshop map and mark down bugs, errors, or soft locks that occur while playing through the map. These tests can be done simply by starting up P2MM and switching to the workshop map. Feel free to have some friends along for testing.

Going back to the repo you downloaded. if you look in src/ModFiles/Portal 2/install_dlc/scripts/vscripts/multiplayermod/hooks.nut, there will be instructions on what each map support function does. Depending on what bugs or other situations occur, you will need to have the VScript execute during these periods. src/ModFiles/Portal 2/install_dlc/scripts/vscripts/multiplayermod/functions.nut contains a bunch of premade functions that can be used from creating triggers to removing certain entitles. There is also src/ModFiles/Portal 2/install_dlc/scripts/vscripts/multiplayermod/mapsupport/#rootfunctions.nut, which has a bunch of other functions that you can use.

Direct Hammer Support:

If you are an experienced Hammer map maker, you can also build map support for P2MM straight into your Hammer map by making or modifying a map to function around having more than two players. You can also make a map from scratch specifically for P2MM if you want to also. Like the map support file method above, you should also do extensive testing beforehand to know what issues need to be addressed.

Once you done with adding P2MM support for either method, send a DM to one of the Head Developers or Contributors to add your map in the #community-maps channel. For either of these methods, we will need to test the map to ensure everything works correctly with P2MM before we place it in the #community-maps channel on the P2MM Discord.

Thanks for your contributions to P2MM!

Q: Can I add a translation to the P2MM Launcher?

A: Yes! Please do! We are in need of some translations for our launcher so non-native English users can understand what each part of the launcher does.

Head to the GitHub repository (see Resources below) and make a repo fork. Make sure you are making your edits on the dev branch. You can download the repo anywhere you want. In the src/languages folder, make a copy of the English.json file and rename it to the language you're translating for. Inside the file, make your translations in each JSON key's value associated with the translation. Do not change the name of the key, as the launcher won't be able to display your translation, leading to a crash. Please make sure to keep the same formatting as the original English translation, including any spaces, quotation marks, slashes, and any \n's in the initial values. Removing them might make your translation not appear correctly in the launcher, but feel free to add any if you believe it will make it display better.

Once you're finished translating, test if your translation appears correctly. If you see a bunch of characters appear as question marks, then the language being translated doesn't support the default font we use. Find a font that looks similar to the original pixel font and supports the language of the translation. Place it into the src/GUI/assets/fonts folder. At the top of the JSON translation file, change out the font that is used with the font you placed into the src/GUI/assets/fonts folder. If the language displays appropriately, then you are good to go!

We also recommend making a README file for your translation. That way, both the launcher and repo accommodate the language. In the name of the README file, make sure to add the sub-tag for your language. Example for Spanish: README-es.md From there, you need to make a pull request from your forked dev branch to the original repo's dev branch. We will then ensure everything is working in order and add the detection for your language on systems that have that language set to default.

Thanks for your contribution to P2MM!