This guide is intended for contributions that are primarily aesthetic in nature and do not require testing. If you intend to write roles and game features, please follow the main setup guide.
- 30px by 40px
- Best to leave ~2px margins around
- Editing software: piskel (free), aseprite (paid)
Key Resources
Download the role spritesheet.
- Import spritesheet as a single image
- Paste the sprite in any blank "box"
- You can enable gridlines with Preferences > Grid, but you cannot select 30px x 40px as the grid size.
- Can be easier to add icons because it has gridlines.
File
>Open Image
View
>Show Grid
Image
>Configure Grid
. Disable aspect ratio (chain icon below sizing), then set horizontal 30px vertical 40px.- Scroll to 800% zoom (see the zoom value at the bottom dock)
- Export the new spritesheet.
File
>Overwrite roles.png
.
-
Create an account on Github, which you can think of like a GoogleDrive for code.
-
Go to UltiMafia/Ultimafia.
-
At the top right, click "Fork" to create your personal copy of UltiMafia, e.g.
DrSharky/Ultimafia
. -
Go to your fork's webpage, which should be
https://github.com/<your_username>/Ultimafia
. -
Create a codespace on your fork.
How it works: you will make edits to your personal repository, and then make a request for your changes to be accepted into the master copy.
This step is important to prevent git conflicts.
- Open the terminal.
Navigation
>View
>Terminal
, or Ctrl + `.
- Stash away your previous changes.
git stash
- Return to the master branch.
git checkout master
- Get the latest updates from
UltiMafia/Ultimafia
's master branch.
git pull upstream master
- Create a new branch (i.e. code workspace) for your role. To avoid dealing conflicts, use a new branch name each time.
git checkout -b add-mafioso-icon
- Navigate to
react_main/public/images/roles.png
- Drag and drop the new spritesheet in, selecting "replace image".
- Navigate to
/react_main/src/css/roles.css
- Each role has its own css defined, such as the ones below.
- The two numbers represent the role's offset on the spritesheet, [
horizontal_offset
,vertical offset
].
.role-Mafia-Blacksmith {
background-position: -300px -40px;
}
.role-Mafia-Monkey {
background-position: -30px -80px;
}
Determining the offset of your role icon
- Horizontal offset: From Left to Right, it is
0px
for the first column, then-30px
,-60px
… - Vertical offset: From Top to Bottom, it is
0px
for the first row, then-40px
,-80px
… - Tip: If you are lazy to calculate, find another role on the same row (
horizontal_offset
) and column (vertical_offset
) as your icon.
Extra info: What do offsets mean? You can imagine a frame on the first 30px
by 40px
of the spritesheet. E.g. Mayor has offset [-60px
, -40px
]. This means you would move the image left by 60px
, i.e. two horizontal frames. You would also move the image up by 40px
, i.e. one vertical frame. These actions would position your icon in the reference frame.
Adding role css
- Create a new css class for your role.
- Note the position of where you add the css.
- Roles are sorted by alignment,
Village
>Mafia
>Independent
>Cult
. Within each alignment, roles are sorted by the row in which they appear.
.role-Mafia-<RoleName> {
background-position: -30(horizontal)px -40(vertical)px;
}
- Check the changes made. You should be on your role branch, with only two files modified - the spritesheet and the role css.
git status
You can also type this command to double check the changes to the role css. It will show you which lines have been added or modified.
git diff react_main/src/css/roles.css
- Confirm your changes by committing.
git commit -a -m "added mafioso icon"
The confirmatory message will be like this:
[add-example-icon abcde12] added example icon
2 files changed, 4 insertions(+)
- Upload your code to Github (also known as "remote"). The branch name is what you see beside
abcde12
in the previous confirmatory message. Note that your copy won't be exactlyabcde12
git push origin add-example-icon
The changes have been committed to your personal fork, e.g. DrSharky/Ultimafia
. The site is running on a shared master copy, UltiMafia/Ultimafia
.
-
Go to UltiMafia/Ultimafia.
-
You might see a message prompting you to create a pull request.
Click Compare & pull request
if you can, then you can skip Step 3.
- If you do not see that automated message, click
New Pull Request
. Select "compare across forks". Find your repository in the red box, and find your branch name in the blue box.
-
(Optional) Add your ign or any details in the description. You can also drag and drop the role icon sprites in for easier viewing.
-
Set the Pull Request title to
assets(role icon): added icon for XXXXX
-
Click
Create Pull Request
, ensuring that it does not say "draft". -
Your pull request (PR) will appear here, and it will soon be reviewed.
Disclaimer: Every Github user has an allocated amount of Codespace usage each month. If you are just developing role icons, you can skip this step. However, if you run any other processes like containers in the background, then this step is important.
Once you have submitted your pull request, go back to your fork's webpage, i.e. https://github.com/<your_username>/Ultimafia
.
You can either shutdown (can turn back on) or delete (need to recreate) the codespace.