mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-18 17:17:31 +00:00
Optimizations
- Update README.md - GameSetCameraPos(x, y) several time while waiting to get all chunks loaded - Fix tile output coordinates (Top left corner coordinates instead of center) - Hide some ui parts by default
This commit is contained in:
parent
8cf46232de
commit
12ea3f83ae
47
README.md
47
README.md
@ -54,6 +54,53 @@ You can also change how much the tiles overlap by adjusting the `CAPTURE_GRID_SI
|
|||||||
|
|
||||||
The rectangle for the full map capture mode is defined in `.../Noita/mods/noita-mapcap/files/capture.lua`.
|
The rectangle for the full map capture mode is defined in `.../Noita/mods/noita-mapcap/files/capture.lua`.
|
||||||
|
|
||||||
|
## How to do a full map capture minimal trouble
|
||||||
|
|
||||||
|
For the best experience and result, follow these steps:
|
||||||
|
|
||||||
|
1. Change the following values inside of `.../Noita/mods/noita-mapcap/files/magic_numbers.xml`:
|
||||||
|
|
||||||
|
``` xml
|
||||||
|
<MagicNumbers
|
||||||
|
VIRTUAL_RESOLUTION_X="840"
|
||||||
|
VIRTUAL_RESOLUTION_Y="840"
|
||||||
|
STREAMING_CHUNK_TARGET="12"
|
||||||
|
...
|
||||||
|
>
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Change the following values inside of `.../Noita/save_shared/config.xml`: (Not the one in AppData!)
|
||||||
|
|
||||||
|
``` xml
|
||||||
|
<Config
|
||||||
|
...
|
||||||
|
backbuffer_height="840"
|
||||||
|
backbuffer_width="840"
|
||||||
|
internal_size_h="840"
|
||||||
|
internal_size_w="840"
|
||||||
|
window_h="840"
|
||||||
|
window_w="840"
|
||||||
|
framerate="600"
|
||||||
|
...
|
||||||
|
>
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Start `.../Noita/noita_dev.exe`
|
||||||
|
- If it's not there, copy it from `.../Noita/tools_modding/noita_dev.exe`
|
||||||
|
- If it's there, check if it is recent. If not, also copy it.
|
||||||
|
- Click `Ignore always` on the `ASSERT FAILED!` requester.
|
||||||
|
|
||||||
|
4. When the game is loaded (When you can control your character):
|
||||||
|
- Press `F5`, `F8` and `F12` (In that order).
|
||||||
|
- Press `F7`, and disable `mTrailerMode` in the menu. (This should reduce chunk loading problems)
|
||||||
|
- Press `F7` again to close the menu.
|
||||||
|
|
||||||
|
5. Press the `>> Start capturing full map <<` button.
|
||||||
|
|
||||||
|
6. Wait a few hours until it's complete.
|
||||||
|
|
||||||
|
7. Stitch the image as described above.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[MIT](LICENSE)
|
[MIT](LICENSE)
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
// This software is released under the MIT License.
|
// This software is released under the MIT License.
|
||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
// TODO: Fix transparent pixels at the output image border
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -31,11 +31,42 @@ local function resetPlayer()
|
|||||||
setPlayerHP(CAPTURE_FORCE_HP)
|
setPlayerHP(CAPTURE_FORCE_HP)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local xOld, yOld = 0, 0
|
||||||
|
local function captureScreenshot(x, y, rx, ry)
|
||||||
|
-- "Larger than grid jump" delay
|
||||||
|
local delay = CAPTURE_DELAY - 1
|
||||||
|
if math.abs(x - xOld) > CAPTURE_GRID_SIZE or math.abs(y - yOld) > CAPTURE_GRID_SIZE then
|
||||||
|
delay = delay + CAPTURE_BIGJUMP_DELAY
|
||||||
|
end
|
||||||
|
xOld, yOld = x, y
|
||||||
|
|
||||||
|
-- Set pos several times, so that chunks will load even if nothing happens in the surrounding
|
||||||
|
-- This prevents black blocks in areas without entites
|
||||||
|
for i = 1, delay, 1 do
|
||||||
|
GameSetCameraPos(x, y)
|
||||||
|
wait(1)
|
||||||
|
end
|
||||||
|
GameSetCameraPos(x, y)
|
||||||
|
|
||||||
|
UiHide = true -- Hide UI while capturing the screenshot
|
||||||
|
wait(1)
|
||||||
|
if not TriggerCapture(rx, ry) then
|
||||||
|
UiCaptureProblem = "Screen capture failed. Please restart Noita."
|
||||||
|
end
|
||||||
|
UiHide = false
|
||||||
|
end
|
||||||
|
|
||||||
function startCapturingSpiral()
|
function startCapturingSpiral()
|
||||||
local ox, oy = GameGetCameraPos()
|
local ox, oy = GameGetCameraPos()
|
||||||
ox, oy = math.floor(ox / CAPTURE_GRID_SIZE) * CAPTURE_GRID_SIZE, math.floor(oy / CAPTURE_GRID_SIZE) * CAPTURE_GRID_SIZE
|
ox, oy = math.floor(ox / CAPTURE_GRID_SIZE) * CAPTURE_GRID_SIZE, math.floor(oy / CAPTURE_GRID_SIZE) * CAPTURE_GRID_SIZE
|
||||||
local x, y = ox, oy
|
local x, y = ox, oy
|
||||||
|
|
||||||
|
local virtualWidth, virtualHeight =
|
||||||
|
tonumber(MagicNumbersGetValue("VIRTUAL_RESOLUTION_X")),
|
||||||
|
tonumber(MagicNumbersGetValue("VIRTUAL_RESOLUTION_Y"))
|
||||||
|
|
||||||
|
local virtualHalfWidth, virtualHalfHeight = math.floor(virtualWidth / 2), math.floor(virtualHeight / 2)
|
||||||
|
|
||||||
preparePlayer()
|
preparePlayer()
|
||||||
|
|
||||||
GameSetCameraFree(true)
|
GameSetCameraFree(true)
|
||||||
@ -46,62 +77,34 @@ function startCapturingSpiral()
|
|||||||
function()
|
function()
|
||||||
-- +x
|
-- +x
|
||||||
for i = 1, i, 1 do
|
for i = 1, i, 1 do
|
||||||
local rx, ry = x * CAPTURE_PIXEL_SIZE, y * CAPTURE_PIXEL_SIZE
|
local rx, ry = x * CAPTURE_PIXEL_SIZE - virtualHalfWidth, y * CAPTURE_PIXEL_SIZE - virtualHalfHeight
|
||||||
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
||||||
GameSetCameraPos(x, y)
|
captureScreenshot(x, y, rx, ry)
|
||||||
wait(CAPTURE_DELAY - 1)
|
|
||||||
UiHide = true -- Hide UI while capturing the screenshot
|
|
||||||
wait(1)
|
|
||||||
if not TriggerCapture(rx, ry) then
|
|
||||||
UiCaptureProblem = "Screen capture failed. Please restart Noita."
|
|
||||||
end
|
|
||||||
UiHide = false
|
|
||||||
end
|
end
|
||||||
x, y = x + CAPTURE_GRID_SIZE, y
|
x, y = x + CAPTURE_GRID_SIZE, y
|
||||||
end
|
end
|
||||||
-- +y
|
-- +y
|
||||||
for i = 1, i, 1 do
|
for i = 1, i, 1 do
|
||||||
local rx, ry = x * CAPTURE_PIXEL_SIZE, y * CAPTURE_PIXEL_SIZE
|
local rx, ry = x * CAPTURE_PIXEL_SIZE - virtualHalfWidth, y * CAPTURE_PIXEL_SIZE - virtualHalfHeight
|
||||||
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
||||||
GameSetCameraPos(x, y)
|
captureScreenshot(x, y, rx, ry)
|
||||||
wait(CAPTURE_DELAY - 1)
|
|
||||||
UiHide = true
|
|
||||||
wait(1)
|
|
||||||
if not TriggerCapture(rx, ry) then
|
|
||||||
UiCaptureProblem = "Screen capture failed. Please restart Noita."
|
|
||||||
end
|
|
||||||
UiHide = false
|
|
||||||
end
|
end
|
||||||
x, y = x, y + CAPTURE_GRID_SIZE
|
x, y = x, y + CAPTURE_GRID_SIZE
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
-- -x
|
-- -x
|
||||||
for i = 1, i, 1 do
|
for i = 1, i, 1 do
|
||||||
local rx, ry = x * CAPTURE_PIXEL_SIZE, y * CAPTURE_PIXEL_SIZE
|
local rx, ry = x * CAPTURE_PIXEL_SIZE - virtualHalfWidth, y * CAPTURE_PIXEL_SIZE - virtualHalfHeight
|
||||||
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
||||||
GameSetCameraPos(x, y)
|
captureScreenshot(x, y, rx, ry)
|
||||||
wait(CAPTURE_DELAY - 1)
|
|
||||||
UiHide = true
|
|
||||||
wait(1)
|
|
||||||
if not TriggerCapture(rx, ry) then
|
|
||||||
UiCaptureProblem = "Screen capture failed. Please restart Noita."
|
|
||||||
end
|
|
||||||
UiHide = false
|
|
||||||
end
|
end
|
||||||
x, y = x - CAPTURE_GRID_SIZE, y
|
x, y = x - CAPTURE_GRID_SIZE, y
|
||||||
end
|
end
|
||||||
-- -y
|
-- -y
|
||||||
for i = 1, i, 1 do
|
for i = 1, i, 1 do
|
||||||
local rx, ry = x * CAPTURE_PIXEL_SIZE, y * CAPTURE_PIXEL_SIZE
|
local rx, ry = x * CAPTURE_PIXEL_SIZE - virtualHalfWidth, y * CAPTURE_PIXEL_SIZE - virtualHalfHeight
|
||||||
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
||||||
GameSetCameraPos(x, y)
|
captureScreenshot(x, y, rx, ry)
|
||||||
wait(CAPTURE_DELAY - 1)
|
|
||||||
UiHide = true
|
|
||||||
wait(1)
|
|
||||||
if not TriggerCapture(rx, ry) then
|
|
||||||
UiCaptureProblem = "Screen capture failed. Please restart Noita."
|
|
||||||
end
|
|
||||||
UiHide = false
|
|
||||||
end
|
end
|
||||||
x, y = x, y - CAPTURE_GRID_SIZE
|
x, y = x, y - CAPTURE_GRID_SIZE
|
||||||
end
|
end
|
||||||
@ -113,6 +116,12 @@ end
|
|||||||
function startCapturingHilbert()
|
function startCapturingHilbert()
|
||||||
local ox, oy = GameGetCameraPos()
|
local ox, oy = GameGetCameraPos()
|
||||||
|
|
||||||
|
local virtualWidth, virtualHeight =
|
||||||
|
tonumber(MagicNumbersGetValue("VIRTUAL_RESOLUTION_X")),
|
||||||
|
tonumber(MagicNumbersGetValue("VIRTUAL_RESOLUTION_Y"))
|
||||||
|
|
||||||
|
local virtualHalfWidth, virtualHalfHeight = math.floor(virtualWidth / 2), math.floor(virtualHeight / 2)
|
||||||
|
|
||||||
-- Get size of the rectangle in grid/chunk coordinates
|
-- Get size of the rectangle in grid/chunk coordinates
|
||||||
local gridLeft = math.floor(CAPTURE_LEFT / CAPTURE_GRID_SIZE)
|
local gridLeft = math.floor(CAPTURE_LEFT / CAPTURE_GRID_SIZE)
|
||||||
local gridTop = math.floor(CAPTURE_TOP / CAPTURE_GRID_SIZE)
|
local gridTop = math.floor(CAPTURE_TOP / CAPTURE_GRID_SIZE)
|
||||||
@ -143,23 +152,9 @@ function startCapturingHilbert()
|
|||||||
local hx, hy = mapHilbert(t, gridPOTSize)
|
local hx, hy = mapHilbert(t, gridPOTSize)
|
||||||
if hx < gridWidth and hy < gridHeight then
|
if hx < gridWidth and hy < gridHeight then
|
||||||
local x, y = (hx + gridLeft) * CAPTURE_GRID_SIZE, (hy + gridTop) * CAPTURE_GRID_SIZE
|
local x, y = (hx + gridLeft) * CAPTURE_GRID_SIZE, (hy + gridTop) * CAPTURE_GRID_SIZE
|
||||||
local rx, ry = x * CAPTURE_PIXEL_SIZE, y * CAPTURE_PIXEL_SIZE
|
local rx, ry = x * CAPTURE_PIXEL_SIZE - virtualHalfWidth, y * CAPTURE_PIXEL_SIZE - virtualHalfHeight
|
||||||
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
if not fileExists(string.format("mods/noita-mapcap/output/%d,%d.png", rx, ry)) then
|
||||||
GameSetCameraPos(x, y)
|
captureScreenshot(x, y, rx, ry)
|
||||||
|
|
||||||
-- "Larger than grid jump" delay
|
|
||||||
if math.abs(x - ox) > CAPTURE_GRID_SIZE or math.abs(y - oy) > CAPTURE_GRID_SIZE then
|
|
||||||
wait(CAPTURE_BIGJUMP_DELAY)
|
|
||||||
end
|
|
||||||
ox, oy = x, y
|
|
||||||
|
|
||||||
wait(CAPTURE_DELAY - 1)
|
|
||||||
UiHide = true -- Hide UI while capturing the screenshot
|
|
||||||
wait(1)
|
|
||||||
if not TriggerCapture(rx, ry) then
|
|
||||||
UiCaptureProblem = "Screen capture failed. Please restart Noita."
|
|
||||||
end
|
|
||||||
UiHide = false
|
|
||||||
end
|
end
|
||||||
UiProgress.Progress = UiProgress.Progress + 1
|
UiProgress.Progress = UiProgress.Progress + 1
|
||||||
end
|
end
|
||||||
|
@ -7,5 +7,13 @@
|
|||||||
DEBUG_PAUSE_GRID_UPDATE="1"
|
DEBUG_PAUSE_GRID_UPDATE="1"
|
||||||
DEBUG_PAUSE_BOX2D="1"
|
DEBUG_PAUSE_BOX2D="1"
|
||||||
DEBUG_DISABLE_POSTFX_DITHERING="1"
|
DEBUG_DISABLE_POSTFX_DITHERING="1"
|
||||||
DEBUG_NO_PAUSE_ON_WINDOW_FOCUS_LOST="1">
|
DEBUG_NO_PAUSE_ON_WINDOW_FOCUS_LOST="1"
|
||||||
|
UI_IMPORTANT_MESSAGE_POS_Y="2000"
|
||||||
|
UI_STAT_BAR_ICON_OFFSET_Y="2000"
|
||||||
|
UI_STAT_BAR_TEXT_OFFSET_X="2000"
|
||||||
|
UI_STAT_BAR_TEXT_OFFSET_Y="2000"
|
||||||
|
UI_QUICKBAR_OFFSET_X="2000"
|
||||||
|
UI_QUICKBAR_OFFSET_Y="2000"
|
||||||
|
UI_BARS_POS_X="2000"
|
||||||
|
UI_BARS_POS_Y="2000">
|
||||||
</MagicNumbers>
|
</MagicNumbers>
|
||||||
|
Loading…
Reference in New Issue
Block a user