Skip to content

Commit

Permalink
Add different capture areas
Browse files Browse the repository at this point in the history
- "Full" map capture is now "extended" map capture
- Made coordinates align with in-game chunks
- Add images for different capture modes
- Update README.md
- Add AREAS.md
  • Loading branch information
Dadido3 committed Oct 20, 2020
1 parent 0aa2a0f commit 6a9c32c
Show file tree
Hide file tree
Showing 12 changed files with 237 additions and 20 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,6 @@ $RECYCLE.BIN/
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

/libs/
output/
/distribution
/output/
/distribution/
/bin/stitch/output.png
66 changes: 66 additions & 0 deletions AREAS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Capture areas

A list of available capture areas.
Coordinates are in in-game "virtual" pixels.
`Right` and `Bottom` coordinates are not included in the rectangle.

The dimensions of the capture rectangle are exactly:

``` lua
Width = Right - Left
Height = Bottom - Top
```

Depending on the virtual resolution you use, the resulting capture may be a bit larger.
If you need the output to have exact dimensions, supply your needed coordinates to the stitcher tool.

Coordinate system:

![Coordinate system](images/coordinates.png)

## `Base layout`

This area features only the "base layout".
Everything around this area uses a similar layout, but with different materials and a different seed.

``` lua
Left = -17920
Top = -7168
Right = 17920
Bottom = 17408
```

The end result will have a size of `35840 x 24576 pixels ~= 880 megapixels`.

![Base layout](images/scale32_base-layout.png)

## `Main world`

This area features only the "base layout" plus the area above (sky) and below (hell).
It totals to a height of exactly 3 times the base layout's height.

``` lua
Left = -17920
Top = -31744
Right = 17920
Bottom = 41984
```

The end result will have a size of `35840 x 73728 pixels ~= 2642 megapixels`.

![Base layout](images/scale32_main-world.png)

## `Extended`

This area consists of `Main world` plus fractions of the left and right parallel worlds.

``` lua
Left = -25600
Top = -31744
Right = 25600
Bottom = 41984
```

The end result will have a size of `51200 x 73728 pixels ~= 3775 megapixels`.

![Base layout](images/scale32_extended.png)
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Addon that captures a Noita world and saves it as image.

![missing image](images/example1.png)
![missing image](images/example2.png)

