Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
innominata committed Aug 30, 2021
1 parent d26553c commit eea9f15
Show file tree
Hide file tree
Showing 40 changed files with 29,426 additions and 1,118 deletions.
901 changes: 454 additions & 447 deletions GalacticScale2/DSP_Plugins.GalacticScale.csproj

Large diffs are not rendered by default.

42 changes: 28 additions & 14 deletions GalacticScale2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

After a looooong time ... here it is. Galactic Scale 2.0 Beta! Thanks everyone for your patience!

What Galactic Scale 2.0 is: A Framework for creating generator plugins that can completely customize everything to do with galaxy/planet generation in Dyson Sphere Program, with two different generators built in.
What Galactic Scale 2.0 is: A Framework for creating generator plugins that can completely customize everything to do
with galaxy/planet generation in Dyson Sphere Program, with two different generators built in.

What can be customized?

Expand All @@ -28,19 +29,27 @@ And so much more that I've forgotten. Documentation will be coming soon!
/!\ READ THIS

# Discord for Galactic Scale's team work
https://discord.gg/NbpBn6gM6d --> It will not replace the modding discord community. But at least it will be easier to talk about the mod and ask me directly questions :)

#Patch notes & releases :
You can find all the releases and the patch notes here : http://customizing.space/release or https://github.com/Touhma/DSP_Plugins/releases
https://discord.gg/NbpBn6gM6d --> It will not replace the modding discord community. But at least it will be easier to
talk about the mod and ask me directly questions :)

# Patch notes & releases :

You can find all the releases and the patch notes here : http://customizing.space/release
or https://github.com/Touhma/DSP_Plugins/releases

# Bug report :

#Bug report :
Go on the discord or post a ticket here :
https://github.com/Touhma/DSP_Plugins/issues

## Disclaimer
This mod is pretty much incompatible with anything touching on any part of the generation : we will not support any compatibility before the release.

A beta release means you may encounter: bugs , broken saves etc ... it's EXPERIMENTAL Please report any issues on the discord!
This mod is pretty much incompatible with anything touching on any part of the generation : we will not support any
compatibility before the release.

A beta release means you may encounter: bugs , broken saves etc ... it's EXPERIMENTAL Please report any issues on the
discord!

We need feedback, bug reports, and ideas. Plus we are always looking for dev help!.

Expand All @@ -51,16 +60,17 @@ Have fun with it and good testing !
First Install Bepinex in your game
folder : https://bepinex.github.io/bepinex_docs/master/articles/user_guide/installation/index.html?tabs=tabid-win

Then Download the latest release of the mod : http://customizing.space/release or https://github.com/Touhma/DSP_Plugins/releases
Then Download the latest release of the mod : http://customizing.space/release
or https://github.com/Touhma/DSP_Plugins/releases

Add it in bepinex plugins folder in your game : %gamefolder%\Dyson Sphere Program\BepInEx\plugins

Launch the game and you should be all set !

## How to use galactic-scale ?

All settings are in the in game settings menu
There are 2 generators in the beta release:
All settings are in the in game settings menu There are 2 generators in the beta release:

- Sol: An accurate rendition of our solar system and neighboring stars.
- GalacticScale: Customize everything!

Expand All @@ -70,16 +80,20 @@ Additional generators can be created by the community! Documentation on this fea

We spent a lot of time working on that mod so please ... don't be a thiefy mcThieferson.

If you have some features or ideas that would need our code to work, talk to the main dev first ( Innominata#0454 ) on Discord about it. GS2 is very expandable, and you can probably do it easily with a generator or other plugin.
If you have some features or ideas that would need our code to work, talk to the main dev first ( Innominata#0454 ) on
Discord about it. GS2 is very expandable, and you can probably do it easily with a generator or other plugin.

If you wanna fix something, please go ahead and do a pull request, we'll happily credit you for your work.

Do NOT make a mod just to change the default configuration or a few parameters, create your own generator instead :) if it's good it can make it to the official release of the mod.
Do NOT make a mod just to change the default configuration or a few parameters, create your own generator instead :) if
it's good it can make it to the official release of the mod.

We would love that mod to be a framework for community created plugins concerning everything around the generation of the moons, planets, stars, etc
We would love that mod to be a framework for community created plugins concerning everything around the generation of
the moons, planets, stars, etc

This mod is and will always be free of charge for everyone.

We'll see in the future if people wanna give us a pint of beer if they wanna support us, but again : it will stay open & free of charge for everyone.
We'll see in the future if people wanna give us a pint of beer if they wanna support us, but again : it will stay open &
free of charge for everyone.

