Skip to content

Commit d616222

Browse files
authored
Merge pull request #132 from cortex-command-community/fog-of-war
Fog of War and Activity Settings Fixes
2 parents 40864dc + efd61b6 commit d616222

32 files changed

+650
-221
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3030

3131
- Conquest activities will once again fall-back to using base dropships and rockets if a random selection of the selected tech's craft can't find one capable of carrying passengers and/or cargo.
3232

33-
- ALl music-related functionality from AudioMan has been removed due to the addition of the MusicMan. Generic DynamicSongs have been put in to use instead.
33+
- All music-related functionality from AudioMan has been removed due to the addition of the MusicMan. Generic DynamicSongs have been put in to use instead.
3434
Mod activities that used to queue up all the vanilla music should now instead call, for example, `MusicMan:PlayDynamicSong("Generic Battle Music")`
3535

36+
- Increased fog of war resolution in all vanilla activities, and conquest, from 20x20 to 4x4.
37+
The Ronin Scrambler, the basic scanner, and `SceneMan:CastUnseenRay` have been changed to accomodate fog of war resolutions as fine as 1x1 and as course as 20x20.
38+
39+
- All vanilla scenario activities have had their settings polished, respecting settings which make sense and disabling settings which don't.
40+
You can now have fog of war in the test scene, and can no longer require path to orbit in Zero-G Diggers-Only One Man Army.
41+
42+
- The Signal Hunt activity no longer has a preview image, as it was not formatted correctly and spoiled the interior structure of the cave.
43+
3644
</details>
3745

3846
<details><summary><b>Fixed</b></summary>
@@ -43,6 +51,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4351

4452
- Fixed a bug in Decision Day that could cause an error when trying to set the camera's scroll target, in addition to the previous issue.
4553

54+
- Fixed a bug in Harvester and Massacre where setting deploy units would auto-assign units of the wrong tech.
55+
4656
</details>
4757

4858
## [Release v6.2.2] - 2024/02/24

Data/Base.rte/Activities.ini

Lines changed: 106 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
///////////////////////////////////////////////////////////////////////
22
// List of Activities or "Game Modes"
3+
//
4+
// Standard format as far as user switches is to define defaults in the order that they can be read in the GUI from left to right and top to bottom.
5+
// Switch enabled state follows in the same order.
36

47

58
AddActivity = GATutorial
@@ -11,6 +14,12 @@ AddActivity = GATutorial
1114
Team1Funds = 1500
1215
CPUTeam = 1
1316
MaxPlayerSupport = 1
17+
DefaultRequireClearPathToOrbit = 1
18+
DefaultFogOfWar = 0
19+
DefaultDeployUnits = 1
20+
RequireClearPathToOrbitSwitchEnabled = 0
21+
FogOfWarSwitchEnabled = 0
22+
DeployUnitsSwitchEnabled = 0
1423

1524

1625
AddActivity = GAScripted
@@ -25,8 +34,11 @@ AddActivity = GAScripted
2534
MinTeamsRequired = 2
2635
LuaClassName = SkirmishDefense
2736
DefaultRequireClearPathToOrbit = 1
28-
DeployUnitsSwitchEnabled = 1
37+
DefaultFogOfWar = 1
2938
DefaultDeployUnits = 0
39+
RequireClearPathToOrbitSwitchEnabled = 1
40+
FogOfWarSwitchEnabled = 1
41+
DeployUnitsSwitchEnabled = 1
3042

3143

