-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# About the pull request This PR adds a debug verb Mass-Screenshot that regardless of your zoom level, teleports you around the map and forces your client to screenshot images. These images can then be used in a new MapTileImageTool python script (requires `pip install pillow`) to tile together into a single image. For example: - [LV-624](https://imgur.com/HhxBIVu) ([actual file](https://cdn.discordapp.com/attachments/322351602075697163/1132607486470389782/LV624.png) is a 5600x7232 17.8MB PNG) - [USS Almayer](https://imgur.com/oxCizwc) ([actual file](https://cdn.discordapp.com/attachments/322351602075697163/1132607484985618492/Almayer.png) is a 9600x6432 14.1MB PNG) In order to have accurate map sizes, SSmapping now stores this data in its z_list. # Explain why it's good for the game Allows us to create a full screen shot of an entire z-level even at runtime as a client sees it. However, it is unlikely this will work perfectly in multiplayer as players move around or events occur. Two passes might be a solution to mitigate this or a larger zoom level. # Testing Photographs and Procedure 1. Launch and start game 2. Teleport to some z-level you want to screenshot 3. Optionally change your zoom level and other ghost visibility settings (self will automatically be altered) or medhud settings. 4. Use the debug tab verb Mass-Screenshot 5. Follow prompts and wait for process to complete 6. Install Pillow for python if you haven't already `pip install pillow` 7. Run `python tools\MapTileImageTool\MapTileImageTool.py` 8. Follow prompts (point to your BYOND/screenshots folder, pick a folder for output, output file name, and 4 numbers given in game) ![image](https://github.com/cmss13-devs/cmss13/assets/76988376/05d89bc7-2a2d-421f-890d-a8e63523cc31) # Changelog :cl: Drathek add: Added the debug verb Mass-Screenshot and a python script MapTileImageTool to combine those images into a single full image map. /:cl:
- Loading branch information
Showing
5 changed files
with
164 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#This script processes screenshots from the Mass-Screenshot Debug verb in SS13 into a full map image | ||
|
||
# Loosely based on https://github.com/vortex1942/telescience/blob/master/src/tools/PhotoProcessor.py | ||
|
||
# This script uses the Pillow library (PIL) install it with pip install pillow | ||
|
||
#***************************************************************** | ||
#******ALL .pngs in the rawimages folder will be processed******** | ||
#********Exported file may be overwritten in the output*********** | ||
#***************************************************************** | ||
|
||
from PIL import Image | ||
from os import listdir, path | ||
|
||
# Selection of Input/Output directories | ||
rawimgdir = str(input("Directory of RAW images: ")) | ||
if path.exists(rawimgdir) == False: | ||
print("Directory could not be found!") | ||
exit(1) | ||
|
||
imgdir = str(input("Directory for output image (leave blank to use RAW image directory): ")) | ||
if imgdir == "": | ||
imgdir = rawimgdir | ||
elif path.exists(imgdir) == False: | ||
print("Directory could not be found!") | ||
exit(1) | ||
|
||
exportfilename = str(input("Filename for Full Image (E.g LV624_Complete): ")) | ||
if exportfilename == "": | ||
print("Filename is invalid!") | ||
exit(1) | ||
|
||
gamearguments = str(input("Values provided after using the Mass-Screenshot verb: ")) | ||
gamearguments = gamearguments.split() | ||
if len(gamearguments) != 4: | ||
print("Invalid arguments!") | ||
exit(1) | ||
pixelsize = int(gamearguments[3]) | ||
halfchunksize = int(gamearguments[2]) | ||
width = (int(gamearguments[0]) + halfchunksize - 2) | ||
height = (int(gamearguments[1]) + halfchunksize - 2) | ||
if width < 1 or height < 1 or pixelsize < 1 or halfchunksize < 1 or halfchunksize * 2 >= width or halfchunksize * 2 >= height: | ||
print("Invalid arguments!") | ||
exit(1) | ||
width *= pixelsize | ||
height *= pixelsize | ||
halfchunksize *= pixelsize | ||
|
||
# Function for saving the image (params: name=Filename, export=Image IMG variable) | ||
def func_exportfullimage(name, export): | ||
print("SAVING IMAGE") | ||
file = (imgdir+"\\"+name+".png") | ||
print(file) | ||
file = open(file, "wb") | ||
export.save(file) | ||
|
||
# Where the magic happens, Creates a canvas and pastes RAWimages in a grid fashion | ||
masterexport = Image.new("RGBA", (width,height), color=(0,0,0,255)) | ||
imagelist = [file for file in sorted(listdir(rawimgdir), key=lambda x: path.getmtime(rawimgdir+"\\"+x)) if file.endswith('.png')] | ||
imagecount = len(imagelist) | ||
chunksize = halfchunksize * 2 - pixelsize | ||
x = fc = 0 | ||
y = height - chunksize | ||
|
||
# For loop stitches RAw images together | ||
for p in imagelist: | ||
file = (rawimgdir+"\\"+p) | ||
photo = Image.open(file).convert("RGBA") | ||
#Verbose mode [Iteration] [Image Coords] [RAW Filename] | ||
#print("iter: " f"{fc : >2}", "IMG XY: " f"{x : >4}", f"{y : >4}", "FILE: " f"{p : >13}") | ||
masterexport.paste(photo, (x, y)) | ||
x += chunksize | ||
fc += 1 | ||
if x >= width: | ||
x = 0 | ||
y -= chunksize | ||
y = max(y, 0) | ||
progress = fc / imagecount * 100 | ||
print("%.1f" % progress, "%") | ||
x = min(x, width - chunksize) | ||
|
||
func_exportfullimage(exportfilename, masterexport) | ||
|
||
# Hopefully you got this far | ||
print("COMPLETED :)") |