aboutsummaryrefslogtreecommitdiffstats
path: root/data/maps.lua
blob: d49d9e617eb23beed205fb67e52dd8dfac348df3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
-- Selectable scenarios. The engine loads every entry of the global `Maps` array
-- and the Dev panel ("Map" section) switches between them at runtime; switching
-- tears the world down and rebuilds it from the chosen entry. Maps[1] is the
-- one the game starts on.
--
-- Each map is self-contained:
--   name, description   shown in the Dev panel
--   ground_level        height of the ground plane. Terrain is still a flat
--                       half-plane, so this moves the ground up/down but cannot
--                       change its SHAPE (real terrain is M6).
--   deposits            { {x, y}, ... }  mines only produce while on one
--   devices             { {type=, x=, y=, team=}, ... }  team 0 = player
--   weapons             { {type=, x=, y=}, ... }  the player's starting guns
--   structures          { {name=, beams={ {x1,y1,x2,y2,material}, ... }}, ... }
--
-- Building rules the beams must respect (see data/materials.lua):
--   * a beam should be <= 3 units (wood/armour/bg-brace max_length); prebuilt
--     beams are welded raw and are NOT auto-subdivided
--   * TRIANGULATE. An un-triangulated strut snaps once it rotates ~30 degrees,
--     so every bay wants a diagonal or the fort folds up on the first hit
--   * an endpoint at y == ground_level becomes a pinned foundation; keep other
--     nodes clear of the ground+0.3 band so they don't pin by accident

Maps = Maps or {}

-- 1. Open ground, a wide firing lane, and a boxy enemy fort with an armour face
--    turned towards you. The balanced default.
table.insert(Maps, {
    name = "Proving Ground",
    description = "Open lane, boxy enemy fort with an armoured front.",
    ground_level = 1.0,
    deposits = { {-24, 1}, {-11, 1}, {23, 1}, {31, 1} },
    devices = {
        { type = "reactor", x = -22, y = 2.0, team = 0 },
        { type = "reactor", x =  27, y = 3.0, team = 1 },
    },
    weapons = {
        { type = "cannon", x = -18, y = 2.6 },
        { type = "laser",  x = -14, y = 2.6 },
    },
    structures = {
        {
            name = "player deck",   -- gun platform; gives recoil something to shove
            beams = {
                {-20,1,-20,2,"wood"}, {-18,1,-18,2,"wood"}, {-16,1,-16,2,"wood"},
                {-14,1,-14,2,"wood"}, {-12,1,-12,2,"wood"},
                {-20,2,-18,2,"wood"}, {-18,2,-16,2,"wood"},
                {-16,2,-14,2,"wood"}, {-14,2,-12,2,"wood"},
                {-20,1,-18,2,"wood"}, {-18,1,-16,2,"wood"},
                {-16,1,-14,2,"wood"}, {-14,1,-12,2,"wood"},
            },
        },
        {
            name = "enemy fort",
            beams = {
                -- front column facing the player is armour, the rest is wood
                {25,1,25,3,"armour"}, {25,3,25,5,"armour"},
                {27,1,27,3,"wood"},   {27,3,27,5,"wood"},
                {29,1,29,3,"wood"},   {29,3,29,5,"wood"},
                {25,1,27,1,"wood"}, {27,1,29,1,"wood"},
                {25,3,27,3,"wood"}, {27,3,29,3,"wood"},
                {25,5,27,5,"wood"}, {27,5,29,5,"wood"},
                {25,1,27,3,"wood"}, {27,1,29,3,"wood"},
                {25,3,27,5,"wood"}, {27,3,29,5,"wood"},
            },
        },
    },
})

