Skip to content

Commit

Permalink
Mars 1.50 (#205)
Browse files Browse the repository at this point in the history
Fix: Do not show tactical icons when in close view state
Fix: Localization typos
Refactor: New graphics and graphics logic for Dyson swarms.
Balance: Reduce needed swarm sats to 30K.
  • Loading branch information
gkapulis authored Oct 11, 2024
1 parent 57acaf2 commit 61a4138
Show file tree
Hide file tree
Showing 25 changed files with 144 additions and 63 deletions.
45 changes: 16 additions & 29 deletions Ship_Game/Universe/SolarBodies/DysonSwarm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Ship_Game.Universe.SolarBodies
public class DysonSwarm
{
const int TotalSwarmControllers = 50;
const int BaseRequiredSwarmSats = 50_000;
const int BaseRequiredSwarmSats = 30_000;
public const int BaseSwarmProductionBoost = 100;
public const string DysonSwarmLauncherTemplate = "DysonSwarmLauncher";
public const string DysonSwarmControllerName = "Dyson Swarm Controller";
Expand Down Expand Up @@ -111,7 +111,7 @@ void AddControllerPositions(int numPerRing, int distance)
CurrentOverclock += (desiredOverclock - CurrentOverclock).Clamped(-1, 1);
float completionLimit = ControllerCompletion.UpperBound(SwarmCompletion);
CurrentOverclock = CurrentOverclock.UpperBound((int)(completionLimit * MaxOverclock));
if (NeedDysonRingsChange)
if (DysonSwarmRings.Count == 0)
LoadDysonRings();
}

Expand Down Expand Up @@ -142,48 +142,35 @@ public void DeploySwarmSat()

void LoadDysonRings()
{
int neededRings = (int)(SwarmCompletion * 100) / 10;
lock (DysonSwarmRings)
{
float startRotation = DysonSwarmRings.Count > 0 ? DysonSwarmRings[0].Sprite.Rotation : -1;
DysonSwarmRings.Clear();
if (neededRings == 0)
return;

Array<SunLayerState> frontLayers = [];
for (int i = 0; i < neededRings; i++)
var dysonRings = DysonRings.GetDysonRings(SwarmType);
for (int i = 0; i < dysonRings.Rings.Count; i++)
{
if (i % 2 == 0)
{
int index = SwarmType == 1 ? 0 : 2;
DysonSwarmRings.Add(new SunLayerState(ResourceManager.RootContent, DysonRings.Rings[index], startRotation + i * 0.15f));
}
else
{
int index = SwarmType == 1 ? 1 : 3;
frontLayers.Add(new SunLayerState(ResourceManager.RootContent, DysonRings.Rings[index], startRotation + (i - 1) * 0.15f));
}
DysonSwarmRings.Add(new SunLayerState(ResourceManager.RootContent, dysonRings.Rings[i], -1));
}

DysonSwarmRings.AddRange(frontLayers);
}
}

public void DrawDysonRings(SpriteBatch batch, Vector2 pos, float sizeScaleOnScreen)
public void DrawDysonRings(SpriteBatch batch, Vector2 pos, float sizeScaleOnScreen, bool drawBackRings = false)
{
if (DysonSwarmRings.Count == 0)
return;

float alphaRange = ((int)UnivScreenState.PlanetView - (int)UnivScreenState.ShipView);
float alpha = (float)((Owner.Universe.CamPos.Z - (double)(UnivScreenState.ShipView)) / alphaRange);
alpha = alpha.Clamped(0, 1);
if (alpha == 0)
float zoomAlpha = (float)((Owner.Universe.CamPos.Z - (double)(UnivScreenState.ShipView)) / alphaRange);
zoomAlpha = zoomAlpha.Clamped(0, 1);
if (zoomAlpha == 0)
return;

for (int i = 0; i < DysonSwarmRings.Count; i++)
for (int i = 0; i < (drawBackRings ? (DysonRings.NumBacktRings*2)-1 : DysonSwarmRings.Count); i++)
{
SunLayerState ring = DysonSwarmRings[i];
ring.Draw(batch, pos, sizeScaleOnScreen, alpha);
float alpha = DysonRings.GetRingAlpha(i, SwarmCompletion);
if (alpha > 0)
{
SunLayerState ring = DysonSwarmRings[i];
ring.Draw(batch, pos, sizeScaleOnScreen, alpha.UpperBound(zoomAlpha));
}
}
}

Expand Down
20 changes: 18 additions & 2 deletions Ship_Game/Universe/SolarBodies/SunType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ public void DrawSunMesh(SolarSystem sys, in Matrix view, in Matrix projection)
SpriteBatch batch = GameBase.ScreenManager.SpriteBatch;
batch.SafeEnd();
{
sys.DysonSwarm?.DrawDysonRings(batch, pos, sizeScaleOnScreen, drawBackRings: true);
foreach (SunLayerState layer in sys.SunLayers)
layer.Draw(batch, pos, sizeScaleOnScreen);

sys.DysonSwarm?.DrawDysonRings(batch, pos, sizeScaleOnScreen);
}
batch.SafeBegin();
Expand Down Expand Up @@ -292,12 +294,26 @@ public void DrawLoRes(SpriteBatch batch, SubTexture icon, Vector2 screenPos, flo
[StarDataType]
public class DysonRings
{
[StarData] public static Array<SunLayerInfo> Rings { get; private set; }
// Hardcoded 8 rings. 4 back, 4 front
[StarData] public Array<SunLayerInfo> Rings { get; private set; }
[StarData] public byte Type { get; private set; }
public static int NumBacktRings = 4;

static readonly Map<byte, DysonRings> Map = new();
public static void LoadDysonRings()
{
FileInfo file = ResourceManager.GetModOrVanillaFile("DysonRings.yaml");
Rings = YamlParser.DeserializeArray<SunLayerInfo>(file);
Array<DysonRings> all = YamlParser.DeserializeArray<DysonRings>(file);
foreach (DysonRings dysonRing in all)
Map[dysonRing.Type] = dysonRing;
}

public static DysonRings GetDysonRings(byte type) => Map[type];

public static float GetRingAlpha(int ringIndex, float completion)
{
int ringNum = ringIndex <= 3 ? ringIndex: ringIndex-4;
return ((completion - 0.25f*ringNum) * 4).Clamped(0,1);
}
}
}
7 changes: 3 additions & 4 deletions Ship_Game/Universe/UniverseScreen/UniverseScreen.Draw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ void DrawShipsAndProjectiles(SpriteBatch batch)
{
if (!ship.IsLaunching)
{
if (!IsCinematicModeEnabled)
if ((viewState > UnivScreenState.PlanetView || ShowingFTLOverlay) && !IsCinematicModeEnabled)
DrawTacticalIcon(ship);

DrawOverlay(ship);
Expand Down Expand Up @@ -822,9 +822,8 @@ void DrawOverlay(Ship ship)

void DrawTacticalIcon(Ship ship)
{
if (!LookingAtPlanet && (!ship.IsPlatform && !ship.IsSubspaceProjector ||
((ShowingFTLOverlay || viewState != UnivScreenState.GalaxyView) &&
(!ShowingFTLOverlay || ship.IsSubspaceProjector))))
if (!LookingAtPlanet && (!ship.IsSubspaceProjector || ShowingFTLOverlay))

{
ship.DrawTacticalIcon(this, viewState);
}
Expand Down
127 changes: 103 additions & 24 deletions game/Content/DysonRings.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,104 @@
## Note - This layer structure is currently hard coded. Dont change the structure, but TexturePaths can be changed.
- Layer:
TexturePath: Suns/Type1DysonSwarmRingBack2048.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Layer:
TexturePath: Suns/Type1DysonSwarmRingFront2048.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Layer:
TexturePath: Suns/Type2DysonSwarmRingBack2048.png
BlendMode: Additive
RotationSpeed: -0.005
PulsePeriod: 5.0
LayerScale: 0.15
- Layer:
TexturePath: Suns/Type2DysonSwarmRingFront2048.png
BlendMode: AlphaBlend
RotationSpeed: -0.005
PulsePeriod: 5.0
LayerScale: 0.15
- DysonSwarm:
Type: 1
Rings:
- Ring:
TexturePath: Suns/Type1DysonSwarmBack1.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type1DysonSwarmBack2.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type1DysonSwarmBack3.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type1DysonSwarmBack4.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type1DysonSwarmFront1.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type1DysonSwarmFront2.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type1DysonSwarmFront3.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type1DysonSwarmFront4.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- DysonSwarm:
Type: 2
Rings:
- Ring:
TexturePath: Suns/Type2DysonSwarmBack1.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type2DysonSwarmBack2.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type2DysonSwarmBack3.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type2DysonSwarmBack4.png
BlendMode: Additive
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type2DysonSwarmFront1.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type2DysonSwarmFront2.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type2DysonSwarmFront3.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15
- Ring:
TexturePath: Suns/Type2DysonSwarmFront4.png
BlendMode: AlphaBlend
RotationSpeed: -0.001
PulsePeriod: 5.0
LayerScale: 0.15

8 changes: 4 additions & 4 deletions game/Content/GameText.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8227,7 +8227,7 @@ RepairDroneLauncher:
UKR: "Модуль ремонтних дронів"
ThisModuleLaunchesRepairDrones:
Id: 2101
ENG: "This module launches repair drones equipped with nano-repair modules. These drones will automatically target and heal nearby vessels, but they WONT heal ship that lanuched them. When their nanite supply is exhausted, the drones will deactivate. It is recommended to pair these modules with ordnance fabricators."
ENG: "This module launches repair drones equipped with nano-repair modules. These drones will automatically target and heal nearby vessels, but they WONT heal ship that launched them. When their nanite supply is exhausted, the drones will deactivate. It is recommended to pair these modules with ordnance fabricators."
RUS: "Этот модель выпускает в пространство специальные зонды, оснащенные ремонтными наномодулями. Эти зонды будут автоматически искать поврежденные корабли и ремонтировать их. После выработки ресурса зонды будут деактивированы. Рекомендуется использовать их в паре с изготовителями боеприпасов."
SPA: "Este módulo lanza drones de reparación equipados con módulos de nanorreparación. Estos drones tratarán de reparar automáticamente las naves cercanas. Cuando sus reservas de nanobots se agotan, los drones se desactivan. Se recomienda dotar estos módulos con fabricadores de munición."
UKR: "Цей модуль запускає ремонтні дрони, оснащені наноремонтними модулями. Ці дрони автоматично націлюватимуться на сусідні судна і ремонтуватимуть їх, але вони НЕ будуть ремонтувати кораблі, які їх висадили. Коли запас нанітів вичерпається, дрони деактивуються. Рекомендується використовувати ці модулі в парі з виробниками боєприпасів."
Expand Down Expand Up @@ -13231,7 +13231,7 @@ TraitCompensationName:
UKR: "План компенсації екіпажу"
TraitCompensationDesc:
Id: 4969
ENG: "Your empire will compansate the families of battle casualties at a rate of 1 credit per 20 slots of ships killed by enemies."
ENG: "Your empire will compensate the families of battle casualties at a rate of 1 credit per 20 slots of ships killed by enemies."
UKR: "Ваша імперія виплатить компенсацію сім'ям загиблих у бою з розрахунку 1 кредит за 20 слотів кораблів, вбитих ворогами."
TraitTerranHomeworldName:
Id: 4970
Expand Down Expand Up @@ -17823,7 +17823,7 @@ RapidFirePDTech:
UKR: "Швидка зентіна гармата"
RapidFirePDTechdescr:
Id: 17558
ENG: "Rapid Fire Point deference was designed to counter fast moving maneuverable missiles that are usually fired in salvos. Those turrets exchange fast reloads over damage thus making them less effective against torpedoes."
ENG: "Rapid Fire Point Defense was designed to counter fast moving maneuverable missiles that are usually fired in salvos. Those turrets exchange fast reloads over damage thus making them less effective against torpedoes."
UKR: "Точка швидкого вогню була розроблена для протидії швидким маневреним ракетам, які зазвичай випускаються залпами. Ці башти швидко перезаряджаються через пошкодження, що робить їх менш ефективними проти торпед."
HeavyPDTech:
Id: 17559
Expand Down Expand Up @@ -17935,7 +17935,7 @@ CoreExtracttech:
UKR: "Сифонізація ядра"
CoreExtracttechdesc:
Id: 17587
ENG: "By taping into the planets core we are able to extract huge amounts precious and rare elements, minerals and metals, unfortunately afterwards they need to go over a complex refinement process that creates heavy pollution"
ENG: "By tapping into the planets core we are able to extract huge amounts precious and rare elements, minerals and metals, unfortunately afterwards they need to go over a complex refinement process that creates heavy pollution"
UKR: "Проникаючи в ядро планет, ми можемо видобувати величезну кількість дорогоцінних і рідкісних елементів, мінералів і металів, але, на жаль, після цього вони повинні пройти складний процес очищення, який створює сильне забруднення навколишнього середовища."
CoreExtract:
Id: 17588
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.

0 comments on commit 61a4138

Please sign in to comment.