diff --git a/retro/data/stable/NHL942on2-Genesis/PenguinsVsWhalers.2PCoop.state b/retro/data/stable/NHL942on2-Genesis/PenguinsVsWhalers.2PCoop.state new file mode 100644 index 00000000..0d67f5aa Binary files /dev/null and b/retro/data/stable/NHL942on2-Genesis/PenguinsVsWhalers.2PCoop.state differ diff --git a/retro/data/stable/NHL942on2-Genesis/PenguinsVsWhalers.state b/retro/data/stable/NHL942on2-Genesis/PenguinsVsWhalers.state new file mode 100644 index 00000000..f5a220c3 Binary files /dev/null and b/retro/data/stable/NHL942on2-Genesis/PenguinsVsWhalers.state differ diff --git a/retro/data/stable/NHL942on2-Genesis/data.json b/retro/data/stable/NHL942on2-Genesis/data.json new file mode 100644 index 00000000..a8f811dc --- /dev/null +++ b/retro/data/stable/NHL942on2-Genesis/data.json @@ -0,0 +1,148 @@ +{ + "info": { + "fullstar_x": { + "address": 16760700, + "type": ">i2" + }, + "fullstar_y": { + "address": 16760702, + "type": ">i2" + }, + "g1_x": { + "address": 16756938, + "type": ">i2" + }, + "g1_y": { + "address": 16756958, + "type": ">i2" + }, + "g2_x": { + "address": 16757706, + "type": ">i2" + }, + "g2_y": { + "address": 16757726, + "type": ">i2" + }, + "p1_2_x": { + "address": 16756938, + "type": ">i2" + }, + "p1_2_y": { + "address": 16756958, + "type": ">i2" + }, + "p1_attackzone": { + "address": 16762582, + "type": ">u4" + }, + "p1_bodychecks": { + "address": 16762590, + "type": ">u2" + }, + "p1_faceoffwon": { + "address": 16762588, + "type": ">u2" + }, + "p1_onetimer": { + "address": 16763432, + "type": ">u4" + }, + "p1_passing": { + "address": 16762594, + "type": ">u2" + }, + "p1_score": { + "address": 16762586, + "type": ">u2" + }, + "p1_shots": { + "address": 16762572, + "type": ">u4" + }, + "p1_x": { + "address": 16756810, + "type": ">i2" + }, + "p1_y": { + "address": 16756830, + "type": ">i2" + }, + "p2_attackzone": { + "address": 16763450, + "type": ">u4" + }, + "p2_bodychecks": { + "address": 16763458, + "type": ">u2" + }, + "p2_faceoffwon": { + "address": 16763454, + "type": ">u2" + }, + "p2_fullstar_x": { + "address": 16760244, + "type": ">i2" + }, + "p2_fullstar_y": { + "address": 16760702, + "type": ">i2" + }, + "p2_onetimer": { + "address": 16764300, + "type": ">u4" + }, + "p2_passing": { + "address": 16763462, + "type": ">u2" + }, + "p2_score": { + "address": 16763454, + "type": ">u2" + }, + "p2_shots": { + "address": 16763440, + "type": ">u4" + }, + "p2_x": { + "address": 16757578, + "type": ">i2" + }, + "p2_y": { + "address": 16757598, + "type": ">i2" + }, + "period": { + "address": 16761958, + "type": ">u2" + }, + "puck_vel_x": { + "address": 16758642, + "type": "|i1" + }, + "puck_vel_y": { + "address": 16758644, + "type": "|i1" + }, + "puck_x": { + "address": 16758630, + "type": ">i2" + }, + "puck_y": { + "address": 16758634, + "type": ">i2" + }, + "rpuck_x": { + "address": 16758602, + "type": ">i2" + }, + "rpuck_y": { + "address": 16758622, + "type": ">i2" + }, + "time": { + "address": 16761958, + "type": ">u4" + } + } +} diff --git a/retro/data/stable/NHL942on2-Genesis/metadata.json b/retro/data/stable/NHL942on2-Genesis/metadata.json new file mode 100644 index 00000000..fc5041e6 --- /dev/null +++ b/retro/data/stable/NHL942on2-Genesis/metadata.json @@ -0,0 +1,3 @@ +{ + "default_state": "PenguinsVsWhalers" +} diff --git a/retro/data/stable/NHL942on2-Genesis/rom.sha b/retro/data/stable/NHL942on2-Genesis/rom.sha new file mode 100644 index 00000000..790ea6ac --- /dev/null +++ b/retro/data/stable/NHL942on2-Genesis/rom.sha @@ -0,0 +1 @@ +3fbe26c1ee78050eafb9ded9e003de3b80c3d3dc diff --git a/retro/data/stable/NHL942on2-Genesis/scenario.json b/retro/data/stable/NHL942on2-Genesis/scenario.json new file mode 100644 index 00000000..f8016bb4 --- /dev/null +++ b/retro/data/stable/NHL942on2-Genesis/scenario.json @@ -0,0 +1,22 @@ +{ + "crop": [ + 0, + 0, + 256, + 224 + ], + "actions": [ + [[], ["UP"], ["DOWN"]], + [[], ["LEFT"], ["RIGHT"]], + [[], ["B"], ["C"]] + ], + "done": { + "script": "lua:nhl94_done" + }, + "reward": { + "script": "lua:nhl94_reward" + }, + "scripts": [ + "script.lua" + ] +} diff --git a/retro/data/stable/NHL942on2-Genesis/script.lua b/retro/data/stable/NHL942on2-Genesis/script.lua new file mode 100644 index 00000000..1779cd12 --- /dev/null +++ b/retro/data/stable/NHL942on2-Genesis/script.lua @@ -0,0 +1,91 @@ +prev_p1_score = 0 +prev_p2_score = 0 +prev_p1_faceoffwon = 0 +prev_p1_shots = 0 +prev_p2_shots = 0 +prev_p1_bodychecks = 0 +prev_p1_passing = 0 +prev_distance = 0 + + +function calc_distance( x1, y1, x2, y2 ) + return math.sqrt( (x2-x1)^2 + (y2-y1)^2 ) +end + +function nhl94_reward () + local p1_score_reward = (data.p1_score - prev_p1_score) * 1 + local p2_score_reward = (data.p2_score - prev_p2_score) * -1 + local p1_faceoffwon_reward = (data.p1_faceoffwon - prev_p1_faceoffwon) * 1 + local p1_bodychecks_reward = (data.p1_bodychecks - prev_p1_bodychecks) * 1 + local p2_shots_reward = (data.p2_shots - prev_p2_shots) * -1 + local p1_bodychecks_reward = (data.p1_passing - prev_p1_passing) * 1 + + local p1_shots_reward = 0 + if data.p1_y >= 150 then + p1_shots_reward = (data.p1_shots - prev_p1_shots) * 1 + else + p1_shots_reward = (data.p1_shots - prev_p1_shots) * -1 + end + + prev_p1_score = data.p1_score + prev_p2_score = data.p2_score + prev_p1_faceoffwon = data.p1_faceoffwon + prev_p1_shots = data.p1_shots + prev_p2_shots = data.p2_shots + prev_p1_bodychecks = data.p1_bodychecks + prev_p1_passing = data.p1_passing + + local puck_reward = 0 + if data.puck_y <= -5 then + puck_reward = -0.5 + else + puck_reward = 0.5 + end + + --local diff_x = math.abs(data.p1_x - data.puck_x) + --local diff_y = math.abs(data.p1_y - data.puck_y) + + distance = calc_distance(data.puck_x, data.puck_y, data.p1_x, data.p1_y) + + --local diff_x = 0 + --local diff_y = 0 + + local diff_reward = 0 + if distance < prev_distance then + diff_reward = 0 + else + diff_reward = -1 + if distance < 30 then + diff_reward = 0 + end + end + + if distance < 30 then + diff_reward = 0.1 + end + + + prev_distance = distance + + + --return p1_score_reward + p2_score_reward + p1_shots_reward + p1_faceoffwon_reward + p1_bodychecks_reward + --return p1_score_reward + p1_shots_reward + puck_reward + p1_bodychecks_reward + p1_faceoffwon_reward + p2_score_reward + --return p1_score_reward + p1_shots_reward + p1_bodychecks_reward + p1_faceoffwon_reward + p2_score_reward + p2_shots_reward + return diff_reward + p2_score_reward +end + +function nhl94_done() + + --distance = calc_distance(data.puck_x, data.puck_y, data.p1_x, data.p1_y) + + --if distance > 300 then + -- return true + --end + + + if data.time == 10 then + return true + end + + return false +end diff --git a/retro/data/stable/NHL942on2-Genesis/test.lua b/retro/data/stable/NHL942on2-Genesis/test.lua new file mode 100644 index 00000000..c94e371b --- /dev/null +++ b/retro/data/stable/NHL942on2-Genesis/test.lua @@ -0,0 +1,3 @@ +function test_reward() + return 1 +end