If you wanna reuse some piece of code : make your own work free of charge & open source too.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override fsResult TrySerialize(object instance, out fsData serialized, Ty
// note: IList[index] is **significantly** faster than Array.Get, so
// make sure we use that instead.

IList arr = (Array) instance;
IList arr = (Array)instance;
var elementType = storageType.GetElementType();

var result = fsResult.Success;
Expand Down Expand Up @@ -107,7 +107,7 @@ public override bool RequestInheritanceSupport(Type storageType)

public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType)
{
var asArray = (Array) instance;
var asArray = (Array)instance;
IList asIList = asArray;

var elementType = storageType.GetElementType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ public override fsResult TrySerialize(object instance, out fsData serialized, Ty
{
if (instance is DateTime)
{
var dateTime = (DateTime) instance;
var dateTime = (DateTime)instance;
serialized = new fsData(dateTime.ToString(DateTimeFormatString));
return fsResult.Success;
}

if (instance is DateTimeOffset)
{
var dateTimeOffset = (DateTimeOffset) instance;
var dateTimeOffset = (DateTimeOffset)instance;
serialized = new fsData(dateTimeOffset.ToString(DateTimeOffsetFormatString));
return fsResult.Success;
}

if (instance is TimeSpan)
{
var timeSpan = (TimeSpan) instance;
var timeSpan = (TimeSpan)instance;
serialized = new fsData(timeSpan.ToString());
return fsResult.Success;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ The MIT License (MIT)

Copyright (c) 2014 Jacob Dufault

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27,819 changes: 27,818 additions & 1 deletion GalacticScale2/Scripts/Assets/galaxy.json

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions GalacticScale2/Scripts/Bootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class GS2
// [BepInDependency("nebula.api", BepInDependency.DependencyFlags.HardDependency)]
public class Bootstrap : BaseUnityPlugin
{
public const string VERSION = "2.1.10.0";
public const string VERSION = "2.1.13.0";

public new static ManualLogSource Logger;

Expand Down Expand Up @@ -88,13 +88,19 @@ internal void Awake()
Harmony.CreateAndPatchAll(typeof(PatchOnUIStarmap));
Harmony.CreateAndPatchAll(typeof(PatchOnUIStarmapPlanet));
Harmony.CreateAndPatchAll(typeof(PatchOnUITutorialTip));
Harmony.CreateAndPatchAll(typeof(PatchOnUIVeinDetail));
Harmony.CreateAndPatchAll(typeof(PatchOnUIVersionText));
Harmony.CreateAndPatchAll(typeof(PatchOnUIVirtualStarmap));
Harmony.CreateAndPatchAll(typeof(PatchOnUniverseGen));
Harmony.CreateAndPatchAll(typeof(PatchOnVFPreload));
}

private void FixedUpdate()
{
// if (VFInput.alt)
// {
// if (GameMain.localPlanet != null && GameMain.mainPlayer != null) GS2.Warn((GameMain.localPlanet.uPosition - GameMain.mainPlayer.uPosition).magnitude + " distance");
// }
if (GS2.Config.Dev && VFInput.control && VFInput.shift && VFInput._rotate)
{
if (!GameMain.isPaused && !DSPGame.IsMenuDemo)
Expand All @@ -103,11 +109,14 @@ private void FixedUpdate()
GameMain.Pause();
UIRoot.instance.uiGame.escMenu._Open();
}
GameMain.Pause();
else if (!GameMain.isPaused)
{
GameMain.Pause();

}
UIRoot.instance.OpenOptionWindow();
GS2.Warn($"********* Loading {GS2.Config.ImportFilename}");
GS2.Config.LoadJsonGalaxy(GS2.Config.ImportFilename);

}

timer++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public static void CreateStarPlanetsAstroPoses(Random random)
Error($"Could not find Binary Companion:{star.BinaryCompanion}");
continue;
}
Log($"Moving Companion Star {star.BinaryCompanion} who has offset {binary.position}");
// Log($"Moving Companion Star {star.BinaryCompanion} who has offset {binary.position}");
// GS2.Warn("Setting Binary Star Position");
galaxy.stars[binary.assignedIndex].position = binary.position = star.position + binary.position;
galaxy.stars[binary.assignedIndex].uPosition = galaxy.stars[binary.assignedIndex].position * 2400000.0;
GS2.Log($"Host ({star.Name})Position:{star.position} . Companion ({binary.Name}) Position {binary.position }");
// GS2.Log($"Host ({star.Name})Position:{star.position} . Companion ({binary.Name}) Position {binary.position }");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,30 @@ public static GalaxyData ProcessGalaxy(GameDesc desc, bool sketchOnly = false)
PatchOnUIGalaxySelect.StartButton?.SetActive(true);
if (!GSSettings.Instance.imported && sketchOnly)
{
//Warn("Start");
Warn("Start");
GSSettings.Reset(gameDesc.galaxySeed);


// GS2.LogJson(gameDesc);
// GS2.Warn(gameDesc.resourceMultiplier.ToString());
// GS2.Warn(GSSettings.Instance.galaxyParams.resourceMulti.ToString());
Log("Seed From gameDesc = " + GSSettings.Seed);
gsPlanets.Clear();
gsStars.Clear();

//Warn("Cleared");
Log("Loading Data from Generator : " + ActiveGenerator.Name);
ActiveGenerator.Generate(gameDesc.starCount);
GSSettings.Instance.galaxyParams.resourceMulti = gameDesc.resourceMultiplier;
GSSettings.Instance.generatorGUID = ActiveGenerator.GUID;
Log("Final Seed = " + GSSettings.Seed);
//Log("End");
}
else
{
Log("Settings Loaded From Save File");
gameDesc.resourceMultiplier = GSSettings.Instance.galaxyParams.resourceMulti;
GS2.Log($"RM1:{gameDesc.resourceMultiplier}");
Warn(gameDesc.resourceMultiplier.ToString());
}
Log($"Galaxy Loaded: {highStopwatch.duration:F5}");highStopwatch.Begin();
Log(
Expand Down Expand Up @@ -123,6 +130,8 @@ public static GalaxyData ProcessGalaxy(GameDesc desc, bool sketchOnly = false)
// GS2.Warn($"Theme used:{planet.GsTheme.Name}");
// }
// }
Warn("RM:"+GSSettings.Instance.galaxyParams.resourceMulti);
Warn($"GUID:{GSSettings.Instance.generatorGUID}");
return galaxy;
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ private void SetPlanetOrbitPhase()
if (pCount == 0) continue;
var basePhase = r.NextFloat() * 360;
planets[0].OrbitPhase = basePhase;
for (var i = 1; i < pCount; i++) planets[i].OrbitPhase = planets[i - 1].OrbitPhase + 360f / pCount;
for (var i = 1; i < pCount; i++)
{
planets[i].OrbitPhase = planets[i - 1].OrbitPhase + 360f / pCount;
planets[i].OrbitLongitude = planets[0].OrbitLongitude;
planets[i].OrbitInclination = planets[0].OrbitInclination;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private void FudgeNumbersForPlanets(GSStar star)
// GS2.Warn("Setting Crazy Inclination for " + star.Name);
body.OrbitInclination = random.NextFloat(20f, 85f);
}
body.rareChance = preferences.GetFloat($"{GetTypeLetterFromStar(star)}rareChance", 0f);
body.rareChance = preferences.GetFloat($"{GetTypeLetterFromStar(star)}rareChance", 0f)/100f;

// Force inclinations for testing
// body.OrbitInclination = 0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ private void InitPreferences()
preferences.Set("birthPlanetUnlock", false);
preferences.Set("birthPlanetSiTi", false);
preferences.Set("birthTidalLock", false);
preferences.Set("birthPlanetStar", 7);
preferences.Set("limitPlanetSize20", false);
preferences.Set("limitPlanetSize50", false);
preferences.Set("limitPlanetSize100", false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace GalacticScale.Generators
Expand Down Expand Up @@ -66,9 +67,11 @@ public static void SetupBaseThemes()
foreach (var s in smolLibrary)
if (!newLibrary.ContainsKey(s.Key)) newLibrary.Add(s.Key, s.Value);
else newLibrary[s.Key] = s.Value;
newLibrary.AddRange(GS2.externalThemes);
// GS2.WarnJson(GS2.externalThemes.Select(o=>o.Key).ToList());
// newLibrary.AddRange(GS2.externalThemes);
GS2.ThemeLibrary = GSSettings.ThemeLibrary = newLibrary;

// GS2.Warn("End of Themes.CS, ThemeLibrary Contents:");
// GS2.WarnJson(GSSettings.ThemeLibrary.Select(o=>o.Key).ToList());
}

public static void InitThemes()
Expand Down
5 changes: 5 additions & 0 deletions GalacticScale2/Scripts/GalacticScale2.0/IO/Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static void LoadExternalThemes(string path)
{
// GS2.Log($"Loading External Themes from: {path}");
ThemeLibrary tl = new ThemeLibrary();
availableExternalThemes.Clear();
if (!Directory.Exists(path))
{
GS2.Warn("External Theme Directory Not Found. Creating");
Expand Down Expand Up @@ -53,6 +54,8 @@ public static void LoadExternalThemes(string path)
public static ThemeLibrary LoadDirectoryJsonThemes(string path)
{
var tl = new ThemeLibrary();
// GS2.Log("Loading directory themes and created a new themelibrary with the following contents:");
// LogJson(tl.Select(o=>o.Key).ToList());
var directories = Directory.GetDirectories(path);
var files = Directory.GetFiles(path);
foreach (var directory in directories)
Expand Down Expand Up @@ -104,13 +107,15 @@ public static bool LoadSettingsFromJson(string path)
GSSettings.Stars.Clear();
// Log("Initializing ThemeLibrary");
GSSettings.ThemeLibrary = ThemeLibrary.Vanilla();
GSSettings.GalaxyParams = new GSGalaxyParams();
// Log("Reading JSON");
var json = File.ReadAllText(path);
var result = GSSettings.Instance;
// Log("Parsing JSON");
var data = fsJsonParser.Parse(json);
// Log("Trying To Deserialize JSON");
serializer.TryDeserialize(data, ref result);
// LogJson(result.galaxyParams);
// Log("End");
return true;
}
Expand Down
Loading

0 comments on commit eea9f15

Please sign in to comment.