A resulting image with nearly 3.8 gigapixels can be [seen here](https://easyzoom.com/image/223556) (Warning: Spoilers).

Expand All @@ -14,7 +14,7 @@ A resulting image with nearly 3.8 gigapixels can be [seen here](https://easyzoom
- A processor.
- Optionally a monitor, keyboard and mouse to interact with the mod/software.
- A sound card to listen to music while it's grabbing screenshots.
Capturing and stitching will take about 180 minutes (160 + 20).
Capturing and stitching the "extended" map will take about 180 minutes (160 + 20).

## Usage

Expand All @@ -25,7 +25,7 @@ A resulting image with nearly 3.8 gigapixels can be [seen here](https://easyzoom
5. Enable the mod and restart Noita.
6. In the game you should see text on screen.
- Either press `>> Start capturing map around view <<` to capture in a spiral around your current view.
- Or press `>> Start capturing full map <<` to capture the whole map.
- Or press any other option to capture [specific areas](AREAS.md).
7. The screen will jump around, and the game will take screenshots automatically.
- Screenshots are saved in `.../Noita/mods/noita-mapcap/output/`.
- Don't move the game window outside of screen space. You can cover it with other windows, and continue using your PC.
Expand Down Expand Up @@ -82,7 +82,7 @@ Here is a step by step explanation how to do so:
6. When the game is loaded (When you can control your character):
- Press `F5`, `F8` and `F12` (In that order).

7. Press the `>> Start capturing full map <<` button.
7. Press the `>> Start capturing extended map <<` button.

8. Wait a few hours until it's complete.

Expand All @@ -104,7 +104,7 @@ The following two equations have to be true:

You can also change how much the tiles overlap by adjusting the `CAPTURE_GRID_SIZE` in `.../Noita/mods/noita-mapcap/files/capture.lua`. If you increase the grid size, you can capture more area per time. But on the other hand the stitcher may not be able to remove artifacts if the tiles don't overlap enough.

The rectangle for the full map capture mode is defined in `.../Noita/mods/noita-mapcap/files/capture.lua`.
The rectangles for the different capture modes are defined in `.../Noita/mods/noita-mapcap/files/capture.lua`.

## License

Expand Down
45 changes: 36 additions & 9 deletions files/capture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,29 @@ CAPTURE_PIXEL_SIZE = 1 -- Screen to virtual pixel ratio
CAPTURE_GRID_SIZE = 512 -- in ingame pixels. There will always be exactly 4 images overlapping if the virtual resolution is 1024x1024
CAPTURE_FORCE_HP = 4 -- * 25HP

CAPTURE_LEFT = -25000 -- in ingame pixels. Left edge of the full map capture rectangle
CAPTURE_TOP = -36000 -- in ingame pixels. Top edge of the full map capture rectangle
CAPTURE_RIGHT = 25000 -- in ingame pixels. Right edge of the full map capture rectangle (Pixels are not included in the rectangle)
CAPTURE_BOTTOM = 36000 -- in ingame pixels. Bottom edge of the full map capture rectangle (Pixels are not included in the rectangle)
-- "Base layout" (Base layout. Every part outside this is based on a similar layout, but uses different materials/seeds)
CAPTURE_AREA_BASE_LAYOUT = {
Left = -17920, -- in ingame pixels.
Top = -7168, -- in ingame pixels.
Right = 17920, -- in ingame pixels. (Coordinate is not included in the rectangle)
Bottom = 17408 -- in ingame pixels. (Coordinate is not included in the rectangle)
}

-- "Main world" (The main world with 3 parts: sky, normal and hell)
CAPTURE_AREA_MAIN_WORLD = {
Left = -17920, -- in ingame pixels.
Top = -31744, -- in ingame pixels.
Right = 17920, -- in ingame pixels. (Coordinate is not included in the rectangle)
Bottom = 41984 -- in ingame pixels. (Coordinate is not included in the rectangle)
}

-- "Extended" (Main world + a fraction of the parallel worlds to the left and right)
CAPTURE_AREA_EXTENDED = {
Left = -25600, -- in ingame pixels.
Top = -31744, -- in ingame pixels.
Right = 25600, -- in ingame pixels. (Coordinate is not included in the rectangle)
Bottom = 41984 -- in ingame pixels. (Coordinate is not included in the rectangle)
}

local function preparePlayer()
local playerEntity = getPlayer()
Expand Down Expand Up @@ -117,7 +136,7 @@ function startCapturingSpiral()
)
end

function startCapturingHilbert()
function startCapturingHilbert(area)
local ox, oy = GameGetCameraPos()

local virtualWidth, virtualHeight =
Expand All @@ -127,10 +146,18 @@ function startCapturingHilbert()
local virtualHalfWidth, virtualHalfHeight = math.floor(virtualWidth / 2), math.floor(virtualHeight / 2)

-- Get size of the rectangle in grid/chunk coordinates
local gridLeft = math.floor(CAPTURE_LEFT / CAPTURE_GRID_SIZE)
local gridTop = math.floor(CAPTURE_TOP / CAPTURE_GRID_SIZE)
local gridRight = math.ceil(CAPTURE_RIGHT / CAPTURE_GRID_SIZE) + 1
local gridBottom = math.ceil(CAPTURE_BOTTOM / CAPTURE_GRID_SIZE) + 1
local gridLeft = math.floor(area.Left / CAPTURE_GRID_SIZE)
local gridTop = math.floor(area.Top / CAPTURE_GRID_SIZE)
local gridRight = math.ceil(area.Right / CAPTURE_GRID_SIZE) -- This grid coordinate is not included
local gridBottom = math.ceil(area.Bottom / CAPTURE_GRID_SIZE) -- This grid coordinate is not included

-- Edge case
if area.Left == area.Right then
gridRight = gridLeft
end
if area.Top == area.Bottom then
gridBottom = gridTop
end

-- Size of the grid in chunks
local gridWidth = gridRight - gridLeft
Expand Down
15 changes: 12 additions & 3 deletions files/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function DrawUI()
if modGUI ~= nil then
GuiStartFrame(modGUI)

GuiLayoutBeginVertical(modGUI, 50, 50)
GuiLayoutBeginVertical(modGUI, 50, 20)
if not UiProgress then
-- Show informations
local problem
Expand Down Expand Up @@ -108,9 +108,18 @@ function DrawUI()
UiProgress = {}
startCapturingSpiral()
end
if GuiButton(modGUI, 0, 0, ">> Start capturing full map <<", 1) then
GuiTextCentered(modGUI, 0, 0, " ")
if GuiButton(modGUI, 0, 0, ">> Start capturing base layout <<", 1) then
UiProgress = {}
startCapturingHilbert(CAPTURE_AREA_BASE_LAYOUT)
end
if GuiButton(modGUI, 0, 0, ">> Start capturing main world <<", 1) then
UiProgress = {}
startCapturingHilbert(CAPTURE_AREA_MAIN_WORLD)
end
if GuiButton(modGUI, 0, 0, ">> Start capturing extended map <<", 1) then
UiProgress = {}
startCapturingHilbert()
startCapturingHilbert(CAPTURE_AREA_EXTENDED)
end
GuiTextCentered(modGUI, 0, 0, " ")
elseif not UiProgress.Done then
Expand Down
113 changes: 113 additions & 0 deletions images/coordinates.pdn

Large diffs are not rendered by default.

Binary file added images/coordinates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/example2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/scale32_base-layout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/scale32_extended.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/scale32_main-world.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion scripts/pack_windows.x86.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ rd distribution /s/q
mkdir distribution
mkdir distribution/noita-mapcap

robocopy "." "distribution/noita-mapcap/" init.lua LICENSE compatibility.xml mod.xml README.md
robocopy "." "distribution/noita-mapcap/" init.lua LICENSE compatibility.xml mod.xml README.md AREAS.md
robocopy "images/" "distribution/noita-mapcap/images/" coordinates.png example1.png example2.png scale32_base-layout.png scale32_main-world.png scale32_extended.png

robocopy "data" "distribution/noita-mapcap/data" /e
robocopy "files" "distribution/noita-mapcap/files" /e
Expand Down

0 comments on commit 6a9c32c

Please sign in to comment.