3244
AddActivity = GAScripted
@@ -40,6 +52,11 @@ AddActivity = GAScripted
4052
Team2Name = Green Team
4153
MinTeamsRequired = 2
4254
DefaultRequireClearPathToOrbit = 1
55+
DefaultFogOfWar = 1
56+
DefaultDeployUnits = 0
57+
RequireClearPathToOrbitSwitchEnabled = 1
58+
FogOfWarSwitchEnabled = 1
59+
DeployUnitsSwitchEnabled = 1
4360
4461
4562
AddActivity = GAScripted
@@ -63,8 +80,11 @@ AddActivity = GAScripted
6380
Team1Name = Attackers
6481
Team2Name = Defenders
6582
DefaultRequireClearPathToOrbit = 1
66-
DeployUnitsSwitchEnabled = 1
83+
DefaultFogOfWar = 1
6784
DefaultDeployUnits = 1
85+
RequireClearPathToOrbitSwitchEnabled = 1
86+
FogOfWarSwitchEnabled = 1
87+
DeployUnitsSwitchEnabled = 1
6888
6989
7090
AddActivity = GAScripted
@@ -83,22 +103,29 @@ AddActivity = GAScripted
83103
DefaultGoldHardDifficulty = 3000
84104
DefaultGoldNutsDifficulty = 2000
85105
DefaultGoldMaxDifficulty = 350
86-
DefaultDeployUnits = 1
106+
DefaultRequireClearPathToOrbit = 1
87107
DefaultFogOfWar = 1
88-
DeployUnitsSwitchEnabled = 0
108+
DefaultDeployUnits = 0
109+
RequireClearPathToOrbitSwitchEnabled = 1
110+
FogOfWarSwitchEnabled = 1
111+
DeployUnitsSwitchEnabled = 1
89112
90113
91114
AddActivity = GAScripted
92115
PresetName = Survival
93116
Description = Build a base, then survive until the time is up!
94117
SceneName = Ketanot Hills
95118
ScriptPath = Base.rte/Activities/Survival.lua
96-
TeamOfPlayer1 = 0
97-
CPUTeam = 1
119+
TeamOfPlayer1 = 1
120+
CPUTeam = 0
98121
LuaClassName = Survival
99122
DefaultRequireClearPathToOrbit = 1
100-
DeployUnitsSwitchEnabled = 1
123+
DefaultFogOfWar = 1
101124
DefaultDeployUnits = 0
125+
GoldSwitchEnabled = 1
126+
RequireClearPathToOrbitSwitchEnabled = 1
127+
FogOfWarSwitchEnabled = 1
128+
DeployUnitsSwitchEnabled = 1
102129
103130
104131
AddActivity = GAScripted
@@ -109,8 +136,19 @@ AddActivity = GAScripted
109136
TeamOfPlayer1 = 0
110137
CPUTeam = 1
111138
LuaClassName = OneManArmy
112-
DeployUnitsSwitchEnabled = 1
139+
DefaultGoldCakeDifficulty = 0
140+
DefaultGoldEasyDifficulty = 0
141+
DefaultGoldMediumDifficulty = 0
142+
DefaultGoldHardDifficulty = 0
143+
DefaultGoldNutsDifficulty = 0
144+
DefaultGoldMaxDifficulty = 0
145+
DefaultRequireClearPathToOrbit = 0
146+
DefaultFogOfWar = 1
113147
DefaultDeployUnits = 0
148+
GoldSwitchEnabled = 0
149+
RequireClearPathToOrbitSwitchEnabled = 0
150+
FogOfWarSwitchEnabled = 1
151+
DeployUnitsSwitchEnabled = 1
114152
115153
116154
AddActivity = GAScripted
@@ -121,8 +159,20 @@ AddActivity = GAScripted
121159
TeamOfPlayer1 = 0
122160
CPUTeam = 1
123161
LuaClassName = OneManArmy
124-
DeployUnitsSwitchEnabled = 1
162+
DefaultGoldCakeDifficulty = 0
163+
DefaultGoldEasyDifficulty = 0
164+
DefaultGoldMediumDifficulty = 0
165+
DefaultGoldHardDifficulty = 0
166+
DefaultGoldNutsDifficulty = 0
167+
DefaultGoldMaxDifficulty = 0
125168
DefaultDeployUnits = 0
169+
DefaultFogOfWar = 1
170+
DefaultRequireClearPathToOrbit = 0
171+
GoldSwitchEnabled = 0
172+
RequireClearPathToOrbitSwitchEnabled = 0
173+
FogOfWarSwitchEnabled = 1
174+
DeployUnitsSwitchEnabled = 1
175+
126176
127177
128178
AddActivity = GAScripted
@@ -134,10 +184,21 @@ AddActivity = GAScripted
134184
CPUTeam = 1
135185
LuaClassName = OneManArmyZeroG
136186
SceneName = Zero-G Battle
137-
DeployUnitsSwitchEnabled = 1
187+
DefaultGoldCakeDifficulty = 0
188+
DefaultGoldEasyDifficulty = 0
189+
DefaultGoldMediumDifficulty = 0
190+
DefaultGoldHardDifficulty = 0
191+
DefaultGoldNutsDifficulty = 0
192+
DefaultGoldMaxDifficulty = 0
193+
DefaultRequireClearPathToOrbit = 0
194+
DefaultFogOfWar = 0
138195
DefaultDeployUnits = 0
196+
GoldSwitchEnabled = 0
197+
RequireClearPathToOrbitSwitchEnabled = 0
198+
FogOfWarSwitchEnabled = 0
199+
DeployUnitsSwitchEnabled = 0
139200
140-
201+
// Path to orbit guaranteed by currently being in orbit.
141202
AddActivity = GAScripted
142203
PresetName = One-Man Army (Diggers, 0-G)
143204
Description = Survive with only one unit and no backups in a Zero-G void! The enemy will only use diggers, but the harder the difficulty the less potent weaponry you start out with, and the longer you have to survive.
@@ -147,34 +208,51 @@ AddActivity = GAScripted
147208
CPUTeam = 1
148209
LuaClassName = OneManArmyZeroG
149210
SceneName = Zero-G Battle
150-
DeployUnitsSwitchEnabled = 1
211+
DefaultGoldCakeDifficulty = 0
212+
DefaultGoldEasyDifficulty = 0
213+
DefaultGoldMediumDifficulty = 0
214+
DefaultGoldHardDifficulty = 0
215+
DefaultGoldNutsDifficulty = 0
216+
DefaultGoldMaxDifficulty = 0
217+
DefaultRequireClearPathToOrbit = 0
218+
DefaultFogOfWar = 0
151219
DefaultDeployUnits = 0
220+
GoldSwitchEnabled = 0
221+
RequireClearPathToOrbitSwitchEnabled = 0
222+
FogOfWarSwitchEnabled = 0
223+
DeployUnitsSwitchEnabled = 0
152224
153225
154226
AddActivity = GAScripted
155227
PresetName = Massacre
156228
Description = Build a base, then kill all the enemies!
157229
SceneName = Ketanot Hills
158230
ScriptPath = Base.rte/Activities/Massacre.lua
159-
TeamOfPlayer1 = 0
160-
CPUTeam = 1
231+
TeamOfPlayer1 = 1
232+
CPUTeam = 0
161233
LuaClassName = Massacre
162234
DefaultRequireClearPathToOrbit = 1
163-
DeployUnitsSwitchEnabled = 1
235+
DefaultFogOfWar = 1
164236
DefaultDeployUnits = 0
237+
RequireClearPathToOrbitSwitchEnabled = 1
238+
FogOfWarSwitchEnabled = 1
239+
DeployUnitsSwitchEnabled = 1
165240
166241
167242
AddActivity = GAScripted
168243
PresetName = Harvester
169244
Description = Build a base, then dig up as much gold as you can!
170245
SceneName = Ketanot Hills
171246
ScriptPath = Base.rte/Activities/Harvester.lua
172-
TeamOfPlayer1 = 0
173-
CPUTeam = 1
247+
TeamOfPlayer1 = 1
248+
CPUTeam = 0
174249
LuaClassName = Harvester
175250
DefaultRequireClearPathToOrbit = 1
176-
DeployUnitsSwitchEnabled = 1
251+
DefaultFogOfWar = 1
177252
DefaultDeployUnits = 0
253+
RequireClearPathToOrbitSwitchEnabled = 1
254+
FogOfWarSwitchEnabled = 1
255+
DeployUnitsSwitchEnabled = 1
178256
179257
180258
AddActivity = GAScripted
@@ -186,8 +264,12 @@ AddActivity = GAScripted
186264
CPUTeam = 1
187265
MaxPlayerSupport = 1
188266
LuaClassName = KeepieUppie
189-
DeployUnitsSwitchEnabled = 1
267+
DefaultRequireClearPathToOrbit = 0
268+
DefaultFogOfWar = 1
190269
DefaultDeployUnits = 0
270+
RequireClearPathToOrbitSwitchEnabled = 0
271+
FogOfWarSwitchEnabled = 1
272+
DeployUnitsSwitchEnabled = 1
191273
192274
193275
///////////////////////////////////////////////////////////////////////
@@ -203,10 +285,14 @@ AddActivity = GAScripted
203285
TeamOfPlayer4 = 0
204286
MinTeamsRequired = 1
205287
Team1Funds = 100000
206-
DeployUnitsSwitchEnabled = 1
207288
ScriptPath = Base.rte/Activities/Test.lua
208289
LuaClassName = Test
290+
DefaultRequireClearPathToOrbit = 0
291+
DefaultFogOfWar = 0
209292
DefaultDeployUnits = 0
293+
RequireClearPathToOrbitSwitchEnabled = 1
294+
FogOfWarSwitchEnabled = 1
295+
DeployUnitsSwitchEnabled = 1
210296
211297
212298
/*

Data/Base.rte/Activities/BrainVsBrain.lua

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,18 @@ function BrainvsBrain:StartNewGame()
9999
local RedAreaString = "Red Build Area Center";
100100
local GreenAreaString = "Green Build Area Center";
101101
if SceneMan.Scene:HasArea(RedAreaString) and SceneMan.Scene:HasArea(GreenAreaString) then
102-
local fogWidth = 20;
102+
local fogResolution = 4;
103103

104-
SceneMan:MakeAllUnseen(Vector(fogWidth, fogWidth), Activity.TEAM_1);
105-
SceneMan:MakeAllUnseen(Vector(fogWidth, fogWidth), Activity.TEAM_2);
104+
SceneMan:MakeAllUnseen(Vector(fogResolution, fogResolution), Activity.TEAM_1);
105+
SceneMan:MakeAllUnseen(Vector(fogResolution, fogResolution), Activity.TEAM_2);
106106

107107
-- Reveal the build areas
108108
local RedCenter = SceneMan.Scene:GetArea(RedAreaString):GetCenterPoint();
109109
local GreenCenter = SceneMan.Scene:GetArea(GreenAreaString):GetCenterPoint();
110110
local range = SceneMan:ShortestDistance(RedCenter, GreenCenter, false).Magnitude * 0.45;
111-
112-
for y = fogWidth/2, SceneMan.SceneHeight, fogWidth do
113-
for x = fogWidth/2, SceneMan.SceneWidth, fogWidth do
114-
if SceneMan:ShortestDistance(RedCenter, Vector(x, y), false).Largest < range then
115-
SceneMan:RevealUnseen(x, y, Activity.TEAM_1);
116-
elseif SceneMan:ShortestDistance(GreenCenter, Vector(x, y), false).Largest < range then
117-
SceneMan:RevealUnseen(x, y, Activity.TEAM_2);
118-
end
119-
end
120-
end
111+
112+
SceneMan:RevealUnseenBox(RedCenter.X - range, RedCenter.Y - range, range * 2, range * 2, Activity.TEAM_1);
113+
SceneMan:RevealUnseenBox(GreenCenter.X - range, GreenCenter.Y - range, range * 2, range * 2, Activity.TEAM_2);
121114
end
122115
else
123116
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
@@ -340,16 +333,26 @@ function BrainvsBrain:UpdateActivity()
340333

341334
-- Add fog
342335
if self:GetFogOfWarEnabled() then
343-
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
344-
if self:PlayerActive(player) and self:PlayerHuman(player) then
345-
SceneMan:MakeAllUnseen(Vector(32, 32), self:GetTeamOfPlayer(player));
336+
local fogResolution = 4;
337+
SceneMan:MakeAllUnseen(Vector(fogResolution, fogResolution), Activity.TEAM_1);
338+
SceneMan:MakeAllUnseen(Vector(fogResolution, fogResolution), Activity.TEAM_2);
339+
340+
-- Reveal outside areas for everyone.
341+
for x = 0, SceneMan.SceneWidth - 1, fogResolution do
342+
local altitude = Vector(0, 0);
343+
SceneMan:CastTerrainPenetrationRay(Vector(x, 0), Vector(0, SceneMan.Scene.Height), altitude, 50, 0);
344+
if altitude.Y > 1 then
345+
SceneMan:RevealUnseenBox(x - 10, 0, fogResolution + 20, altitude.Y + 10, Activity.TEAM_1);
346+
SceneMan:RevealUnseenBox(x - 10, 0, fogResolution + 20, altitude.Y + 10, Activity.TEAM_2);
346347
end
347348
end
348349

349350
-- Lift the fog around friendly actors
350351
for Act in MovableMan.AddedActors do
351-
for ang = 0, math.pi*2, 0.1 do
352-
SceneMan:CastSeeRay(Act.Team, Act.EyePos, Vector(130+FrameMan.PlayerScreenWidth*0.5, 0):RadRotate(ang), Vector(), 1, 4);
352+
if not IsADoor(Act) then
353+
for angle = 0, math.pi * 2, 0.05 do
354+
SceneMan:CastSeeRay(Act.Team, Act.EyePos, Vector(150+FrameMan.PlayerScreenWidth * 0.5, 0):RadRotate(angle), Vector(), 25, fogResolution);
355+
end
353356
end
354357
end
355358
else -- Lift any fog covering the build areas

Data/Base.rte/Activities/BunkerBreach.lua

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,18 @@ end
194194

195195
function BunkerBreach:SetupFogOfWar()
196196
if self:GetFogOfWarEnabled() then
197-
SceneMan:MakeAllUnseen(Vector(20, 20), self.attackerTeam);
198-
SceneMan:MakeAllUnseen(Vector(20, 20), self.defenderTeam);
197+
local fogResolution = 4;
198+
SceneMan:MakeAllUnseen(Vector(fogResolution, fogResolution), self.attackerTeam);
199+
SceneMan:MakeAllUnseen(Vector(fogResolution, fogResolution), self.defenderTeam);
199200

200201
-- Reveal outside areas for the attacker.
201-
for x = 0, SceneMan.SceneWidth - 1, 20 do
202-
SceneMan:CastSeeRay(self.attackerTeam, Vector(x, 0), Vector(0, SceneMan.SceneHeight), Vector(), 1, 9);
202+
for x = 0, SceneMan.SceneWidth - 1, fogResolution do
203+
local altitude = Vector(0, 0);
204+
SceneMan:CastTerrainPenetrationRay(Vector(x, 0), Vector(0, SceneMan.Scene.Height), altitude, 50, 0);
205+
if altitude.Y > 1 then
206+
SceneMan:RevealUnseenBox(x - 10, 0, fogResolution + 20, altitude.Y + 10, self.attackerTeam);
207+
SceneMan:RevealUnseenBox(x - 10, 0, fogResolution + 20, altitude.Y + 10, self.defenderTeam);
208+
end
203209
end
204210

205211
-- Reveal the main bunker area for the defender.
@@ -208,9 +214,11 @@ function BunkerBreach:SetupFogOfWar()
208214
end
209215

210216
-- Reveal a circle around actors, so they're not standing in the dark.
211-
for actor in MovableMan.AddedActors do
212-
for angle = 0, math.pi * 2, 0.05 do
213-
SceneMan:CastSeeRay(actor.Team, actor.EyePos, Vector(150 + FrameMan.PlayerScreenWidth * 0.5, 0):RadRotate(angle), Vector(), 1, 4);
217+
for Act in MovableMan.AddedActors do
218+
if not IsADoor(Act) then
219+
for angle = 0, math.pi * 2, 0.05 do
220+
SceneMan:CastSeeRay(Act.Team, Act.EyePos, Vector(150+FrameMan.PlayerScreenWidth * 0.5, 0):RadRotate(angle), Vector(), 25, fogResolution);
221+
end
214222
end
215223
end
216224
end

0 commit comments

Comments
 (0)