-- 2. A tall armoured tower braced internally with background bracing: shells
--    pass straight through the bracing, so you have to chew the armour or burn
--    the bracing out from under it. Vertical fight.
table.insert(Maps, {
    name = "Iron Bastion",
    description = "A two-storey gun emplacement against a walled keep: armoured "
               .. "outer wall, a bridge back to the tower, bg-brace interior.",
    ground_level = 1.0,
    deposits = { {-28, 1}, {-13, 1}, {19, 1}, {34, 1} },
    devices = {
        { type = "reactor", x = -26, y = 2.0, team = 0 },
        { type = "reactor", x =  28, y = 3.0, team = 1 },
    },
    weapons = {
        { type = "cannon", x = -21, y = 5.6 },   -- upper deck
        { type = "laser",  x = -17, y = 3.6 },   -- lower deck
    },
    structures = {
        {
            name = "player emplacement",
            beams = {
                -- lower storey; armour on the RIGHT column, the face the enemy
                -- actually shoots at
                {-24,1,-24,3,"wood"}, {-22,1,-22,3,"wood"}, {-20,1,-20,3,"wood"},
                {-18,1,-18,3,"wood"}, {-16,1,-16,3,"armour"},
                {-24,3,-22,3,"wood"}, {-22,3,-20,3,"wood"},
                {-20,3,-18,3,"wood"}, {-18,3,-16,3,"wood"},
                {-24,1,-22,3,"wood"}, {-22,1,-20,3,"wood"},
                {-20,1,-18,3,"wood"}, {-18,1,-16,3,"wood"},
                -- upper storey over the middle bays
                {-22,3,-22,5,"wood"}, {-20,3,-20,5,"wood"}, {-18,3,-18,5,"wood"},
                {-22,5,-20,5,"wood"}, {-20,5,-18,5,"wood"},
                {-22,3,-20,5,"wood"}, {-20,3,-18,5,"wood"},
            },
        },
        {
            name = "outer wall",   -- fully armoured, soaks the first volleys
            beams = {
                {22,1,22,3,"armour"}, {22,3,22,5,"armour"},
                {24,1,24,3,"armour"}, {24,3,24,5,"armour"},
                {22,1,24,1,"wood"}, {22,3,24,3,"wood"}, {22,5,24,5,"wood"},
                {22,1,24,3,"wood"}, {22,3,24,5,"wood"},
            },
        },
        {
            name = "curtain bridge",   -- cut this and the wall fights alone
            beams = {
                {24,3,26,3,"wood"}, {24,5,26,5,"wood"}, {24,3,26,5,"wood"},
            },
        },
        {
            name = "the keep",
            beams = {
                -- armoured outer face, full height
                {26,1,26,3,"armour"}, {26,3,26,5,"armour"},
                {26,5,26,7,"armour"}, {26,7,26,9,"armour"},
                {28,1,28,3,"wood"}, {28,3,28,5,"wood"},
                {28,5,28,7,"wood"}, {28,7,28,9,"wood"},
                {30,1,30,3,"wood"}, {30,3,30,5,"wood"},
                {30,5,30,7,"wood"}, {30,7,30,9,"wood"},
                -- floors
                {26,1,28,1,"wood"}, {28,1,30,1,"wood"},
                {26,3,28,3,"wood"}, {28,3,30,3,"wood"},
                {26,5,28,5,"wood"}, {28,5,30,5,"wood"},
                {26,7,28,7,"wood"}, {28,7,30,7,"wood"},
                {26,9,28,9,"wood"}, {28,9,30,9,"wood"},
                -- internal bracing: shells pass through it, fire eats it fast
                {26,1,28,3,"bgbrace"}, {28,1,30,3,"bgbrace"},
                {26,3,28,5,"bgbrace"}, {28,3,30,5,"bgbrace"},
                {26,5,28,7,"bgbrace"}, {28,5,30,7,"bgbrace"},
                {26,7,28,9,"bgbrace"}, {28,7,30,9,"bgbrace"},
            },
        },
    },
})

-- 3. Raised ground and forts almost in each other's faces: short flight times,
--    both sides armoured on the facing wall. A brawl rather than a siege.
table.insert(Maps, {
    name = "The Narrows",
    description = "Raised ground, two three-storey redoubts almost muzzle to "
               .. "muzzle, armour facing armour. Reactors sit inside the forts.",
    ground_level = 2.0,
    deposits = { {-18, 2}, {-4, 2}, {4, 2}, {18, 2} },
    devices = {
        { type = "reactor", x = -13, y = 3.0, team = 0 },
        { type = "reactor", x =  11, y = 3.0, team = 1 },
    },
    weapons = {
        { type = "cannon", x = -12, y = 6.6 },   -- on the roof
        { type = "laser",  x = -10, y = 6.6 },
    },
    structures = {
        {
            name = "player redoubt",   -- armour on the inward (enemy-facing) column
            beams = {
                {-14,2,-14,4,"wood"}, {-12,2,-12,4,"wood"},
                {-10,2,-10,4,"wood"}, {-8,2,-8,4,"armour"},
                {-14,4,-14,6,"wood"}, {-12,4,-12,6,"wood"},
                {-10,4,-10,6,"wood"}, {-8,4,-8,6,"armour"},
                {-14,4,-12,4,"wood"}, {-12,4,-10,4,"wood"}, {-10,4,-8,4,"wood"},
                {-14,6,-12,6,"wood"}, {-12,6,-10,6,"wood"}, {-10,6,-8,6,"wood"},
                {-14,2,-12,4,"wood"}, {-12,2,-10,4,"wood"}, {-10,2,-8,4,"wood"},
                {-14,4,-12,6,"wood"}, {-12,4,-10,6,"wood"}, {-10,4,-8,6,"wood"},
            },
        },
        {
            name = "enemy redoubt",
            beams = {
                {8,2,8,4,"armour"}, {10,2,10,4,"wood"},
                {12,2,12,4,"wood"}, {14,2,14,4,"wood"},
                {8,4,8,6,"armour"}, {10,4,10,6,"wood"},
                {12,4,12,6,"wood"}, {14,4,14,6,"wood"},
                {8,4,10,4,"wood"}, {10,4,12,4,"wood"}, {12,4,14,4,"wood"},
                {8,6,10,6,"wood"}, {10,6,12,6,"wood"}, {12,6,14,6,"wood"},
                {8,2,10,4,"wood"}, {10,2,12,4,"wood"}, {12,2,14,4,"wood"},
                {8,4,10,6,"wood"}, {10,4,12,6,"wood"}, {12,4,14,6,"wood"},
            },
        },
    },
})

function IndexOfMap(name)
    for i, m in ipairs(Maps) do if m.name == name then return i end end
    return nil
end
function FindMap(name)
    local i = IndexOfMap(name); if i then return Maps[i] end; return nil
end