reduce embed layer to values actually used ingame
This commit is contained in:
parent
9c8c1ccd0c
commit
37d404e77d
2 changed files with 20 additions and 2 deletions
2
main.lua
2
main.lua
|
@ -142,7 +142,7 @@ local nn_x, nn_tx, nn_ty, nn_y, nn_z
|
|||
local function make_network(input_size)
|
||||
nn_x = nn.Input({input_size})
|
||||
nn_tx = nn.Input({gcfg.tile_count})
|
||||
nn_ty = nn_tx:feed(nn.Embed(256, 2))
|
||||
nn_ty = nn_tx:feed(nn.Embed(#game.valid_tiles, 2))
|
||||
nn_y = nn.Merge()
|
||||
nn_x:feed(nn_y)
|
||||
nn_ty:feed(nn_y)
|
||||
|
|
20
smb.lua
20
smb.lua
|
@ -11,6 +11,22 @@ local R = memory.readbyteunsigned
|
|||
local W = memory.writebyte
|
||||
local function S(addr) return util.signbyte(R(addr)) end
|
||||
|
||||
local valid_tiles = {
|
||||
0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
|
||||
0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x51, 0x52, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61,
|
||||
0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
|
||||
0x6B, 0x6C, 0x89, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4,
|
||||
0xC5
|
||||
}
|
||||
|
||||
local tile_lut = {}
|
||||
for i, v in ipairs(valid_tiles) do
|
||||
tile_lut[v] = i - 1
|
||||
end
|
||||
|
||||
local rotation_offsets = { -- FIXME: not all of these are pixel-perfect.
|
||||
0, -40, -- 0x00
|
||||
6, -38,
|
||||
|
@ -91,7 +107,7 @@ local function mark_sprite(x, y, t)
|
|||
end
|
||||
|
||||
local function mark_tile(x, y, t)
|
||||
tile_input[#tile_input+1] = t
|
||||
tile_input[#tile_input+1] = tile_lut[t]
|
||||
if t == 0 then return end
|
||||
if overlay then
|
||||
gui.box(x-8, y-8, x+8, y+8)
|
||||
|
@ -270,6 +286,8 @@ W=W,
|
|||
S=S,
|
||||
overlay=overlay,
|
||||
|
||||
valid_tiles=valid_tiles,
|
||||
|
||||
sprite_input=sprite_input,
|
||||
tile_input=tile_input,
|
||||
extra_input=extra_input,
|
||||
|
|
Loading…
Reference in a new issue