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:
David Vogel 2019-11-03 00:58:03 +01:00
parent 8cf46232de
commit 12ea3f83ae
4 changed files with 105 additions and 53 deletions

View File

@ -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`.
## 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
[MIT](LICENSE)

View File

@ -3,6 +3,8 @@
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
// TODO: Fix transparent pixels at the output image border
package main
import (

View File

@ -31,11 +31,42 @@ local function resetPlayer()
setPlayerHP(CAPTURE_FORCE_HP)
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()
local ox, oy = GameGetCameraPos()
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 virtualWidth, virtualHeight =
tonumber(MagicNumbersGetValue("VIRTUAL_RESOLUTION_X")),
tonumber(MagicNumbersGetValue("VIRTUAL_RESOLUTION_Y"))
local virtualHalfWidth, virtualHalfHeight = math.floor(virtualWidth / 2), math.floor(virtualHeight / 2)
preparePlayer()
GameSetCameraFree(true)
@ -46,62 +77,34 @@ function startCapturingSpiral()
function()
-- +x
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
GameSetCameraPos(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
captureScreenshot(x, y, rx, ry)
end
x, y = x + CAPTURE_GRID_SIZE, y
end
-- +y
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
GameSetCameraPos(x, y)
wait(CAPTURE_DELAY - 1)
UiHide = true
wait(1)
if not TriggerCapture(rx, ry) then
UiCaptureProblem = "Screen capture failed. Please restart Noita."
end
UiHide = false
captureScreenshot(x, y, rx, ry)
end
x, y = x, y + CAPTURE_GRID_SIZE
end
i = i + 1
-- -x
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
GameSetCameraPos(x, y)
wait(CAPTURE_DELAY - 1)
UiHide = true
wait(1)
if not TriggerCapture(rx, ry) then
UiCaptureProblem = "Screen capture failed. Please restart Noita."
end
UiHide = false
captureScreenshot(x, y, rx, ry)
end
x, y = x - CAPTURE_GRID_SIZE, y
end
-- -y
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
GameSetCameraPos(x, y)
wait(CAPTURE_DELAY - 1)
UiHide = true
wait(1)
if not TriggerCapture(rx, ry) then
UiCaptureProblem = "Screen capture failed. Please restart Noita."
end
UiHide = false
captureScreenshot(x, y, rx, ry)
end
x, y = x, y - CAPTURE_GRID_SIZE
end
@ -113,6 +116,12 @@ end
function startCapturingHilbert()
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
local gridLeft = math.floor(CAPTURE_LEFT / CAPTURE_GRID_SIZE)
local gridTop = math.floor(CAPTURE_TOP / CAPTURE_GRID_SIZE)
@ -143,23 +152,9 @@ function startCapturingHilbert()
local hx, hy = mapHilbert(t, gridPOTSize)
if hx < gridWidth and hy < gridHeight then
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
GameSetCameraPos(x, y)
-- "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
captureScreenshot(x, y, rx, ry)
end
UiProgress.Progress = UiProgress.Progress + 1
end

View File

@ -7,5 +7,13 @@
DEBUG_PAUSE_GRID_UPDATE="1"
DEBUG_PAUSE_BOX2D="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>