diff --git a/AGENTS.md b/AGENTS.md index 8bec81e..da52f1c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,5 @@ -# Soundings +# Big Ship Tycoon -Build the native Linux player after every gameplay or visual revision and before handing the revision back. Use the Unity version in `ProjectSettings/ProjectVersion.txt` and the Linux build command in the README. The player is written to `Builds/Linux/Soundings.x86_64`. Keep generated builds out of Git. +Build the native Linux player after every gameplay or visual revision and before handing the revision back. Use the Unity version in `ProjectSettings/ProjectVersion.txt` and the Linux build command in the README. The player is written to `Builds/Linux/BigShipTycoon.x86_64`. Keep generated builds out of Git. When changing game controls or rendering, launch the native player and verify the affected flow. Use the game viewport as the primary play surface. Put detailed controls in the workspace that owns the action. diff --git a/Assets/Soundings/Editor/EconomyVerification.cs b/Assets/Soundings/Editor/EconomyVerification.cs index 06a9351..cc506fe 100644 --- a/Assets/Soundings/Editor/EconomyVerification.cs +++ b/Assets/Soundings/Editor/EconomyVerification.cs @@ -16,10 +16,75 @@ namespace Soundings.Editor VerifyLiveCrossingSettlement(); VerifyConcurrentSettlement(); VerifyStormAndShipSystems(); + VerifyCrewAndLaundry(); VerifyPortOrders(); VerifyMultiStopItinerary(); VerifyShoreExcursions(); - Debug.Log("Soundings economy verification passed for both starts, pricing, fuel, enlarged venues, fleet settlements, saves, weather, ship systems, port orders, multi-stop itineraries and shore excursions."); + Debug.Log("Big Ship Tycoon economy verification passed for both starts, pricing, fuel, enlarged venues, fleet settlements, saves, weather, ship systems, crew payroll, laundry, port orders, multi-stop itineraries and shore excursions."); + } + + private static void VerifyCrewAndLaundry() + { + Company company = Company.Start(false); + Ship ship = company.ActiveShip; + Voyage baseQuote = company.Forecast(ship, 1); + int galley = ship.CrewCount(CrewRole.Galley); + int laundry = ship.CrewCount(CrewRole.Laundry); + int dailyWage = CrewMarket.Roles[(int)CrewRole.Laundry].DailyWage; + int hireFee = CrewMarket.HireFee(ship, CrewRole.Laundry); + int initialCash = company.Cash; + Require(galley > 0 && laundry > 0 && baseQuote.Crew == ship.DailyPayroll * baseQuote.Days + && company.DepartureBlock(ship, baseQuote) == null, "the starter vessel has a fully payable sailing crew"); + Require(company.ChangeCrew(ship, CrewRole.Laundry, 1, true) != null && company.Cash == initialCash, + "an underway crew role cannot be changed"); + Require(company.ChangeCrew(ship, CrewRole.Laundry, 1) == null && company.Cash == initialCash - hireFee, + "a dockside hire charges a single recruitment fee"); + Voyage upgradedQuote = company.Forecast(ship, 1); + Require(ship.CrewCount(CrewRole.Laundry) == laundry + 1 && baseQuote.CrewAssigned[(int)CrewRole.Laundry] == laundry + && upgradedQuote.Crew == baseQuote.Crew + dailyWage * upgradedQuote.Days, + "a changed roster adds daily payroll to a new quote and preserves prior voyage assignments"); + var upgraded = new OnboardSession(ship, upgradedQuote) { Assisted = false }; + int expandedLaundry = upgraded.LaundryCapacity; + int staffedMeals = upgraded.Get(OnboardService.Meals).Capacity; + upgraded.AdvanceTo(.50f); + Require(company.Cash == initialCash - hireFee && upgraded.LaundryCleaned > 0, + "operations use the booked roster and withhold payroll until settlement"); + int beforeSail = company.Cash; + Require(company.Sail(ship, 1, upgraded) == null && company.History[0].Crew == upgradedQuote.Crew + && company.Cash == beforeSail + upgradedQuote.CashChange + && company.History[0].Onboard.LaundryCleaned > 0, + "arrival records payroll and laundry results and posts the exact cash change"); + Require(company.Sail(ship, 1, upgraded) != null && company.Cash == beforeSail + upgradedQuote.CashChange, + "a completed voyage cannot debit payroll twice"); + Require(CrewMarket.HireFee(ship, CrewRole.Laundry) != hireFee, + "the same role costs a different recruitment fee at another port"); + + company = JsonUtility.FromJson(JsonUtility.ToJson(company)); + Require(company.CanLoad() && company.ActiveShip.CrewCount(CrewRole.Laundry) == laundry + 1 + && company.History[0].CrewAssigned[(int)CrewRole.Laundry] == laundry + 1 + && company.History[0].Onboard.LaundryCleaned > 0, + "staff contracts, booked manifests and laundry statistics survive a career save"); + + company = Company.Start(false); + ship = company.ActiveShip; + for (int release = 0; release < 3; release++) + { + Require(company.ChangeCrew(ship, CrewRole.Galley, -1) == null + && company.ChangeCrew(ship, CrewRole.Laundry, -1) == null, + "release service staff at port"); + } + Voyage leanQuote = company.Forecast(ship, 1); + var lean = new OnboardSession(ship, leanQuote) { Assisted = false }; + Require(lean.LaundryCapacity < expandedLaundry && lean.LaundryCapacity < lean.LaundryDemand + && lean.Get(OnboardService.Meals).Capacity < staffedMeals, + "smaller Galley and Laundry teams limit actual onboard service"); + lean.AdvanceTo(.50f); + Require(lean.LaundryBacklog > 0 && lean.CanExtendLaundry, "an undersized laundry roster builds up a linen backlog"); + int regularCapacity = lean.LaundryCapacity; + int beforeShift = lean.Expenses; + lean.ExtendLaundry(); + Require(lean.LaundryBoost && lean.LaundryCapacity > regularCapacity && lean.Expenses == beforeShift + lean.LaundryShiftCost, + "the player can authorize a paid extra laundry shift during the voyage"); } private static void VerifyShoreExcursions() diff --git a/Assets/Soundings/Editor/SoundingsBuild.cs b/Assets/Soundings/Editor/SoundingsBuild.cs index ff0801c..c3e4921 100644 --- a/Assets/Soundings/Editor/SoundingsBuild.cs +++ b/Assets/Soundings/Editor/SoundingsBuild.cs @@ -23,8 +23,8 @@ namespace Soundings.Editor EditorBuildSettings.scenes = new[] { new EditorBuildSettingsScene(ScenePath, true) }; PlayerSettings.companyName = "Soundings"; - PlayerSettings.productName = "Soundings"; - PlayerSettings.bundleVersion = "0.10.0"; + PlayerSettings.productName = "Big Ship Tycoon"; + PlayerSettings.bundleVersion = "0.11.0"; PlayerSettings.defaultScreenWidth = 1920; PlayerSettings.defaultScreenHeight = 1080; PlayerSettings.fullScreenMode = FullScreenMode.FullScreenWindow; @@ -61,8 +61,8 @@ namespace Soundings.Editor options = BuildOptions.None }); if (report.summary.result != BuildResult.Succeeded) - throw new BuildFailedException($"Soundings build failed: {report.summary.result}."); - Debug.Log($"Built Soundings for {target}: {report.summary.totalSize:N0} bytes at {output}."); + throw new BuildFailedException($"Big Ship Tycoon build failed: {report.summary.result}."); + Debug.Log($"Built Big Ship Tycoon for {target}: {report.summary.totalSize:N0} bytes at {output}."); } } } diff --git a/Assets/Soundings/Resources/Art/BigShipTycoonTitle.png b/Assets/Soundings/Resources/Art/BigShipTycoonTitle.png new file mode 100644 index 0000000..8d86d37 Binary files /dev/null and b/Assets/Soundings/Resources/Art/BigShipTycoonTitle.png differ diff --git a/Assets/Soundings/Resources/Art/BigShipTycoonTitle.png.meta b/Assets/Soundings/Resources/Art/BigShipTycoonTitle.png.meta new file mode 100644 index 0000000..5e4be09 --- /dev/null +++ b/Assets/Soundings/Resources/Art/BigShipTycoonTitle.png.meta @@ -0,0 +1,132 @@ +fileFormatVersion: 2 +guid: 7440bcd7f41a2149db9698437b36b053 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationMethod: 0 + spriteTessellationDetail: -1 + spriteGeometrySubdivision: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck.meta b/Assets/Soundings/Resources/Audio/Deck.meta new file mode 100644 index 0000000..482d2f5 --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 462d73a09a93412aaaf2d826961a9a88 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Bridge.ogg b/Assets/Soundings/Resources/Audio/Deck/Bridge.ogg new file mode 100644 index 0000000..8e8319f Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Bridge.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Bridge.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Bridge.ogg.meta new file mode 100644 index 0000000..50d6034 --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Bridge.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: b5399a2dabca451a9420ac9d016cb0bc +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Crowd.ogg b/Assets/Soundings/Resources/Audio/Deck/Crowd.ogg new file mode 100644 index 0000000..4ecf7aa Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Crowd.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Crowd.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Crowd.ogg.meta new file mode 100644 index 0000000..3232549 --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Crowd.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 389f87ac38d241e88d88c1eb4fe82b3f +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Deck.ogg b/Assets/Soundings/Resources/Audio/Deck/Deck.ogg new file mode 100644 index 0000000..276bbdb Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Deck.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Deck.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Deck.ogg.meta new file mode 100644 index 0000000..4667f38 --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Deck.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 1904d6042dfe487690d9a10ad59b14a8 +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Dining.ogg b/Assets/Soundings/Resources/Audio/Deck/Dining.ogg new file mode 100644 index 0000000..9b10683 Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Dining.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Dining.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Dining.ogg.meta new file mode 100644 index 0000000..411e0ab --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Dining.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 125654259c8d4f78959a6d9247a51954 +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Entertainment.ogg b/Assets/Soundings/Resources/Audio/Deck/Entertainment.ogg new file mode 100644 index 0000000..cfa57df Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Entertainment.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Entertainment.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Entertainment.ogg.meta new file mode 100644 index 0000000..bfb6272 --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Entertainment.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: f6a5400a8a0a46c99a161c56adf5843f +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Galley.ogg b/Assets/Soundings/Resources/Audio/Deck/Galley.ogg new file mode 100644 index 0000000..a8a2074 Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Galley.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Galley.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Galley.ogg.meta new file mode 100644 index 0000000..2eba256 --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Galley.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 7e7e1480340543c185a8d3155f0741bd +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Laundry.ogg b/Assets/Soundings/Resources/Audio/Deck/Laundry.ogg new file mode 100644 index 0000000..59481cc Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Laundry.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Laundry.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Laundry.ogg.meta new file mode 100644 index 0000000..a73abd5 --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Laundry.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: f916c99807e0462792a674fa9ce7794d +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Machinery.ogg b/Assets/Soundings/Resources/Audio/Deck/Machinery.ogg new file mode 100644 index 0000000..0a79545 Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Machinery.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Machinery.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Machinery.ogg.meta new file mode 100644 index 0000000..92f29d3 --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Machinery.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: b2d19631d885481fa19b292fcb999a46 +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Pool.ogg b/Assets/Soundings/Resources/Audio/Deck/Pool.ogg new file mode 100644 index 0000000..f12aee4 Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Pool.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Pool.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Pool.ogg.meta new file mode 100644 index 0000000..1a59c7d --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Pool.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 763d9bccdb2f49c3aee5816917965bcc +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/Audio/Deck/Retail.ogg b/Assets/Soundings/Resources/Audio/Deck/Retail.ogg new file mode 100644 index 0000000..5b2be7d Binary files /dev/null and b/Assets/Soundings/Resources/Audio/Deck/Retail.ogg differ diff --git a/Assets/Soundings/Resources/Audio/Deck/Retail.ogg.meta b/Assets/Soundings/Resources/Audio/Deck/Retail.ogg.meta new file mode 100644 index 0000000..2db5e6e --- /dev/null +++ b/Assets/Soundings/Resources/Audio/Deck/Retail.ogg.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 0e21916e6ac24b96bc97f7820c2bceef +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 24000 + compressionFormat: 1 + quality: 0.85 + conversionMode: 0 + preloadAudioData: 1 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 0 + loadInBackground: 0 + ambisonic: 0 + 3D: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Resources/CrewOffice.uss b/Assets/Soundings/Resources/CrewOffice.uss new file mode 100644 index 0000000..f6fbc56 --- /dev/null +++ b/Assets/Soundings/Resources/CrewOffice.uss @@ -0,0 +1,60 @@ +.crew-office { + position: absolute; + left: 5%; right: 5%; top: 97px; bottom: 91px; + align-items: center; +} +.crew-sheet { + width: 1050px; + max-width: 100%; + max-height: 100%; + padding: 20px 25px; + background-color: #122933; + border-width: 1px; + border-top-width: 2px; + border-color: #8e8265; + border-top-color: #d1ae6d; +} +.crew-heading { flex-direction: row; align-items: center; justify-content: space-between; } +.crew-identity { min-width: 0; flex-grow: 1; } +.crew-kicker { color: #e1c588; letter-spacing: 1px; font-size: 10px; -unity-font-style: bold; } +.crew-title { color: #f1e7cc; font-size: 44px; margin: 0 0 2px; } +.crew-ship { color: #c4d9d6; font-size: 15px; } +.crew-office-budget { flex-direction: row; margin-right: 16px; } +.crew-stat { padding: 6px 14px; margin-left: 7px; border-left-width: 1px; border-color: #496166; } +.crew-stat-value { color: #f0ddb2; font-size: 28px; } +.action.crew-fleet { margin-left: 9px; min-height: 32px; } +.crew-table { margin-top: 15px; flex-shrink: 1; } +.crew-columns, .crew-row { flex-direction: row; align-items: center; padding: 6px 10px; } +.crew-columns { background-color: #0e222d; } +.crew-row { min-height: 65px; border-bottom-width: 1px; border-color: #3d565c; background-color: #17303a; } +.crew-row:hover { background-color: #1b3740; } +.crew-department { flex-grow: 1; min-width: 0; margin-right: 10px; } +.crew-department-name { color: #f1e2c3; font-size: 21px; } +.crew-counts { width: 143px; flex-shrink: 0; } +.crew-count { color: #b4dfcc; font-size: 16px; -unity-font-style: bold; } +.crew-short { color: #f3bb86; } +.crew-wage, .crew-note, .crew-office-footer { color: #aec8c7; font-size: 12px; white-space: normal; } +.crew-row-actions { width: 200px; flex-shrink: 0; } +.crew-actions { flex-direction: row; justify-content: flex-end; } +.action.crew-hire, .action.crew-release { min-height: 31px; font-size: 12px; padding: 4px 9px; margin-left: 5px; } +.action.crew-hire { color: #f0d6a1; border-color: #9e8659; background-color: #304444; } +.action.crew-hire:hover { background-color: #46564b; } +.crew-office-footer { margin-top: 12px; } +.crew-manifest-overlay { + position: absolute; + left: 0; right: 0; top: 0; bottom: 0; + align-items: center; justify-content: center; + background-color: rgba(4, 11, 17, .67); +} +.crew-manifest { + width: 490px; max-width: 88%; + padding: 21px 25px; + background-color: #132b36; + border-width: 1px; + border-top-width: 2px; + border-color: #ac9565; +} +.crew-manifest-roster { margin: 12px 0; } +.crew-manifest-row { flex-direction: row; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom-width: 1px; border-color: #4c6061; } +.crew-manifest-role, .crew-manifest-payroll { color: #e8dfc8; font-size: 14px; } +.crew-manifest-payroll { margin: 1px 0 6px; } diff --git a/Assets/Soundings/Resources/CrewOffice.uss.meta b/Assets/Soundings/Resources/CrewOffice.uss.meta new file mode 100644 index 0000000..f19bb75 --- /dev/null +++ b/Assets/Soundings/Resources/CrewOffice.uss.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d60b7c013e37ed114a2336e6482fb100 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} + disableValidation: 0 + unsupportedSelectorAction: 0 diff --git a/Assets/Soundings/Resources/HarborSurface.shader b/Assets/Soundings/Resources/HarborSurface.shader index 3dbf090..18d6b91 100644 --- a/Assets/Soundings/Resources/HarborSurface.shader +++ b/Assets/Soundings/Resources/HarborSurface.shader @@ -9,6 +9,8 @@ Shader "Soundings/Harbor Surface" _Weather ("Weathering", Range(0,1)) = .1 _Finish ("Surface finish", Float) = 0 _Waterline ("Opaque hull at the waterline", Float) = 0 + _TileFrequency ("Tiles per meter", Float) = 0 + _FabricMotif ("Woven floor motif", Range(0,1)) = 0 } SubShader { @@ -24,8 +26,9 @@ Shader "Soundings/Harbor Surface" fixed4 _Color; float _Roughness, _Metal, _Emissive, _Weather, _Finish, _Waterline; + float _TileFrequency, _FabricMotif; float _SoundingsSeaWeather, _SoundingsSeaSailing, _SoundingsSeaTime; - struct Input { float4 vertex : POSITION; float3 normal : NORMAL; }; + struct Input { float4 vertex : POSITION; float3 normal : NORMAL; float4 basin : TEXCOORD0; }; struct Output { float4 clip : SV_POSITION; @@ -33,6 +36,7 @@ Shader "Soundings/Harbor Surface" float3 world : TEXCOORD1; float3 local : TEXCOORD2; float3 localNormal : TEXCOORD3; + float4 basin : TEXCOORD4; }; Output vert(Input input) @@ -43,6 +47,7 @@ Shader "Soundings/Harbor Surface" output.world = mul(unity_ObjectToWorld, input.vertex).xyz; output.local = input.vertex.xyz; output.localNormal = input.normal; + output.basin = input.basin; return output; } @@ -81,7 +86,9 @@ Shader "Soundings/Harbor Surface" float fibre = crossGrain * 53 + .73 * sin(p.x * 2.8 + crossGrain * 32); float grain = sin(fibre) * Detail(crossGrain * 8.4); float seams = Groove(across, .014) + Groove(p.x * .383 + frac(row * .381966), .0026); - tone = 1 + plank * .16 * Detail(across) + grain * .052 - seams * lerp(.12, .27, horizontal); + float wear = sin(p.x * 2.2 + crossGrain * 2.9) * cos(crossGrain * 8.2 - p.x * 1.9); + tone = 1 + plank * .19 * Detail(across) + grain * .055 - seams * lerp(.12, .27, horizontal) + + wear * .036 * _Weather; } else if (_Finish == 3) { @@ -89,6 +96,13 @@ Shader "Soundings/Harbor Surface" float weave = cos(p.x * 142) * cos(crossFibre * 153) * Detail(crossFibre * 24.4) * Detail(p.x * 22.6); float mottling = sin(p.x * 11 + crossFibre * 16) * sin(p.x * 23 - crossFibre * 13); tone = 1 + .037 * weave + .028 * mottling * Detail(p.x * 3.7); + if (_FabricMotif > .01) + { + float2 diamonds = float2(p.x + crossFibre, p.x - crossFibre) * 1.83; + float braid = Groove(diamonds.x, .065) * .046 + Groove(diamonds.y, .065) * .046; + float inset = Groove(diamonds.x + .5, .08) * Groove(diamonds.y + .5, .08) * .19; + tone += (braid + inset - .026) * _FabricMotif; + } } else if (_Finish == 4) { @@ -99,24 +113,58 @@ Shader "Soundings/Harbor Surface" else if (_Finish == 5) { float along = p.x + p.z * .42; + float plateRow = floor(p.y * .86); + float plateAlong = along * .23 + plateRow * .5; + float irregular = PanelShade(float2(floor(plateAlong), plateRow)) - .5; float runoff = sin(along * 9.1 + sin(along * 2.1)) * sin(along * 2.9 - .2 * p.y); - float plates = Groove(p.y * .86, .005) + Groove(along * .23 + floor(p.y * .86) * .5, .0038); + float plates = Groove(p.y * .86, .008) + Groove(plateAlong, .005); float salt = 1 - smoothstep(-.04, .82, p.y); - tone = 1 + salt * .11 + (paint * .1 + runoff * .18 * Detail(along * 1.45) - plates * .16) * _Weather; + tone = 1 + salt * .15 + + (irregular * .25 + paint * .1 + runoff * .21 * Detail(along * 1.45) - plates * .21) * _Weather; + } + if (_TileFrequency > 0) + { + float3 axis = abs(normal); + float2 face = axis.y > .57 ? p.xz : axis.x > axis.z ? p.zy : p.xy; + float2 grout = face * _TileFrequency; + float tileVariation = (PanelShade(floor(grout)) - .5) * Detail(grout.x) * Detail(grout.y); + tone *= 1 + tileVariation * .18 - max(Groove(grout.x, .036), Groove(grout.y, .036)) * .31; } return tone; } + float3 PoolColor(float3 world, float4 basin, float3 normal, float3 eye, float3 sky, float glint, float fresnel) + { + // Unmapped water is used for small fountains. Pool caps carry distance to their own basin edges. + if (basin.z < .01) + return _Color.rgb * .73 + sky * (.20 + fresnel * .42) + glint * .43; + float edge = min(basin.z - abs(basin.x), basin.w - abs(basin.y)); + float shallow = 1 - smoothstep(.015, .86, edge); + float bottomShade = lerp(.73, 1, smoothstep(-.01, .14, edge)); + float2 p = world.xz; + float time = _Time.y; + float2 wave = float2(p.x * 2.29 + p.y * 1.88, p.y * 2.63 - p.x * 1.03); + wave.x += .17 * sin(p.y * 6.3 - time * 1.7) + time * .22; + wave.y += .13 * sin(p.x * 5.04 + time * 1.52) - time * .31; + float distance = min(abs(frac(wave.x) - .5), abs(frac(wave.y) - .5)); + float feather = max(max(fwidth(wave.x), fwidth(wave.y)) * .69, .029); + float caustic = (1 - smoothstep(.021, .027 + feather, distance)) * Detail(wave.x) * Detail(wave.y); + float3 body = _Color.rgb * lerp(float3(.52,.68,.83), float3(1.14,1.39,1.37), shallow); + float3 teal = body * bottomShade + caustic * float3(.07,.15,.13) * lerp(.45, 1, shallow); + float waterFresnel = .06 + pow(1 - saturate(dot(eye, normal)), 5) * .54; + return lerp(teal, sky * 1.15, waterFresnel) + glint * float3(.57,.61,.65); + } + fixed4 frag(Output input) : SV_Target { float3 normal = normalize(input.normal); if (_Finish == 6) { - float2 p = input.local.xz; + float2 p = input.world.xz; float rippleX = p.x * 5.7 + p.y * 2.2 - _Time.y * 2.7; float rippleZ = p.y * 8.3 - p.x * 1.3 + _Time.y * 3.1; float3 ripple = float3(sin(rippleX) * Detail(p.x * .91), 0, sin(rippleZ) * Detail(p.y * 1.32)); - normal = normalize(normal + mul((float3x3)unity_ObjectToWorld, ripple) * .085); + normal = normalize(normal + ripple * .095); } float3 eye = unity_OrthoParams.w > .5 ? UNITY_MATRIX_V[2].xyz : normalize(_WorldSpaceCameraPos.xyz - input.world); @@ -131,6 +179,8 @@ Shader "Soundings/Harbor Surface" float sunsetStripe = smoothstep(-.08,.13,reflected.y) * (1 - smoothstep(.13,.42,reflected.y)); float3 skyReflection = lerp(float3(.11,.19,.27), float3(.39,.48,.60), saturate(reflected.y)) + sunsetStripe * float3(.20,.12,.061); + if (_Finish == 6) + return fixed4(saturate(PoolColor(input.world, input.basin, normal, eye, skyReflection, specular, fresnel)), 1); float overcast = _SoundingsSeaWeather * _SoundingsSeaSailing; float3 direct = lerp(float3(.58,.46,.34), float3(.20,.24,.28), overcast); float3 light = lerp(float3(.26,.34,.43), float3(.62,.69,.75), sky) + sunlight * direct; @@ -142,18 +192,19 @@ Shader "Soundings/Harbor Surface" ? OceanWave(input.world.xz, _SoundingsSeaTime, _SoundingsSeaWeather).x : 0; float aboveWater = input.world.y - level; clip(aboveWater); - diffuse *= lerp(.73, 1, smoothstep(0, .62, aboveWater)); + diffuse *= lerp(.60, 1, smoothstep(0, .64, aboveWater)); + diffuse += skyReflection * (.12 * (1 - smoothstep(.04,.67,aboveWater)) * (.26 + fresnel * .62)); } if (_Finish == 2) { float horizon = 1 - smoothstep(.005, .067 + _Roughness * .12, abs(reflected.y - .025)); - float3 glazing = skyReflection * (.30 + fresnel * .62) + float3(.21,.32,.36) * horizon * .28; + float roofReflection = smoothstep(.21, .28, reflected.y) * (1 - smoothstep(.31, .44, reflected.y)); + float3 glazing = skyReflection * (.34 + fresnel * .66) + float3(.21,.32,.36) * horizon * .37 + + float3(.18,.23,.25) * roofReflection * .12; float facing = smoothstep(-.12, .49, reflected.y); float3 glass = diffuse * (.47 + facing * .30) + glazing + specular * float3(.65,.55,.41) * .33; return fixed4(saturate(lerp(glass, diffuse + glazing * .32 + _Color.rgb * .22, _Emissive)), 1); } - if (_Finish == 6) - return fixed4(saturate(diffuse * .81 + skyReflection * (.24 + fresnel * .61) + specular * .44), 1); float3 shine = skyReflection * (.045 + fresnel * .21 + _Metal * .16) * (1 - _Roughness * .56) + specular * float3(.73,.60,.43) * (.10 + .47 * _Metal) * saturate(3 * sunlight); return fixed4(saturate(diffuse + shine + _Color.rgb * _Emissive * .53), 1); diff --git a/Assets/Soundings/Resources/Soundings.uss b/Assets/Soundings/Resources/Soundings.uss index 493e357..11440c8 100644 --- a/Assets/Soundings/Resources/Soundings.uss +++ b/Assets/Soundings/Resources/Soundings.uss @@ -69,11 +69,22 @@ Label { margin: 0; padding: 0; } .title-crest { flex-direction: row; align-items: center; } .title-kicker { margin-left: 8px; color: #d9c18e; font-size: 13px; letter-spacing: 2px; } .title-wordmark { + margin: 3px 0 24px; +} +.title-wordmark-lead, .title-wordmark-main { color: #f0e5ca; - font-size: 106px; - margin: -8px 0 26px; text-shadow: 1px 3px 8px rgba(0, 0, 0, .7); } +.title-wordmark-line { flex-direction: row; align-items: center; } +.title-wordmark-lead { font-size: 72px; } +.title-wordmark-main { font-size: 85px; margin-top: -13px; color: #f3d79b; } +.title-overpaint { position: relative; margin-left: -3px; } +.title-underpaint { color: #a49c85; } +.title-spray-letter { position: absolute; left: -7px; top: 0; width: 63px; height: 82px; } +.title-thumbnail { top: 12%; bottom: 12%; } +.title-thumbnail .title-wordmark-lead { font-size: 91px; } +.title-thumbnail .title-wordmark-main { font-size: 105px; } +.title-thumbnail .title-spray-letter { width: 76px; height: 102px; } .career-option, .title-command { padding: 12px 16px; margin-bottom: 10px; @@ -161,6 +172,7 @@ Label { margin: 0; padding: 0; } .helm-orders { position: absolute; right: 44px; bottom: 108px; align-items: flex-end; } .helm-command { min-height: 51px; min-width: 167px; padding: 5px 13px 5px 40px; font-size: 17px; } .helm-command .game-icon { position: absolute; left: 11px; top: 10px; height: 25px; width: 25px; } +.action.harbor-crew-link { margin-top: 5px; min-height: 30px; color: #eddbb5; } .harbor-empty { position: absolute; left: 44px; bottom: 108px; align-items: flex-start; } .harbor-empty .helm-command { padding-left: 13px; } .camera-legend { flex-direction: row; align-items: center; margin-top: 5px; } diff --git a/Assets/Soundings/Runtime/CareerMenus.cs b/Assets/Soundings/Runtime/CareerMenus.cs index 70cc92c..2a7accb 100644 --- a/Assets/Soundings/Runtime/CareerMenus.cs +++ b/Assets/Soundings/Runtime/CareerMenus.cs @@ -17,8 +17,11 @@ namespace Soundings private void InitializeCareers() { - string path = autoSmoke ? Path.Combine(Path.GetTempPath(), "soundings-careers-" + Guid.NewGuid().ToString("N")) - : Path.Combine(Application.persistentDataPath, "Careers"); + string profile = Application.persistentDataPath; + if (Application.platform != RuntimePlatform.WebGLPlayer && Path.GetFileName(profile) == GameTitle) + profile = Path.Combine(Path.GetDirectoryName(profile), "Soundings"); + string path = autoSmoke ? Path.Combine(Path.GetTempPath(), "big-ship-tycoon-careers-" + Guid.NewGuid().ToString("N")) + : Path.Combine(profile, "Careers"); careers = new CareerStore(path); if (autoSmoke || AdoptCareer(careers.Read(careers.RecentId), false)) return; @@ -75,7 +78,7 @@ namespace Soundings pendingStart = null; careerMenu = CareerMenu.Closed; title = !play; - page = Ship == null ? 2 : Mathf.Clamp(saved.Page, 0, 4); + page = Ship == null && saved.Page != CrewOfficePage ? 2 : Mathf.Clamp(saved.Page, 0, CrewOfficePage); deckIndex = Ship == null ? 0 : Mathf.Clamp(saved.DeckIndex, 0, Ship.Decks.Count - 1); inspectedPort = Ship?.Port ?? 0; yardSelection = 1; @@ -116,7 +119,7 @@ namespace Soundings var entry = new CareerSave { Id = newName != null || careerId == null ? Guid.NewGuid().ToString("N") : careerId, - Name = newName ?? careerName ?? "Soundings career", + Name = newName ?? careerName ?? "Big Ship Tycoon career", SavedUtc = DateTime.UtcNow.Ticks, Page = page, DeckIndex = deckIndex, diff --git a/Assets/Soundings/Runtime/Company.cs b/Assets/Soundings/Runtime/Company.cs index 62e4a7f..2c98f02 100644 --- a/Assets/Soundings/Runtime/Company.cs +++ b/Assets/Soundings/Runtime/Company.cs @@ -163,6 +163,7 @@ namespace Soundings public int SuiteGuests, SuitePremium; public string ShipName; public int ItineraryStartDay, ItineraryLeg, ItineraryLegs; + public int[] CrewAssigned; public OnboardReport Onboard; public DeparturePlan Plan; public ShoreOffer[] ShoreOffers; @@ -179,6 +180,7 @@ namespace Soundings { var copy = (Voyage)MemberwiseClone(); copy.Onboard = null; + copy.CrewAssigned = CrewAssigned is { Length: > 0 } ? (int[])CrewAssigned.Clone() : null; copy.ShoreOffers = ShorePortPlan.Copy(ShoreOffers); copy.ShoreCallId = 0; copy.ShoreReport = null; @@ -249,7 +251,7 @@ namespace Soundings return false; } - if (ship.Fuel > ship.Tank || !ValidSavedItinerary(ship) || !ship.ValidShorePlans() + if (ship.Fuel > ship.Tank || !ValidSavedItinerary(ship) || !ship.ValidShorePlans() || !ship.ValidCrew() || ship.ShoreCall is ShoreCall call && (call.CallId < 1 || call.CallId > Voyages || !callIds.Add(call.CallId) || !call.CanLoad(ship.Port))) return false; @@ -259,6 +261,7 @@ namespace Soundings foreach (Voyage voyage in History) if (voyage == null || voyage.Origin < 0 || voyage.Origin >= Permits.Length || voyage.Destination < 0 || voyage.Destination >= Permits.Length + || !CrewMarket.ValidPayroll(voyage) || voyage.ShoreCallId < 0 || voyage.ShoreCallId > Voyages || voyage.ShoreCallId > 0 && !recordedCalls.Add(voyage.ShoreCallId) || voyage.ShoreReport is ShoreReport report && (callIds.Contains(voyage.ShoreCallId) @@ -516,6 +519,7 @@ namespace Soundings (suiteGuests - grandSuiteGuests) * Market.Facilities[(int)Facility.Suite].FarePremiumPercent + grandSuiteGuests * Market.Facilities[(int)Facility.GrandSuite].FarePremiumPercent)); double unitCost = ship.Fuel > 0 ? ship.FuelValue / ship.Fuel : Market.FuelPrice(ship.Port, Day); + int[] crew = ship.CaptureCrew(); return new Voyage { @@ -536,7 +540,8 @@ namespace Soundings SuitePremium = suitePremium, TicketSales = guests * ship.Fare + suitePremium, OnboardSales = (int)Math.Round(guests * days * (13 + entertainment * 18)), - Crew = ship.Hull.CrewPerDay * days + ship.Decks.Count * 500 * days, + CrewAssigned = crew, + Crew = CrewMarket.Payroll(crew) * days, Catering = guests * days * 27, PortFees = from.Fee / 2 + to.Fee, FuelExpense = (int)Math.Round(Math.Min(fuel, ship.Fuel) * unitCost @@ -563,6 +568,15 @@ namespace Soundings return "Build cabins and dining before carrying guests."; if (ship.Condition < 25) return "An overhaul is required before the ship can sail."; + if (!CrewMarket.ValidPayroll(quote)) + return "Refresh the voyage quote after changing the crew."; + foreach (CrewRoleSpec department in CrewMarket.Roles) + { + CrewRole role = department.Role; + int assigned = quote.CrewAssigned is { Length: > 0 } ? quote.CrewAssigned[(int)role] : ship.CrewCount(role); + if (assigned < CrewMarket.Minimum(ship, role)) + return $"Assign the required {department.Name.ToLowerInvariant()} in the crew office."; + } if (quote.RequiredFuel > ship.Tank) return $"This route needs {quote.RequiredFuel} t. Add a bunker tank or use a larger hull."; if (ship.Fuel < quote.RequiredFuel) diff --git a/Assets/Soundings/Runtime/CrewMarket.cs b/Assets/Soundings/Runtime/CrewMarket.cs new file mode 100644 index 0000000..32cc199 --- /dev/null +++ b/Assets/Soundings/Runtime/CrewMarket.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Soundings +{ + public enum CrewRole { Bridge, Engineering, Galley, Housekeeping, Laundry, Entertainment } + + public sealed class CrewRoleSpec + { + public readonly CrewRole Role; + public readonly string Name, Description; + public readonly int DailyWage; + private readonly int[] complement; + + internal CrewRoleSpec(CrewRole role, string name, string description, int dailyWage, int coastal, int regional, int ocean) + { + Role = role; + Name = name; + Description = description; + DailyWage = dailyWage; + complement = new[] { coastal, regional, ocean }; + } + + internal int StarterCount(int hull) => complement[hull]; + } + + public static class CrewMarket + { + private const int MaxPerRole = 240; + + public static readonly IReadOnlyList Roles = new[] + { + new CrewRoleSpec(CrewRole.Bridge, "Bridge officers", "Stand navigation watches and keep crossings on schedule.", 350, 4, 6, 10), + new CrewRoleSpec(CrewRole.Engineering, "Engineering", "Keep propulsion, water and treatment systems running.", 220, 8, 14, 24), + new CrewRoleSpec(CrewRole.Galley, "Galley crew", "Cook meals and staff the galley during busy seatings.", 155, 12, 21, 36), + new CrewRoleSpec(CrewRole.Housekeeping, "Hotel services", "Turn over cabins and serve guests at bars, shops and amenities.", 130, 14, 24, 44), + new CrewRoleSpec(CrewRole.Laundry, "Laundry crew", "Wash cabin linen and towels using the ship’s freshwater supply.", 115, 5, 9, 18), + new CrewRoleSpec(CrewRole.Entertainment, "Entertainment", "Run the ship’s shows and guest programming.", 140, 4, 7, 16) + }; + + internal static bool IsRole(CrewRole role) => (uint)role < (uint)Roles.Count; + + public static int Minimum(Ship ship, CrewRole role) => role switch + { + CrewRole.Bridge => 2 + ship.HullIndex, + CrewRole.Engineering => 4 + 2 * ship.HullIndex, + _ => 0 + }; + + internal static int Starter(Ship ship, CrewRole role) => Roles[(int)role].StarterCount(ship.HullIndex); + + public static int Recommended(Ship ship, CrewRole role) + { + int extraDecks = Math.Max(0, ship.Decks.Count - ship.Hull.StarterDecks); + int additional = role switch + { + CrewRole.Bridge => (extraDecks + 1) / 2, + CrewRole.Engineering => extraDecks * 2 + ship.Count(Facility.Workshop), + CrewRole.Galley => extraDecks + ship.Count(Facility.Galley) * 2, + CrewRole.Housekeeping => extraDecks * 2 + ship.SuiteBerths / 60, + CrewRole.Laundry => extraDecks + ship.Beds / (100 + 75 * ship.HullIndex), + CrewRole.Entertainment => ship.Entertainment / 190, + _ => 0 + }; + // The baseline laundry complement already covers a normal starter fit-out. + if (role == CrewRole.Laundry) + additional = Math.Max(0, additional - 2); + return Starter(ship, role) + additional; + } + + public static int HireFee(Ship ship, CrewRole role) + { + PortSpec port = Market.Ports[ship.Port]; + double recruitmentRate = Math.Clamp(.85 + (port.Fee - 5600) / 27800.0, .85, 1.48); + return (int)Math.Round(Roles[(int)role].DailyWage * 3 * recruitmentRate / 10) * 10; + } + + internal static bool ValidManifest(int[] manifest) + { + if (manifest == null || manifest.Length == 0) + return true; + if (manifest.Length != Roles.Count) + return false; + foreach (int count in manifest) + if (count < 0 || count > MaxPerRole) + return false; + return true; + } + + internal static bool ValidPayroll(Voyage quote) => ValidManifest(quote.CrewAssigned) + && (quote.CrewAssigned is not { Length: > 0 } || (long)Payroll(quote.CrewAssigned) * quote.Days == quote.Crew); + + internal static int Payroll(int[] manifest) + { + int wage = 0; + for (int i = 0; i < Roles.Count; i++) + wage += manifest[i] * Roles[i].DailyWage; + return wage; + } + + internal static int Maximum(Ship ship, CrewRole role) => + Math.Min(MaxPerRole, Math.Max(16, Recommended(ship, role) * 3)); + } + + public sealed partial class Ship + { + [SerializeField] private int[] crew; + + public int CrewCount(CrewRole role) => !CrewMarket.IsRole(role) ? 0 + : crew is { Length: > 0 } ? crew[(int)role] : CrewMarket.Starter(this, role); + + public int TotalCrew + { + get + { + int count = 0; + foreach (CrewRoleSpec department in CrewMarket.Roles) + count += CrewCount(department.Role); + return count; + } + } + + public int DailyPayroll + { + get + { + int payroll = 0; + foreach (CrewRoleSpec department in CrewMarket.Roles) + payroll += CrewCount(department.Role) * department.DailyWage; + return payroll; + } + } + + internal int[] CaptureCrew() + { + var manifest = new int[CrewMarket.Roles.Count]; + for (int i = 0; i < manifest.Length; i++) + manifest[i] = CrewCount((CrewRole)i); + return manifest; + } + + internal void SetCrewCount(CrewRole role, int count) + { + if (crew is not { Length: > 0 }) + crew = CaptureCrew(); + crew[(int)role] = count; + } + + internal bool ValidCrew() => CrewMarket.ValidManifest(crew); + } + + public sealed partial class Company + { + public string CrewChangeBlock(Ship ship, CrewRole role, int change, bool underway = false) + { + if (ship == null || !Fleet.Contains(ship) || !CrewMarket.IsRole(role) || change is not (-1 or 1)) + return "Choose a department aboard a ship in your fleet."; + if (underway) + return "Crew assignments change at berth."; + + int assigned = ship.CrewCount(role); + if (change < 0 && assigned <= CrewMarket.Minimum(ship, role)) + return assigned == 0 ? "This department has no crew to release." : "Keep the watches needed to clear departure."; + if (change > 0 && assigned >= CrewMarket.Maximum(ship, role)) + return "This department is at its crew accommodation limit."; + if (change > 0 && AvailableCash < CrewMarket.HireFee(ship, role)) + return "The company needs more available cash to hire."; + return null; + } + + public string ChangeCrew(Ship ship, CrewRole role, int change, bool underway = false) + { + string block = CrewChangeBlock(ship, role, change, underway); + if (block != null) + return block; + if (change > 0) + Cash -= CrewMarket.HireFee(ship, role); + ship.SetCrewCount(role, ship.CrewCount(role) + change); + return null; + } + } +} diff --git a/Assets/Soundings/Runtime/CrewMarket.cs.meta b/Assets/Soundings/Runtime/CrewMarket.cs.meta new file mode 100644 index 0000000..669bdba --- /dev/null +++ b/Assets/Soundings/Runtime/CrewMarket.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 23e627d241141dfc898b458b482f4076 \ No newline at end of file diff --git a/Assets/Soundings/Runtime/CrewOffice.cs b/Assets/Soundings/Runtime/CrewOffice.cs new file mode 100644 index 0000000..71dd513 --- /dev/null +++ b/Assets/Soundings/Runtime/CrewOffice.cs @@ -0,0 +1,123 @@ +using UnityEngine.UIElements; + +namespace Soundings +{ + public sealed partial class SoundingsApp + { + private bool crewManifestOpen; + private Label crewManifestLaundry; + + private void DrawCrewOffice(VisualElement workspace) + { + var stage = Add(workspace, "crew-office"); + var office = Add(stage, "crew-sheet"); + var head = Add(office, "crew-heading"); + var identity = Add(head, "crew-identity"); + Ship ship = Ship; + AddText(identity, ship == null ? "PERSONNEL" : Market.Ports[ship.Port].Name.ToUpperInvariant() + " / PERSONNEL", + "crew-kicker"); + AddDisplay(identity, "Crew office", "crew-title"); + if (ship == null) + { + AddText(identity, "Register a ship to assign its crew.", "crew-note"); + head.Add(Action("Open shipyard", () => ChangePage(2), "primary", "crew-open-yard")); + return; + } + + AddText(identity, $"{ship.Name} · {ship.Hull.Name} · {ship.Decks.Count} decks", "crew-ship"); + var budget = Add(head, "crew-office-budget"); + AddCrewMetric(budget, "ASSIGNED", ship.TotalCrew.ToString("N0")); + AddCrewMetric(budget, "PAYROLL / SAILING DAY", Money(ship.DailyPayroll)); + head.Add(Action("Switch ship", ToggleFleetOverview, "crew-fleet", "crew-fleet")); + + var table = new ScrollView(ScrollViewMode.Vertical) { horizontalScrollerVisibility = ScrollerVisibility.Hidden }; + table.AddToClassList("crew-table"); + office.Add(table); + var columns = Add(table, "crew-columns"); + AddText(columns, "DEPARTMENT", "crew-kicker crew-department"); + AddText(columns, "STAFF / PLAN", "crew-kicker crew-counts"); + AddText(columns, "RECRUIT AT THIS PORT", "crew-kicker crew-row-actions"); + foreach (CrewRoleSpec department in CrewMarket.Roles) + { + CrewRole role = department.Role; + var row = Add(table, "crew-row"); + var copy = Add(row, "crew-department"); + AddDisplay(copy, department.Name, "crew-department-name"); + AddText(copy, department.Description, "crew-note"); + var coverage = Add(row, "crew-counts"); + int assigned = ship.CrewCount(role), planned = CrewMarket.Recommended(ship, role); + AddText(coverage, $"{assigned:N0} / {planned:N0}", assigned < planned ? "crew-count crew-short" : "crew-count"); + AddText(coverage, $"{Money(department.DailyWage)} per person / day", "crew-wage"); + var actions = Add(row, "crew-row-actions crew-actions"); + AddCrewChange(actions, ship, role, 1, $"Hire · {Money(CrewMarket.HireFee(ship, role))}"); + AddCrewChange(actions, ship, role, -1, "Release"); + } + AddText(office, "Hiring fees are paid here. Payroll is charged when each crossing settles. The sailing roster is set at cast off.", + "crew-office-footer"); + } + + private void AddCrewMetric(VisualElement parent, string label, string value) + { + var stat = Add(parent, "crew-stat"); + AddText(stat, label, "crew-kicker"); + AddDisplay(stat, value, "crew-stat-value"); + } + + private void AddCrewChange(VisualElement parent, Ship ship, CrewRole role, int change, string titleText) + { + bool hiring = change > 0; + string failure = company.CrewChangeBlock(ship, role, change, FleetStatus(ship).Voyage != null); + var button = Action(titleText, () => + { + string result = company.ChangeCrew(ship, role, change, FleetStatus(ship).Voyage != null); + Apply(result, hiring ? $"Crew member assigned to {ship.Name}." : "Crew member released at the berth."); + }, hiring ? "crew-hire" : "crew-release", $"crew-{(hiring ? "hire" : "release")}-{(int)role}"); + button.tooltip = failure ?? (hiring ? "Pay a one-time recruitment fee and add this wage to the ship’s payroll." : "Remove one crew member at this port."); + button.SetEnabled(failure == null); + parent.Add(button); + } + + private void ToggleCrewManifest() + { + crewManifestOpen = !crewManifestOpen; + Render(); + } + + private void DrawCrewManifest(VisualElement parent) + { + for (int i = 0; i < parent.childCount; i++) + parent[i].SetEnabled(false); + + var overlay = Add(parent, "crew-manifest-overlay"); + var sheet = Add(overlay, "crew-manifest"); + sheet.name = "crew-manifest"; + var heading = Add(sheet, "crew-heading"); + var titleRow = Add(heading, "crew-identity"); + AddText(titleRow, Ship.Name.ToUpperInvariant(), "crew-kicker"); + AddDisplay(titleRow, "Crew on duty", "crew-title"); + heading.Add(Action("Close Esc", ToggleCrewManifest, "crew-fleet", "crew-manifest-close")); + + var roster = Add(sheet, "crew-manifest-roster"); + foreach (CrewRoleSpec department in CrewMarket.Roles) + { + CrewRole role = department.Role; + int assigned = underway.CrewAssigned is { Length: > 0 } + ? underway.CrewAssigned[(int)role] : Ship.CrewCount(role); + int planned = CrewMarket.Recommended(Ship, role); + var row = Add(roster, "crew-manifest-row"); + AddText(row, department.Name, "crew-manifest-role"); + AddText(row, $"{assigned} / {planned}", assigned < planned ? "crew-count crew-short" : "crew-count"); + } + AddText(sheet, $"Payroll for this crossing · {Money(underway.Crew)}", "crew-manifest-payroll"); + crewManifestLaundry = AddText(sheet, "", "crew-note"); + RefreshCrewManifest(); + } + + private void RefreshCrewManifest() + { + if (!crewManifestOpen || livePassage == null || crewManifestLaundry?.panel == null) + return; + SetPassageText(crewManifestLaundry, $"Laundry · {livePassage.LaundryCapacity:N0} loads/day against {livePassage.LaundryDemand:N0} needed · {livePassage.LaundryBacklog:N0} waiting"); + } + } +} diff --git a/Assets/Soundings/Runtime/CrewOffice.cs.meta b/Assets/Soundings/Runtime/CrewOffice.cs.meta new file mode 100644 index 0000000..a263bf3 --- /dev/null +++ b/Assets/Soundings/Runtime/CrewOffice.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8a309b9da60252c9e89daa18d2b8a71c \ No newline at end of file diff --git a/Assets/Soundings/Runtime/DeckAmbience.cs b/Assets/Soundings/Runtime/DeckAmbience.cs new file mode 100644 index 0000000..d3746e3 --- /dev/null +++ b/Assets/Soundings/Runtime/DeckAmbience.cs @@ -0,0 +1,206 @@ +using System; +using UnityEngine; + +namespace Soundings +{ + internal enum DeckSound { Deck, Crowd, Pool, Dining, Entertainment, Machinery, Galley, Laundry, Bridge, Retail } + + internal sealed class DeckAmbience : MonoBehaviour + { + private static readonly DeckSound[] Sounds = (DeckSound[])Enum.GetValues(typeof(DeckSound)); + private readonly AudioSource[] sources = new AudioSource[Sounds.Length]; + private readonly AudioLowPassFilter[] filters = new AudioLowPassFilter[Sounds.Length]; + private readonly bool[] started = new bool[Sounds.Length]; + private readonly float[] targets = new float[Sounds.Length]; + private readonly float[] pans = new float[Sounds.Length]; + private Harbor harbor; + + internal float Focus { get; private set; } + internal bool Ready { get; private set; } + internal float Level(DeckSound sound) => sources[(int)sound].volume; + + internal void Initialize(Harbor scene) + { + harbor = scene; + Ready = true; + foreach (DeckSound sound in Sounds) + { + int i = (int)sound; + var layer = new GameObject($"Deck ambience · {sound}"); + layer.transform.SetParent(transform, false); + AudioSource source = sources[i] = layer.AddComponent(); + source.playOnAwake = false; + source.loop = true; + source.spatialBlend = 0; + source.volume = 0; + source.priority = 164; + source.clip = Resources.Load($"Audio/Deck/{sound}"); + Ready &= source.clip != null; + AudioLowPassFilter filter = filters[i] = layer.AddComponent(); + filter.cutoffFrequency = 2100; + filter.lowpassResonanceQ = 1; + } + } + + internal void Mix(float delta, bool active, OnboardSession session, bool addressPlaying) + { + Array.Clear(targets, 0, targets.Length); + float focus = active ? harbor.ReadDeckAmbience(this, session) : 0; + float ease = 1 - Mathf.Exp(-Mathf.Max(0, delta) * 4.3f); + Focus = Mathf.Lerp(Focus, focus, ease); + float announcementGain = addressPlaying ? .44f : 1; + foreach (DeckSound sound in Sounds) + { + int i = (int)sound; + AudioSource source = sources[i]; + float target = targets[i] * announcementGain; + source.volume = Mathf.Lerp(source.volume, target, ease); + source.panStereo = Mathf.Lerp(source.panStereo, target > 0 ? pans[i] : 0, ease); + if (source.clip == null) + continue; + + if (target > .002f && !source.isPlaying) + { + if (started[i]) + source.UnPause(); + else + { + source.Play(); + started[i] = true; + } + } + else if (target == 0 && source.volume < .001f && source.isPlaying) + source.Pause(); + + filters[i].cutoffFrequency = Mathf.Lerp(1450, sound == DeckSound.Dining ? 7200 : 5400, Focus); + } + } + + internal void Listen(DeckSound sound, float level, float pan) + { + int i = (int)sound; + float combined = targets[i] + level; + if (combined <= 0) + return; + pans[i] = (pans[i] * targets[i] + pan * level) / combined; + targets[i] = Mathf.Min(Mathf.Max(level, targets[i]) + Mathf.Min(level, targets[i]) * .16f, .56f); + } + } + + public sealed partial class Harbor + { + internal float ReadDeckAmbience(DeckAmbience mix, OnboardSession session) + { + if (viewCamera == null || !viewCamera.enabled || Frame == null || vessel == null || displayedShip == null || PortCinematicActive) + return 0; + + bool onFoot = cameraMode != CameraMode.Orbit; + Vector3 listener = onFoot ? freePosition : OverviewFocus() + orbitOffset; + Vector3 right = vessel.InverseTransformDirection(viewCamera.transform.right); + float span = onFoot ? 5 : OrbitVerticalSpan; + float overviewSpan = 2 * OverviewHalfHeight(ViewAspect) * OverviewZoom; + float nearZoom = Mathf.Min(.24f, 8.4f / overviewSpan); + float focus = onFoot ? 1 : Mathf.SmoothStep(0, 1, Mathf.InverseLerp(.9f, nearZoom, zoom / OverviewZoom)); + float radius = Mathf.Lerp(7.2f, 27f, Mathf.InverseLerp(6, 44, span)); + if (focus < .001f) + return 0; + + if (cameraMode == CameraMode.Bridge) + { + mix.Listen(DeckSound.Bridge, focus * .47f, 0); + return focus; + } + + if (cameraMode == CameraMode.Service) + { + // Listen from the actual walking position as the player moves through the crew corridor. + mix.Listen(DeckSound.Machinery, focus * .10f, 0); + for (int area = 0; area < ServiceDeckModel.Areas.Length; area++) + { + DeckSound sound = area switch { 1 => DeckSound.Galley, 6 => DeckSound.Laundry, _ => DeckSound.Machinery }; + Heard(sound, serviceDeck.Entry(area) + new Vector3(0, -.65f, 3.6f), + area is 0 or 1 or 6 ? .46f : .20f, 1); + } + return focus; + } + + float passengers = session == null ? .18f : Mathf.Clamp01(.30f + session.Quote.Guests * .0035f); + mix.Listen(DeckSound.Deck, focus * (deckIndex < 0 ? .27f : .07f), 0); + if (deckIndex < 0) + { + // The orbit point projects onto the sun deck rather than listening through the hull. + VesselExterior.SunDeckLayout plan = VesselExterior.SunDeck(displayedShip); + listener.y = VesselExterior.DeckBase + displayedShip.Decks.Count * VesselExterior.DeckSpacing; + float outdoors = session?.Quote.Weather == WeatherCondition.Storm ? .16f : 1f; + Vector3 terrace = new(plan.PoolCenter, listener.y, 0); + Heard(DeckSound.Crowd, terrace - Vector3.right * 2.2f, passengers * outdoors * .29f, 1.1f); + if (plan.HasPool) + Heard(DeckSound.Pool, terrace, .11f + .28f * Service(OnboardService.Amenities) * outdoors, 1.0f); + if (plan.Theater) + Heard(DeckSound.Entertainment, new Vector3(plan.StageCenter, listener.y, 0), + .36f * Service(OnboardService.Shows) * outdoors, 1.18f); + return focus; + } + + mix.Listen(DeckSound.Crowd, focus * passengers * .075f, 0); + if (decks == null) + return focus; + + var stations = decks.ActiveStations; + for (int i = 0; i < stations.Count; i++) + { + ShipStation station = stations[i]; + switch (station.Kind) + { + case StationKind.Dining: + case StationKind.Bar: + float diners = Service(station.Kind == StationKind.Dining ? OnboardService.Meals : OnboardService.Drinks); + Heard(DeckSound.Dining, station.Position, diners * .44f, 1); + Heard(DeckSound.Crowd, station.Position, passengers * diners * .34f, 1.1f); + break; + case StationKind.Stage: + Heard(DeckSound.Entertainment, station.Position, Service(OnboardService.Shows) * .49f, 1.15f); + break; + case StationKind.Pool: + Heard(DeckSound.Pool, station.Position, .12f + Service(OnboardService.Amenities) * .29f, 1.10f); + Heard(DeckSound.Crowd, station.Position, passengers * Service(OnboardService.Amenities) * .26f, 1); + break; + case StationKind.Galley: + Heard(DeckSound.Galley, station.Position, .16f + Service(OnboardService.Meals) * .36f, .86f); + break; + case StationKind.Engine: + case StationKind.Stores: + case StationKind.Maintenance: + case StationKind.Water: + case StationKind.Waste: + Heard(DeckSound.Machinery, station.Position, .29f, .86f); + break; + case StationKind.Retail: + Heard(DeckSound.Retail, station.Position, .30f * Service(OnboardService.Retail), .92f); + Heard(DeckSound.Crowd, station.Position, passengers * Service(OnboardService.Retail) * .25f, 1); + break; + } + } + return focus; + + float Service(OnboardService kind) + { + if (session == null) + return .13f; + OnboardSample service = session.Get(kind); + return Mathf.Clamp01(service.Served * .012f); + } + + void Heard(DeckSound sound, Vector3 source, float level, float reach) + { + Vector3 offset = source - listener; + float distance = offset.sqrMagnitude / (radius * radius * reach * reach); + float gain = focus * level / (1 + distance * (1 + distance)); + if (onFoot && walkSpace != null && !walkSpace.HasSightLine(listener, source)) + gain *= .47f; + float pan = Mathf.Clamp(Vector3.Dot(offset, right) / Mathf.Lerp(4.5f, 16f, Mathf.InverseLerp(6, 38, span)), -.62f, .62f); + mix.Listen(sound, gain, pan); + } + } + } +} diff --git a/Assets/Soundings/Runtime/DeckAmbience.cs.meta b/Assets/Soundings/Runtime/DeckAmbience.cs.meta new file mode 100644 index 0000000..d687525 --- /dev/null +++ b/Assets/Soundings/Runtime/DeckAmbience.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 69ed0a3d4df04ea8b928d04daa0f4504 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Soundings/Runtime/DeckLayout.cs b/Assets/Soundings/Runtime/DeckLayout.cs index 0948130..3a90eda 100644 --- a/Assets/Soundings/Runtime/DeckLayout.cs +++ b/Assets/Soundings/Runtime/DeckLayout.cs @@ -196,10 +196,11 @@ namespace Soundings { float length = end - start; float mid = (end + start) * .5f; - structure.Box(DeckTrim, new Vector3(mid, floor + .037f, z), new Vector3(length, .018f, AisleWidth - .21f)); + structure.Box(PromenadeRunner, new Vector3(mid, floor + .037f, z), new Vector3(length, .018f, AisleWidth - .21f)); for (int side = -1; side <= 1; side += 2) { structure.Box(Joinery, new Vector3(mid, floor + .049f, z + side * .615f), new Vector3(length, .008f, .025f)); + structure.Box(DeckTrim, new Vector3(mid, floor + .049f, z + side * .702f), new Vector3(length, .008f, .075f)); interior.Box(DeckTrim, new Vector3(mid, floor + DeckCeiling - .083f, z + side * .60f), new Vector3(length, .12f, .028f)); } int lights = Mathf.Max(1, Mathf.RoundToInt(length / bay)); @@ -231,7 +232,7 @@ namespace Soundings Facility.Entertainment or Facility.GrandTheater => 11, Facility.Bar or Facility.CocktailLounge => 7, Facility.Suite or Facility.GrandSuite => SuiteCarpet, Facility.ResortPool or Facility.Spa or Facility.WaterPark => PoolDeck, Facility.Shop or Facility.ShoppingArcade => Marble, - Facility.Amenity => Alloy, Facility.Galley or Facility.Workshop => BridgeFloor, _ => DeckTrim + Facility.Amenity => PoolDeck, Facility.Galley or Facility.Workshop => BridgeFloor, _ => DeckTrim }; private static StationKind? FacilityStation(Facility facility) => facility switch diff --git a/Assets/Soundings/Runtime/DeckPassengers.cs b/Assets/Soundings/Runtime/DeckPassengers.cs index 719c918..7d2c2ba 100644 --- a/Assets/Soundings/Runtime/DeckPassengers.cs +++ b/Assets/Soundings/Runtime/DeckPassengers.cs @@ -14,7 +14,8 @@ namespace Soundings Ivory = 30, LightStrip = 31, Gasket = 32, DisplayDark = 33, ScreenChart = 34, ScreenGreen = 35, ScreenAmber = 36, BridgeFloor = 37, Upholstery = 38, SafetyGreen = 39, ScreenWater = 40, ScreenLand = 41, ScreenRed = 42, WindowGlass = 43, PoolWater = 44, PoolTile = 45, - SuiteCarpet = 46, Brass = 47, ShowVelvet = 48, PoolDeck = 49, LoungeLeather = 50, Marble = 51; + SuiteCarpet = 46, Brass = 47, ShowVelvet = 48, PoolDeck = 49, LoungeLeather = 50, Marble = 51, + PromenadeRunner = 52, Linen = 53; private static readonly string[] Paint = { "142C3F", "E1DBCA", "B88754", "8A613C", "283846", "678B93", "B45944", "497975", @@ -22,7 +23,8 @@ namespace Soundings "573B2E", "A46C50", "DFAB86", "40577D", "BF7756", "D3B973", "76ADA8", "A684AB", "E3DED0", "B7BFC0", "AD825C", "91A9AF", "284550", "385361", "DCE1DB", "FFF1D7", "202D36", "111D25", "8ED9E0", "65C89B", "E7B868", "3F565C", "416172", "527D65", "29485A", "A8AB71", - "D66D57", "80B6C5", "3796A3", "47878F", "485C6C", "BD9660", "85424D", "6A908E", "59716B", "E7E0D5" + "D66D57", "80B6C5", "3796A3", "47878F", "485C6C", "BD9660", "85424D", "9BAFA8", "59716B", "E7E0D5", + "43696C", "E9DEBD" }; private readonly Transform shipRoot; @@ -487,7 +489,11 @@ namespace Soundings float z = depth * .16f; Solid(Joinery, x, .257f, z, 1.03f, .52f, 1.88f); Box(Ivory, x, .562f, z, 1.05f, .191f, 1.88f); - Box(Upholstery, x, .678f, z - .22f, 1.07f, .075f, 1.34f); + int throwColor = seed % 2 == 0 ? Upholstery : 20; + Box(Linen, x, .673f, z - .126f, 1.07f, .064f, 1.53f); + Box(throwColor, x, .714f, z - .63f, 1.08f, .034f, .51f); + for (int seam = -1; seam <= 1; seam += 2) + Box(Ivory, x + seam * .385f, .708f, z + .015f, .016f, .010f, .80f); Box(Ivory, x, .71f, z + .59f, .62f, .108f, .35f); Box(Joinery, x, .77f, z + .91f, 1.12f, .87f, .10f); Box(LightStrip, x, 1.12f, z + .837f, .48f, .036f, .049f); @@ -496,6 +502,9 @@ namespace Soundings Solid(Joinery, width * .395f, .44f, -depth * .214f, .80f, .88f, .96f); Box(Ivory, width * .395f, .906f, -depth * .214f, .86f, .055f, 1.01f); Box(Alloy, width * .35f, .765f, -depth * .31f, .38f, .034f, .054f); + Box(16, width * .36f, .944f, -depth * .236f, .29f, .028f, .20f); + Box(Linen, width * .36f, .963f, -depth * .238f, .262f, .013f, .18f); + Box(20, width * .36f, .974f, -depth * .236f, .25f, .012f, .174f); Solid(Joinery, -width * .39f, .95f, -depth * .24f, .67f, 1.90f, .88f); Box(Alloy, -width * .337f, 1.00f, -depth * .24f, .033f, .15f, .035f); Guest(seed % 3 == 0 ? GuestActivity.Read : GuestActivity.Rail, .05f, -depth * .05f, 1, @@ -592,6 +601,7 @@ namespace Soundings const float poolLevel = .44f; float poolZ = depth * .13f; Vector3 poolFoot = pos + Vector3.forward * (poolZ * facing); + Box(PoolDeck, 0, .013f, poolZ, basin.x * 2 + .78f, .017f, basin.y * 2 + .81f); VesselExterior.PoolBasin(shape.Mesh(Ivory), shape.Mesh(PoolTile), shape.Mesh(PoolWater), poolFoot, basin, .56f, poolLevel); VesselExterior.PoolRails(shape.Mesh(Alloy), poolFoot + new Vector3(-basin.x * .69f, .18f, -basin.y * facing), -facing); layout.WalkSpace.Block(poolFoot, new Vector3((basin.x + .23f) * 2f, .56f, (basin.y + .23f) * 2f)); @@ -606,6 +616,7 @@ namespace Soundings Solid(Joinery, seatX, .20f, bench, .94f, .36f, .46f); Box(Upholstery, seatX, .418f, bench, .92f, .089f, .46f); Box(Upholstery, seatX, .61f, bench - .211f, .93f, .36f, .072f); + Box(Linen, seatX - side * .30f, .474f, bench + .01f, .24f, .035f, .31f); Guest(side > 0 ? GuestActivity.Read : GuestActivity.Rest, seatX, bench, side + 3, OnboardService.Amenities, side < 0 ? .30f : .75f, .483f); } @@ -960,15 +971,20 @@ namespace Soundings { 0 => Harbor.SurfaceFinish.Hull, 2 or Joinery => Harbor.SurfaceFinish.Timber, - Carpet or BridgeFloor or Upholstery or SuiteCarpet or ShowVelvet or LoungeLeather or 11 => Harbor.SurfaceFinish.Fabric, + Carpet or BridgeFloor or Upholstery or SuiteCarpet or ShowVelvet or LoungeLeather or PromenadeRunner + or Linen or 11 => Harbor.SurfaceFinish.Fabric, Alloy or Brass => Harbor.SurfaceFinish.Alloy, PoolWater => Harbor.SurfaceFinish.Pool, _ => Harbor.SurfaceFinish.Paint }; material.SetFloat("_Finish", (float)surfaceFinish); + if (id is PoolDeck or PoolTile) + material.SetFloat("_TileFrequency", id == PoolTile ? 14 : 3.4f); + if (id is Carpet or SuiteCarpet or PromenadeRunner or 11) + material.SetFloat("_FabricMotif", id == SuiteCarpet ? .9f : .54f); if (id == 0) material.SetFloat("_Waterline", 1); - material.SetFloat("_Roughness", id == PoolWater ? .16f : metal ? .39f : .76f); + material.SetFloat("_Roughness", id is PoolWater or PoolTile ? .19f : metal ? .39f : .76f); material.SetFloat("_Metal", metal ? .45f : .04f); material.SetFloat("_Weather", id is Carpet or BridgeFloor or Upholstery ? .57f : .12f); material.SetFloat("_Emissive", id switch diff --git a/Assets/Soundings/Runtime/DeckVenues.cs b/Assets/Soundings/Runtime/DeckVenues.cs index a20a576..0070f45 100644 --- a/Assets/Soundings/Runtime/DeckVenues.cs +++ b/Assets/Soundings/Runtime/DeckVenues.cs @@ -166,6 +166,7 @@ namespace Soundings const float rim = .59f, surface = .47f; var basin = new Vector2(width * .337f, depth * .229f); room.Pool(poolZ, basin, rim, surface); + FitPoolSurround(room, poolZ, basin); room.Guest(GuestActivity.Wade, basin.x * .78f, poolZ + basin.y * .08f, 106, OnboardService.Amenities, .10f, lift: surface); room.Guest(GuestActivity.Wade, -basin.x * .77f, poolZ - basin.y * .12f, 108, OnboardService.Amenities, .48f, direction: -1, lift: surface); @@ -312,8 +313,8 @@ namespace Soundings float poolZ = depth * .093f; var basin = new Vector2(width * (park ? .313f : .253f), depth * .213f); float surface = park ? .50f : .44f; - room.Box(Marble, 0, .014f, poolZ, basin.x * 2 + 1.06f, .025f, basin.y * 2 + .99f); room.Pool(poolZ, basin, surface + .103f, surface); + FitPoolSurround(room, poolZ, basin); if (park) { for (int lane = -1; lane <= 1; lane++) @@ -371,6 +372,22 @@ namespace Soundings room.Station(StationKind.Pool, 0, poolZ - basin.y - .36f); } + private static void FitPoolSurround(Venue room, float center, Vector2 basin) + { + room.Box(PoolDeck, 0, .020f, center, basin.x * 2 + .78f, .029f, basin.y * 2 + .76f); + for (int side = -1; side <= 1; side += 2) + { + float z = center + side * (basin.y + .31f); + room.Box(Alloy, 0, .037f, z, basin.x * 1.85f, .017f, .081f); + int slats = Mathf.CeilToInt(basin.x * 8f); + for (int i = 0; i < slats; i++) + { + float x = Mathf.Lerp(-basin.x * .90f, basin.x * .90f, (i + .5f) / slats); + room.Box(Gasket, x, .046f, z, .023f, .008f, .059f); + } + } + } + private readonly struct Venue { private readonly Geometry shape; diff --git a/Assets/Soundings/Runtime/FleetPassageSave.cs b/Assets/Soundings/Runtime/FleetPassageSave.cs index a71ad33..fc9c23b 100644 --- a/Assets/Soundings/Runtime/FleetPassageSave.cs +++ b/Assets/Soundings/Runtime/FleetPassageSave.cs @@ -176,7 +176,7 @@ namespace Soundings || (uint)voyage.Weather > (uint)WeatherCondition.Storm || voyage.Guests < 1 || voyage.Guests > voyage.Capacity || voyage.RoomDemand < voyage.Guests || voyage.Fare < Market.MinFare || voyage.Fare > Market.MaxFare || voyage.TicketSales < 0 || voyage.FuelBurn < 1 || voyage.Reserve < 0 || voyage.Crew < 0 || voyage.Catering < 0 - || ship.ShoreCall != null || !ShoreExcursions.ValidOffers(voyage.Destination, voyage.ShoreOffers) + || ship.ShoreCall != null || !ShoreExcursions.ValidOffers(voyage.Destination, voyage.ShoreOffers) || !CrewMarket.ValidPayroll(voyage) || voyage.PortFees < 0 || voyage.LoanInterest < 0 || voyage.Principal < 0) return false; diff --git a/Assets/Soundings/Runtime/FleetPassages.cs b/Assets/Soundings/Runtime/FleetPassages.cs index 3a36e5d..f50ba07 100644 --- a/Assets/Soundings/Runtime/FleetPassages.cs +++ b/Assets/Soundings/Runtime/FleetPassages.cs @@ -56,7 +56,9 @@ namespace Soundings ClearActivePassage(); company.SelectedShip = index; - page = deckIndex = 0; + if (page != CrewOfficePage || fleetPassages.ContainsKey(Ship)) + page = 0; + deckIndex = 0; ResetItinerary(); Notify(null); if (fleetPassages.TryGetValue(Ship, out FleetPassage selected)) @@ -87,6 +89,8 @@ namespace Soundings { passageDeck = passageServiceArea = -1; passageBridge = passageExploring = false; + crewManifestOpen = false; + crewManifestLaundry = null; voyageMapOpen = false; stationFeedbackText = null; passageBusinessOpen = true; diff --git a/Assets/Soundings/Runtime/GameGraphics.cs b/Assets/Soundings/Runtime/GameGraphics.cs index 34f8d14..c6c7373 100644 --- a/Assets/Soundings/Runtime/GameGraphics.cs +++ b/Assets/Soundings/Runtime/GameGraphics.cs @@ -114,6 +114,12 @@ namespace Soundings Path(14, 10, 18, 10); Path(14, 13, 17, 13); break; + case "crew": + pen.Arc(Point(9, 7), 3 * scale, 0, 360); + Path(3, 19, 3, 16, 5, 13, 13, 13, 15, 16, 15, 19); + Path(15, 4, 18, 4, 20, 7, 18, 10, 16, 10); + Path(17, 13, 20, 14, 21, 17, 21, 19); + break; default: Path(5, 7, 19, 7); Path(5, 12, 19, 12); diff --git a/Assets/Soundings/Runtime/HarborMesh.cs b/Assets/Soundings/Runtime/HarborMesh.cs index bba5f83..8f97059 100644 --- a/Assets/Soundings/Runtime/HarborMesh.cs +++ b/Assets/Soundings/Runtime/HarborMesh.cs @@ -7,6 +7,7 @@ namespace Soundings { private readonly List vertices = new List(); private readonly List triangles = new List(); + private List waterCoordinates; public Mesh Bake() { @@ -15,10 +16,39 @@ namespace Soundings mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; mesh.SetVertices(vertices); mesh.SetTriangles(triangles, 0); + if (waterCoordinates != null) + { + FillWaterCoordinates(); + mesh.SetUVs(0, waterCoordinates); + } mesh.RecalculateNormals(); return mesh; } + public void WaterSurface(Vector2[] outline, Vector2 center, float height, Vector2 halfSize) + { + waterCoordinates ??= new List(); + FillWaterCoordinates(); + int start = vertices.Count; + foreach (Vector2 edge in outline) + { + Vector2 offset = edge - center; + vertices.Add(Point(edge, height)); + waterCoordinates.Add(new Vector4(offset.x, offset.y, halfSize.x, halfSize.y)); + } + int middle = vertices.Count; + vertices.Add(Point(center, height)); + waterCoordinates.Add(new Vector4(0, 0, halfSize.x, halfSize.y)); + for (int i = 0; i < outline.Length; i++) + AddTriangle(start + i, middle, start + (i + 1) % outline.Length); + } + + private void FillWaterCoordinates() + { + while (waterCoordinates.Count < vertices.Count) + waterCoordinates.Add(Vector4.zero); + } + public void Quad(Vector3 a, Vector3 b, Vector3 c, Vector3 d) { int start = vertices.Count; diff --git a/Assets/Soundings/Runtime/HarborStations.cs b/Assets/Soundings/Runtime/HarborStations.cs index 50f4df0..a359bc9 100644 --- a/Assets/Soundings/Runtime/HarborStations.cs +++ b/Assets/Soundings/Runtime/HarborStations.cs @@ -4,7 +4,7 @@ using UnityEngine; namespace Soundings { - internal enum StationKind { Helm, Engine, Galley, Stores, Maintenance, Water, Waste, Cabins, Dining, Bar, Stage, Pool, Retail } + internal enum StationKind { Helm, Engine, Galley, Stores, Maintenance, Water, Waste, Cabins, Dining, Bar, Stage, Pool, Retail, Laundry } internal readonly struct ShipStation { diff --git a/Assets/Soundings/Runtime/LedgerPage.cs b/Assets/Soundings/Runtime/LedgerPage.cs index bd6507d..f8063d5 100644 --- a/Assets/Soundings/Runtime/LedgerPage.cs +++ b/Assets/Soundings/Runtime/LedgerPage.cs @@ -144,6 +144,8 @@ namespace Soundings { AddText(leaf, $"Guest survey {trip.Onboard.Happiness}/100 · Health {trip.Onboard.Health}/100 · {trip.Weather} seas", "log-note"); AddText(leaf, $"{trip.Onboard.Provisions:N0} portions left · {trip.Onboard.WaterPercent}% freshwater · {trip.Onboard.SewagePercent}% treatment load", "log-secondary"); + if (trip.Onboard.LaundryCleaned > 0 || trip.Onboard.LaundryBacklog > 0) + AddText(leaf, $"Laundry · {trip.Onboard.LaundryCleaned:N0} loads processed · {trip.Onboard.LaundryBacklog:N0} still waiting", "log-secondary"); if (trip.Onboard.CrewCalls > 0) AddText(leaf, $"Crew calls answered · {trip.Onboard.CrewCalls}", "log-secondary"); } @@ -158,7 +160,8 @@ namespace Soundings AddText(statement, $"Includes {Money(sales[(int)OnboardService.Retail])} in shop sales", "log-secondary"); if (trip.Onboard?.Expenses > 0) LogLine(statement, "Onboard operating costs", Money(-trip.Onboard.Expenses)); - LogLine(statement, "Crew and catering", Money(-trip.Crew - trip.Catering)); + LogLine(statement, "Crew payroll", Money(-trip.Crew)); + LogLine(statement, "Catering", Money(-trip.Catering)); if (trip.Plan != null) { LogLine(statement, $"Provisions · {trip.Plan.FoodUnits:N0} portions", Money(-trip.Plan.FoodCost)); diff --git a/Assets/Soundings/Runtime/OnboardEconomy.cs b/Assets/Soundings/Runtime/OnboardEconomy.cs index 43eb960..3668999 100644 --- a/Assets/Soundings/Runtime/OnboardEconomy.cs +++ b/Assets/Soundings/Runtime/OnboardEconomy.cs @@ -8,6 +8,7 @@ namespace Soundings public sealed class OnboardReport { public int Happiness, Health, Revenue, Expenses, Decisions, FuelBurn, Repair, Provisions, WaterPercent, SewagePercent, CrewCalls; + public int LaundryCleaned, LaundryBacklog; public int[] ServiceSales; } @@ -204,6 +205,8 @@ namespace Soundings Provisions = ProvisionsRemaining, WaterPercent = WaterPercent, SewagePercent = SewagePercent, + LaundryCleaned = LaundryCleaned, + LaundryBacklog = LaundryBacklog, Revenue = Revenue, Expenses = Expenses, Decisions = decisions, @@ -231,7 +234,7 @@ namespace Soundings double indoorShift = Quote.Weather == WeatherCondition.Storm && (i == 2 || i == 3 || retail) ? 1.28 : 1; int requested = Math.Min(Quote.Guests, rush + (int)Math.Round(Quote.Guests * BaseDemand[i] * appeal * wave * indoorShift)); int extraSeats = performance ? PortPlanning.ShowSeats(BookedProgram) : 0; - int possible = ServiceCapacity(i, capacity[i] + extraSeats + (featured ? additionalCapacity : 0) + CrewServiceBoost(i)); + int possible = ServiceCapacity(i, capacity[i] + (featured ? additionalCapacity : 0) + CrewServiceBoost(i)) + extraSeats; int served = Math.Min(requested, possible); if (collect) @@ -261,7 +264,10 @@ namespace Soundings if (collect) { UpdateHealth(mealFulfillment); - double target = Math.Min(100, 40 + 55 * fulfillment / serviceCount - (100 - health) * .28 + CrewSurveyBonus); + double cabinService = (Coverage(CrewRole.Housekeeping) - 1) * 8; + double showService = capacity[(int)OnboardService.Shows] > 0 ? Math.Max(0, Coverage(CrewRole.Entertainment) - 1) * 6 : 0; + double target = Math.Clamp(40 + 55 * fulfillment / serviceCount - (100 - health) * .28 + + CrewSurveyBonus + cabinService + showService - LaundryServiceLoss * 8, 0, 100); satisfaction = satisfaction * .77 + target * .23; } } diff --git a/Assets/Soundings/Runtime/OnboardRounds.cs b/Assets/Soundings/Runtime/OnboardRounds.cs index 254f9e6..f9362a0 100644 --- a/Assets/Soundings/Runtime/OnboardRounds.cs +++ b/Assets/Soundings/Runtime/OnboardRounds.cs @@ -5,7 +5,7 @@ namespace Soundings public sealed partial class OnboardSession { private static readonly float[] CrewCallSchedule = { .12f, .43f, .71f }; - private readonly int[] stationReadyAt = new int[(int)StationKind.Retail + 1]; + private readonly int[] stationReadyAt = new int[(int)StationKind.Laundry + 1]; private readonly int[] stationBoostUntil = new int[ServiceKinds]; private int nextCrewCall, crewCallDeadline; @@ -28,6 +28,7 @@ namespace Soundings StationKind.Bar => "Bar counter", StationKind.Stage => "Show lounge", StationKind.Retail => "Shop checkout", + StationKind.Laundry => "Laundry control", _ => "Pool terrace" }; @@ -45,6 +46,7 @@ namespace Soundings StationKind.Stage => CanAdvancePerformance ? "Call the booked act" : "Open overflow seating", StationKind.Pool => "Host a poolside game", StationKind.Retail => "Start a shop sale · 25% off", + StationKind.Laundry => $"Authorize an extra laundry shift · ${LaundryShiftCost:N0}", _ => "Take the helm" }; @@ -57,6 +59,7 @@ namespace Soundings return station switch { StationKind.Galley or StationKind.Dining when GalleyBoost => "The extra shift is already running", + StationKind.Galley or StationKind.Dining when AssignedCrew(CrewRole.Galley) == 0 => "No galley crew is assigned", StationKind.Galley or StationKind.Dining when !CanSpend(GalleyCost) => "No room in the operating budget", StationKind.Dining when ProvisionsRemaining < 12 => "Too little food in stores for another seating", StationKind.Stores when StoresOpened => "The reserve has already been released", @@ -74,6 +77,9 @@ namespace Soundings StationKind.Stage when capacity[(int)OnboardService.Shows] == 0 => "No show lounge is fitted", StationKind.Pool when Quote.Weather == WeatherCondition.Storm => "The terrace is closed in this weather", StationKind.Pool when WaterPercent < 22 => "Freshwater is too low for pool operation", + StationKind.Laundry when AssignedCrew(CrewRole.Laundry) == 0 => "No laundry crew is assigned", + StationKind.Laundry when LaundryBoost => "The extra shift is already running", + StationKind.Laundry when !CanExtendLaundry => "No room in the operating budget", _ => null }; } @@ -100,6 +106,7 @@ namespace Soundings break; case StationKind.Pool: stationBoostUntil[(int)OnboardService.Amenities] = tick + 6; break; case StationKind.Retail: StartSpecial(OnboardService.Retail); break; + case StationKind.Laundry: ExtendLaundry(); break; } stationReadyAt[(int)station] = tick + (station == StationKind.Engine ? 1 : 8); @@ -128,6 +135,7 @@ namespace Soundings StationKind.Bar => "Happy hour started · Drinks are 25% off", StationKind.Stage => "Show lounge ready for guests", StationKind.Retail => "Shop sale started · Merchandise is 25% off", + StationKind.Laundry => "Extra laundry shift running · More linen loads per day", _ => "Poolside game started · More terrace capacity" }; @@ -159,6 +167,8 @@ namespace Soundings station = StationKind.Water; else if (SewagePercent > 68) station = StationKind.Waste; + else if (LaundryBacklog >= LaundryDemand / 2 && CanExtendLaundry) + station = StationKind.Laundry; else station = capacity[(int)OnboardService.Drinks] > 0 ? StationKind.Bar : StationKind.Maintenance; break; diff --git a/Assets/Soundings/Runtime/OnboardSessionSave.cs b/Assets/Soundings/Runtime/OnboardSessionSave.cs index f37ec35..d7524ee 100644 --- a/Assets/Soundings/Runtime/OnboardSessionSave.cs +++ b/Assets/Soundings/Runtime/OnboardSessionSave.cs @@ -10,7 +10,8 @@ namespace Soundings public int[] Prices, ServiceRevenue, SaleUntil, StationReadyAt, StationBoostUntil; public ServiceSampleSnapshot[] Samples; public double Satisfaction, Provisions, Water, Waste, FuelIntegrated, Health, Hydration; - public int GalleyUntil, PumpsUntil, TreatmentUntil, EngineMode, RepairCredit; + public double LaundryBacklog, LaundryCleaned; + public int GalleyUntil, PumpsUntil, TreatmentUntil, LaundryUntil, EngineMode, RepairCredit; public bool Assisted, StoresOpened; public int NextCrewCall, CrewCallDeadline, CrewCall, CrewRequestsCompleted, PerformanceStarted; public string EventResult; @@ -42,6 +43,7 @@ namespace Soundings Prices = (int[])prices.Clone(), ServiceRevenue = (int[])revenue.Clone(), SaleUntil = (int[])saleUntil.Clone(), Samples = samples, Provisions = provisions, Water = water, Waste = waste, FuelIntegrated = fuelIntegrated, Health = health, Hydration = hydration, GalleyUntil = galleyUntil, PumpsUntil = pumpsUntil, + LaundryBacklog = laundryBacklog, LaundryCleaned = laundryCleaned, LaundryUntil = laundryUntil, TreatmentUntil = treatmentUntil, Assisted = Assisted, EngineMode = EngineMode, RepairCredit = RepairCredit, StoresOpened = StoresOpened, StationReadyAt = (int[])stationReadyAt.Clone(), StationBoostUntil = (int[])stationBoostUntil.Clone(), NextCrewCall = nextCrewCall, CrewCallDeadline = crewCallDeadline, @@ -75,9 +77,12 @@ namespace Soundings fuelIntegrated = state.FuelIntegrated; health = state.Health; hydration = state.Hydration; + laundryBacklog = state.LaundryBacklog; + laundryCleaned = state.LaundryCleaned; galleyUntil = state.GalleyUntil; pumpsUntil = state.PumpsUntil; treatmentUntil = state.TreatmentUntil; + laundryUntil = state.LaundryUntil; Assisted = state.Assisted; EngineMode = state.EngineMode; RepairCredit = state.RepairCredit; @@ -118,6 +123,7 @@ namespace Soundings || state.EventBenefitUntil < 0 || state.Decisions < 0 || state.Decisions > offerCount || state.Revenue < 0 || state.Expenses < 0 || state.EngineMode < 0 || state.EngineMode >= FuelRates.Length || state.RepairCredit < 0 || state.RepairCredit > 6 || state.GalleyUntil < 0 || state.PumpsUntil < 0 + || state.LaundryUntil < 0 || state.LaundryUntil > ticks + 7 || state.TreatmentUntil < 0 || state.NextCrewCall < 0 || state.NextCrewCall > CrewCallSchedule.Length || state.CrewCall < -1 || state.CrewCall >= state.StationReadyAt.Length || state.CrewCallDeadline < 0 || state.CrewCallDeadline > ticks || state.CrewRequestsCompleted < 0 @@ -127,7 +133,10 @@ namespace Soundings if (!AmountInRange(state.Satisfaction, 100) || !AmountInRange(state.Health, 100) || !AmountInRange(state.Hydration, 1) || !AmountInRange(state.Provisions, Ship.FoodCapacity) || !AmountInRange(state.Water, Ship.WaterCapacity) - || !AmountInRange(state.Waste, Ship.WasteCapacity * 1.3) || !AmountInRange(state.FuelIntegrated, ticks * 1.23)) + || !AmountInRange(state.Waste, Ship.WasteCapacity * 1.3) || !AmountInRange(state.FuelIntegrated, ticks * 1.23) + || !AmountInRange(state.LaundryBacklog + state.LaundryCleaned, (double)LaundryDemand * Quote.Days) + || !AmountInRange(state.LaundryBacklog, (double)LaundryDemand * Quote.Days) + || !AmountInRange(state.LaundryCleaned, (double)LaundryDemand * Quote.Days)) return false; for (int i = 0; i < state.Prices.Length; i++) diff --git a/Assets/Soundings/Runtime/OnboardSystems.cs b/Assets/Soundings/Runtime/OnboardSystems.cs index 444540e..e5cdf05 100644 --- a/Assets/Soundings/Runtime/OnboardSystems.cs +++ b/Assets/Soundings/Runtime/OnboardSystems.cs @@ -5,13 +5,17 @@ namespace Soundings public sealed partial class OnboardSession { private const double PortionPerMeal = .26; + private const int WaterPerLaundryLoad = 10; private static readonly double[] FuelRates = { .78, 1, 1.22 }; private static readonly float[] ShipSpeeds = { .82f, 1, 1.22f }; private double provisions, water, waste, fuelIntegrated, health = 99, hydration = 1; - private int galleyUntil, pumpsUntil, treatmentUntil; + private double laundryBacklog, laundryCleaned; + private int galleyUntil, pumpsUntil, treatmentUntil, laundryUntil; + private int[] crewComplement; + private readonly double[] crewCoverage = new double[CrewMarket.Roles.Count]; public bool Assisted { get; set; } = true; public int EngineMode { get; private set; } = 1; - public float SpeedFactor => ShipSpeeds[EngineMode]; + public float SpeedFactor => ShipSpeeds[EngineMode] * (float)(.86 + .14 * Coverage(CrewRole.Bridge)); public int Health => (int)Math.Round(health); public int WaterPercent => (int)Math.Round(100 * water / Ship.WaterCapacity); public int SewagePercent => (int)Math.Round(100 * waste / Ship.WasteCapacity); @@ -22,17 +26,28 @@ namespace Soundings public bool GalleyBoost => galleyUntil > tick; public bool PumpsBoost => pumpsUntil > tick; public bool TreatmentBoost => treatmentUntil > tick; + public bool LaundryBoost => laundryUntil > tick; + public int LaundryDemand { get; private set; } + public int LaundryCapacity => Math.Min(138 + Ship.HullIndex * 140, AssignedCrew(CrewRole.Laundry) * 22) + + (LaundryBoost ? Math.Min(58, AssignedCrew(CrewRole.Laundry) * 9) : 0); + public int LaundryBacklog => (int)Math.Ceiling(laundryBacklog); + public int LaundryCleaned => (int)Math.Floor(laundryCleaned); public int GalleyCost => 420 + Quote.Guests * 2; + public int LaundryShiftCost => 180 + AssignedCrew(CrewRole.Laundry) * 18; public int StoreCost => 180 + Quote.Guests * 3; public int PumpCost => 410; public int TreatmentCost => 360; public int RepairCost => 780 + Ship.HullIndex * 490; public bool CanOpenStores => !StoresOpened && provisions < Ship.FoodCapacity * .85 && CanSpend(StoreCost); + public bool CanExtendLaundry => !LaundryBoost && AssignedCrew(CrewRole.Laundry) > 0 && CanSpend(LaundryShiftCost); + + public int AssignedCrew(CrewRole role) => CrewMarket.IsRole(role) ? crewComplement[(int)role] : 0; public bool CanSpend(int cost) => tick < ticks && Expenses + cost <= Quote.TicketSales / 4; public bool CanSetEngineMode(int mode) => - mode >= 0 && mode < FuelRates.Length && (mode < 2 || FuelForMode(mode) + Quote.Reserve <= Ship.Fuel); + mode >= 0 && mode < FuelRates.Length + && (mode < 2 || (Coverage(CrewRole.Engineering) >= .85 && FuelForMode(mode) + Quote.Reserve <= Ship.Fuel)); public void SetEngineMode(int mode) { @@ -52,13 +67,21 @@ namespace Soundings public void ExtendGalley() { - if (GalleyBoost || !CanSpend(GalleyCost)) + if (GalleyBoost || AssignedCrew(CrewRole.Galley) == 0 || !CanSpend(GalleyCost)) return; Expenses += GalleyCost; galleyUntil = tick + 7; Measure(false); } + public void ExtendLaundry() + { + if (!CanExtendLaundry) + return; + Expenses += LaundryShiftCost; + laundryUntil = tick + 7; + } + public void RunBoostPumps() { if (PumpsBoost || !CanSpend(PumpCost)) @@ -85,10 +108,24 @@ namespace Soundings private void InitializeSystems() { + crewComplement = Quote.CrewAssigned is { Length: > 0 } ? (int[])Quote.CrewAssigned.Clone() : Ship.CaptureCrew(); + int totalCrew = 0; + foreach (CrewRoleSpec department in CrewMarket.Roles) + { + CrewRole role = department.Role; + int assigned = AssignedCrew(role); + totalCrew += assigned; + crewCoverage[(int)role] = Math.Min(1.35, (double)assigned / CrewMarket.Recommended(Ship, role)); + } + LaundryDemand = (Quote.Guests + 2) / 3 + (totalCrew + 13) / 14; provisions = Math.Min(Ship.FoodCapacity, Quote.Plan == null ? Quote.Guests * Quote.Days * 2.53 : Quote.Plan.FoodUnits); water = Ship.WaterCapacity; } + private double Coverage(CrewRole role) => crewCoverage[(int)role]; + + private double LaundryServiceLoss => Math.Min(1, laundryBacklog / Math.Max(1, LaundryDemand * .80)); + private int FuelForMode(int mode) { double expected = Quote.FuelBurn * (fuelIntegrated + (ticks - tick) * FuelRates[mode]) / ticks; @@ -109,34 +146,45 @@ namespace Soundings fuelIntegrated += FuelRates[EngineMode]; double portionOfDay = (double)Quote.Days / ticks; - water = Math.Min(Ship.WaterCapacity, water + Ship.WaterProduction * (PumpsBoost ? 1.9 : 1) * portionOfDay); + double engineering = .35 + .65 * Coverage(CrewRole.Engineering); + water = Math.Min(Ship.WaterCapacity, water + Ship.WaterProduction * engineering * (PumpsBoost ? 1.9 : 1) * portionOfDay); double requested = (Quote.Guests * 54 + Get(OnboardService.Amenities).Served * 28) * portionOfDay; double delivered = Math.Min(water, requested); water -= delivered; hydration = requested <= 0 ? 1 : delivered / requested; + laundryBacklog += LaundryDemand * portionOfDay; + double cleaned = Math.Min(laundryBacklog, Math.Min(LaundryCapacity * portionOfDay, water / WaterPerLaundryLoad)); + double washingWater = cleaned * WaterPerLaundryLoad; + laundryBacklog = Math.Max(0, laundryBacklog - cleaned); + laundryCleaned += cleaned; + water = Math.Max(0, water - washingWater); waste = Math.Min(Ship.WasteCapacity * 1.3, Math.Max(0, - waste + delivered * .74 - Ship.WasteTreatment * (TreatmentBoost ? 2.3 : 1) * portionOfDay)); + waste + delivered * .74 + washingWater * .76 + - Ship.WasteTreatment * engineering * (TreatmentBoost ? 2.3 : 1) * portionOfDay)); } - private double QuotaPerService() => Math.Min(Ship.GalleyCapacity, Quote.Guests) * PortionPerMeal; + private int StaffedGalleyCapacity => (int)Math.Round(Ship.GalleyCapacity * Coverage(CrewRole.Galley)); + + private double QuotaPerService() => Math.Min(StaffedGalleyCapacity, Quote.Guests) * PortionPerMeal; private int ServiceCapacity(int service, int venueCapacity) { if (service == (int)OnboardService.Meals) { - int galley = Ship.GalleyCapacity + (GalleyBoost ? 85 : 0); + int galley = StaffedGalleyCapacity + (GalleyBoost ? 85 : 0); int portions = (int)Math.Floor(provisions / PortionPerMeal); return Math.Min(venueCapacity, Math.Min(galley, portions)); } - if (service == (int)OnboardService.Amenities && WaterPercent < 22) - return venueCapacity / 3; - return venueCapacity; + if (service == (int)OnboardService.Shows) + return (int)Math.Round(venueCapacity * Math.Min(1, Coverage(CrewRole.Entertainment))); + int staffed = (int)Math.Round(venueCapacity * Math.Min(1, Coverage(CrewRole.Housekeeping))); + return service == (int)OnboardService.Amenities && WaterPercent < 22 ? staffed / 3 : staffed; } private void UpdateHealth(double mealFulfillment) { double sanitation = 1 - Math.Min(.67, Math.Max(0, waste / Ship.WasteCapacity - .68)); - double target = 53 + mealFulfillment * 32 + hydration * 9 + sanitation * 6; + double target = 53 + mealFulfillment * 32 + hydration * 9 + sanitation * 6 - LaundryServiceLoss * 3; health = health * .80 + target * .20; } } diff --git a/Assets/Soundings/Runtime/PassageInterface.cs b/Assets/Soundings/Runtime/PassageInterface.cs index 26e9b74..adbfacd 100644 --- a/Assets/Soundings/Runtime/PassageInterface.cs +++ b/Assets/Soundings/Runtime/PassageInterface.cs @@ -73,6 +73,7 @@ namespace Soundings controls.Add(Action("Bridge", ViewPassageBridge, PassageViewClass(passageBridge), "passage-bridge")); controls.Add(Action("Explore", ExplorePassageDeck, PassageViewClass(passageExploring && passageServiceArea < 0), "passage-explore")); controls.Add(Action("Service deck", () => ExploreServiceArea(0), PassageViewClass(passageServiceArea >= 0), "passage-service")); + controls.Add(Action("Crew on duty", ToggleCrewManifest, PassageViewClass(crewManifestOpen), "passage-crew-manifest")); Button map = Action("Voyage map", ToggleVoyageMap, PassageViewClass(voyageMapOpen), "voyage-map-toggle"); map.tooltip = "Show or close the live voyage map (M)"; controls.Add(map); diff --git a/Assets/Soundings/Runtime/ServiceControls.cs b/Assets/Soundings/Runtime/ServiceControls.cs index 329b77b..4a3faeb 100644 --- a/Assets/Soundings/Runtime/ServiceControls.cs +++ b/Assets/Soundings/Runtime/ServiceControls.cs @@ -89,9 +89,12 @@ namespace Soundings 4 => ($"Freshwater tank {systems.WaterPercent}%\n{Ship.WaterProduction:N0} L/day normal output", systems.PumpsBoost ? "Boost pumps running" : $"Run boost pumps · {Money(systems.PumpCost)}", !systems.PumpsBoost && systems.CanSpend(systems.PumpCost)), - _ => ($"Treatment buffer {systems.SewagePercent}%\n{Ship.WasteTreatment:N0} L/day normal treatment", + 5 => ($"Treatment buffer {systems.SewagePercent}%\n{Ship.WasteTreatment:N0} L/day normal treatment", systems.TreatmentBoost ? "Extra treatment running" : $"Boost treatment · {Money(systems.TreatmentCost)}", - !systems.TreatmentBoost && systems.CanSpend(systems.TreatmentCost)) + !systems.TreatmentBoost && systems.CanSpend(systems.TreatmentCost)), + _ => ($"{systems.LaundryCapacity:N0} loads/day capacity · {systems.LaundryDemand:N0} requested\n{systems.LaundryBacklog:N0} loads waiting · Freshwater {systems.WaterPercent}%", + systems.LaundryBoost ? "Extra wash shift running" : $"Staff extra wash shift · {Money(systems.LaundryShiftCost)}", + systems.CanExtendLaundry) }; SetServiceText(serviceReadout, reading); if (serviceAction.text != action) @@ -118,6 +121,7 @@ namespace Soundings case 3: livePassage.ServiceMachinery(); break; case 4: livePassage.RunBoostPumps(); break; case 5: livePassage.BoostTreatment(); break; + case 6: livePassage.ExtendLaundry(); break; } UpdateServiceNavigation(); } diff --git a/Assets/Soundings/Runtime/ServiceDeckModel.cs b/Assets/Soundings/Runtime/ServiceDeckModel.cs index a5a9a84..59c687e 100644 --- a/Assets/Soundings/Runtime/ServiceDeckModel.cs +++ b/Assets/Soundings/Runtime/ServiceDeckModel.cs @@ -5,8 +5,8 @@ namespace Soundings { internal sealed class ServiceDeckModel { - public static readonly string[] Areas = { "Engine room", "Galley", "Stores", "Maintenance", "Water plant", "Sewage treatment" }; - private static readonly string[] StationLabels = { "MACHINERY CONTROL", "MAIN GALLEY", "PROVISION STORES", "TECHNICAL WORKSHOP", "FRESH WATER", "WASTEWATER TREATMENT" }; + public static readonly string[] Areas = { "Engine room", "Galley", "Stores", "Maintenance", "Water plant", "Sewage treatment", "Laundry" }; + private static readonly string[] StationLabels = { "MACHINERY CONTROL", "MAIN GALLEY", "PROVISION STORES", "TECHNICAL WORKSHOP", "FRESH WATER", "WASTEWATER TREATMENT", "LAUNDRY & LINEN" }; private const int Wall = 0xB9C1BB, WallBase = 0x718589, Rib = 0x596F75, Floor = 0x344A50, RoomFloor = 0x505B56, Grating = 0x87989A, Ceiling = 0x869692, Dark = 0x243539, White = 0xE0DED0, Steel = 0x9AAEB0, SteelDark = 0x526C70, Rubber = 0x263738, @@ -26,7 +26,7 @@ namespace Soundings public ServiceDeckModel(Transform parent, float length, float beam, Shader fallbackSurface) { - span = length * .68f; + span = length * .79f; halfWidth = Mathf.Clamp(beam * .72f, 4.75f, 7.1f); bayLength = span / Areas.Length; doorway = Mathf.Min(3.15f, bayLength * .56f); @@ -130,7 +130,7 @@ namespace Soundings float z = halfWidth - 1.13f; float workSpan = Mathf.Min(bayLength - .90f, 7f); - stations.Add(new ShipStation((StationKind)((int)StationKind.Engine + area), + stations.Add(new ShipStation(area == 6 ? StationKind.Laundry : (StationKind)((int)StationKind.Engine + area), new Vector3(x, 1.51f, Mathf.Min(2.64f, z - .95f)))); switch (area) { @@ -140,9 +140,42 @@ namespace Soundings case 3: Workshop(x, z, workSpan); break; case 4: Plant(x, z, workSpan, true); break; case 5: Plant(x, z, workSpan, false); break; + case 6: Laundry(x, z, workSpan); break; } } + private void Laundry(float x, float z, float span) + { + float width = Mathf.Min(.98f, span * .22f); + for (int i = 0; i < 4; i++) + { + float washerX = x + (i - 1.5f) * (width + .094f); + float washerZ = z + .16f; + Box(SteelDark, washerX, .71f, washerZ, width, 1.42f, .99f, true); + Box(Steel, washerX, .79f, washerZ - .501f, width - .04f, 1.20f, .032f); + float drum = Mathf.Min(.34f, width * .38f); + var face = new Vector3(washerX, .90f, washerZ - .52f); + Pipe(Dark, face, face - Vector3.forward * .081f, drum, 28); + Pipe(SteelDark, face - Vector3.forward * .081f, face - Vector3.forward * .094f, drum * .81f, 28); + Pipe(Monitor, face - Vector3.forward * .094f, face - Vector3.forward * .102f, drum * .66f, 28); + Box(Dark, washerX, 1.29f, washerZ - .522f, width * .62f, .15f, .038f); + Box(EmergencyLight, washerX - width * .17f, 1.29f, washerZ - .546f, .069f, .044f, .014f); + Box(White, washerX + width * .11f, 1.29f, washerZ - .546f, .16f, .023f, .014f); + } + Counter(SteelDark, x, -z, span * .58f, .84f); + for (int stack = 0; stack < 4; stack++) + { + float linenX = x + (stack - 1.5f) * span * .126f; + for (int layer = 0; layer < 4 + stack % 2; layer++) + Box(layer % 2 == 0 ? White : 0xC0D0BE, linenX, 1.003f + layer * .042f, -z - .06f, + .46f - layer * .015f, .046f, .36f - layer * .01f); + } + Box(SteelDark, x, 2.49f, z, span * .78f, .22f, .22f); + for (int tap = -1; tap <= 1; tap += 2) + Pipe(Water, new Vector3(x + tap * span * .28f, 2.38f, z), + new Vector3(x + tap * span * .28f, 1.41f, z), .061f, 12); + } + private void Machinery(float x, float z, float span) { float engineLength = span * .63f; diff --git a/Assets/Soundings/Runtime/SoundingsApp.cs b/Assets/Soundings/Runtime/SoundingsApp.cs index e030836..058dc4e 100644 --- a/Assets/Soundings/Runtime/SoundingsApp.cs +++ b/Assets/Soundings/Runtime/SoundingsApp.cs @@ -7,12 +7,15 @@ namespace Soundings public sealed partial class SoundingsApp : MonoBehaviour { private const string SaveKey = "soundings.company.v1"; - private static readonly int[] HotbarPages = { 0, 3, 1, 2, 4 }; - private static readonly string[] HotbarNames = { "Harbor", "Chart", "Deck plans", "Shipyard", "Logbook" }; + private const string GameTitle = "Big Ship Tycoon"; + private const int CrewOfficePage = 5; + private static readonly int[] HotbarPages = { 0, 3, 1, 2, 4, CrewOfficePage }; + private static readonly string[] HotbarNames = { "Harbor", "Chart", "Deck plans", "Shipyard", "Logbook", "Crew office" }; private static FontDefinition interfaceFont; private Company company; private Harbor harbor; private PassageAudio passageAudio; + private DeckAmbience deckAmbience; private PanelSettings panel; private VisualElement root; private Font displayFont; @@ -24,14 +27,14 @@ namespace Soundings private string shipName = "Peregrine"; private string notice; private bool warning; - private bool autoSmoke; + private bool autoSmoke, brandingPreview; private Ship Ship => company?.ActiveShip; private bool HarborOnScreen => underway != null || page <= 2; [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] private static void Boot() { - var game = new GameObject("Soundings"); + var game = new GameObject(GameTitle); game.AddComponent().Initialize(); } @@ -47,9 +50,11 @@ namespace Soundings harbor.Initialize(); passageAudio = gameObject.AddComponent(); passageAudio.Initialize(); + deckAmbience = gameObject.AddComponent(); + deckAmbience.Initialize(harbor); displayFont = Resources.Load("Display"); interfaceFont = FontDefinition.FromFont(Resources.Load("Interface")); - titleArt = Resources.Load("Art/FlagshipTitle"); + titleArt = Resources.Load("Art/BigShipTycoonTitle") ?? Resources.Load("Art/FlagshipTitle"); panel = ScriptableObject.CreateInstance(); panel.scaleMode = PanelScaleMode.ScaleWithScreenSize; panel.referenceResolution = new Vector2Int(1440, 810); @@ -61,7 +66,7 @@ namespace Soundings root = document.rootVisualElement; root.style.flexGrow = 1; root.style.unityFontDefinition = interfaceFont; - foreach (string sheet in new[] { "Soundings", "Shipwork", "Ledger", "FirstVoyageGuide", "Passage", "ServiceControls", "FleetOverview", "Careers", "ShoreExcursions" }) + foreach (string sheet in new[] { "Soundings", "Shipwork", "Ledger", "FirstVoyageGuide", "Passage", "ServiceControls", "FleetOverview", "Careers", "ShoreExcursions", "CrewOffice" }) { StyleSheet stylesheet = Resources.Load(sheet); if (stylesheet != null) @@ -187,6 +192,8 @@ namespace Soundings DrawShell(); if (ShorePlanningOpen) DrawShorePlanning(root); + else if (crewManifestOpen && !paused && !fleetOpen && underway != null) + DrawCrewManifest(root); if (paused) DrawPause(); } @@ -207,6 +214,8 @@ namespace Soundings pickingMode = PickingMode.Ignore }; artwork.AddToClassList("title-picture"); + if (brandingPreview) + artwork.style.left = 0; screen.Add(artwork); Shade(screen, false, (0f, new Color32(9, 16, 22, 253)), (.24f, new Color32(9, 16, 22, 249)), (.35f, new Color32(9, 16, 22, 205)), @@ -215,10 +224,14 @@ namespace Soundings (1f, new Color32(6, 12, 18, 143))); var intro = Add(screen, "title-menu"); + if (brandingPreview) + intro.AddToClassList("title-thumbnail"); var crest = Add(intro, "title-crest"); GameIcon(crest, "compass"); AddText(crest, "Cruise line simulator", "eyebrow title-kicker"); - AddDisplay(intro, "Soundings", "title-wordmark"); + DrawTitleWordmark(intro); + if (brandingPreview) + return; if (pendingStart.HasValue) { @@ -303,6 +316,7 @@ namespace Soundings case 2: DrawShipyard(scene); break; case 3: DrawPorts(scene); break; case 4: DrawFinance(scene); break; + case CrewOfficePage: DrawCrewOffice(scene); break; } } @@ -314,7 +328,7 @@ namespace Soundings menu.tooltip = "Pause menu (Esc)"; GameIcon(menu, "menu"); hudLeft.Add(menu); - AddDisplay(hudLeft, "Soundings", "hud-brand"); + AddDisplay(hudLeft, GameTitle, "hud-brand"); var instruments = Add(hud, "hud-instruments"); fleetDayReadout = HeadMetric(instruments, "Day", company.Day.ToString("00")); @@ -383,6 +397,7 @@ namespace Soundings OpenVoyageChart, "primary helm-command", "plan-voyage"); GameIcon(plan, "chart"); commands.Add(plan); + commands.Add(Action("Crew office", () => ChangePage(CrewOfficePage), "harbor-crew-link", "harbor-crew-office")); var camera = Add(commands, "camera-legend"); AddText(camera, "Drag to orbit / Scroll to zoom / Middle-drag to pan", "camera-copy"); Button reset = Action("Reset", () => harbor.ResetView(), "camera-reset", "reset-camera"); @@ -399,7 +414,7 @@ namespace Soundings int target = HotbarPages[i]; Button nav = Action("", () => ChangePage(target), page == target ? "game-tool selected" : "game-tool", "nav-" + target); nav.tooltip = $"{HotbarNames[i]} ({i + 1})"; - GameIcon(nav, target switch { 0 => "anchor", 1 => "decks", 2 => "yard", 3 => "chart", _ => "log" }); + GameIcon(nav, target switch { 0 => "anchor", 1 => "decks", 2 => "yard", 3 => "chart", CrewOfficePage => "crew", _ => "log" }); AddText(nav, HotbarNames[i], "game-tool-name"); AddText(nav, (i + 1).ToString(), "game-key"); tools.Add(nav); diff --git a/Assets/Soundings/Runtime/StationInteractions.cs b/Assets/Soundings/Runtime/StationInteractions.cs index ec23602..574d271 100644 --- a/Assets/Soundings/Runtime/StationInteractions.cs +++ b/Assets/Soundings/Runtime/StationInteractions.cs @@ -66,9 +66,9 @@ namespace Soundings bool worked = livePassage.TryWorkStation(station, out string result); if (worked) AnnounceStation(station); - if (worked && station >= StationKind.Engine && station <= StationKind.Waste) + if (worked && (station is >= StationKind.Engine and <= StationKind.Waste or StationKind.Laundry)) { - int area = (int)station - (int)StationKind.Engine; + int area = station == StationKind.Laundry ? 6 : (int)station - (int)StationKind.Engine; if (area != passageServiceArea) { passageServiceArea = area; @@ -109,7 +109,7 @@ namespace Soundings private string StationDeck(StationKind station) { - if (station <= StationKind.Waste) + if (station <= StationKind.Waste || station == StationKind.Laundry) return "Service deck"; (Facility room, Facility expansion, Facility premium) = station switch diff --git a/Assets/Soundings/Runtime/TycoonWordmark.cs b/Assets/Soundings/Runtime/TycoonWordmark.cs new file mode 100644 index 0000000..0cb309e --- /dev/null +++ b/Assets/Soundings/Runtime/TycoonWordmark.cs @@ -0,0 +1,73 @@ +using UnityEngine; +using UnityEngine.UIElements; + +namespace Soundings +{ + public sealed partial class SoundingsApp + { + private void DrawTitleWordmark(VisualElement intro) + { + var mark = Add(intro, "title-wordmark"); + var line = Add(mark, "title-wordmark-line"); + AddDisplay(line, "BIG SHI", "title-wordmark-lead"); + var letter = Add(line, "title-overpaint"); + AddDisplay(letter, "T", "title-wordmark-lead title-underpaint"); + var paint = Add(letter, "title-spray-letter"); + paint.pickingMode = PickingMode.Ignore; + paint.generateVisualContent += DrawSprayPaint; + AddDisplay(mark, "TYCOON", "title-wordmark-main"); + } + + private static void DrawSprayPaint(MeshGenerationContext context) + { + Rect area = context.visualElement.contentRect; + float scale = Mathf.Min(area.width / 63, area.height / 82); + if (scale <= 0) + return; + Vector2 Point(float x, float y) => new Vector2(x, y) * scale; + Painter2D pen = context.painter2D; + pen.lineCap = LineCap.Round; + pen.lineJoin = LineJoin.Round; + + void Stroke(float width, Color32 tone) + { + pen.strokeColor = tone; + pen.lineWidth = width * scale; + pen.BeginPath(); + pen.MoveTo(Point(17, 70)); + pen.LineTo(Point(25, 46)); + pen.LineTo(Point(29, 17)); + pen.LineTo(Point(42, 13)); + pen.BezierCurveTo(Point(58, 12), Point(63, 32), Point(49, 37)); + pen.LineTo(Point(25, 43)); + pen.Stroke(); + } + + Stroke(16, new Color32(245, 88, 48, 34)); + Stroke(12, new Color32(250, 98, 58, 110)); + Stroke(8, new Color32(248, 109, 68, 248)); + pen.lineWidth = 2.2f * scale; + pen.BeginPath(); + pen.MoveTo(Point(19, 62)); + pen.LineTo(Point(16, 76)); + pen.MoveTo(Point(51, 35)); + pen.LineTo(Point(50, 48)); + pen.Stroke(); + + var spray = new System.Random(517); + for (int i = 0; i < 67; i++) + { + float along = (float)spray.NextDouble(); + bool stem = i < 38; + float x = stem ? Mathf.Lerp(17, 31, along) : Mathf.Lerp(26, 57, along); + float y = stem ? Mathf.Lerp(70, 16, along) : 25 - 12 * Mathf.Sin(along * Mathf.PI); + x += (float)spray.NextDouble() * 19 - 9.5f; + y += (float)spray.NextDouble() * 13 - 6.5f; + pen.fillColor = new Color32(252, 112, 75, (byte)spray.Next(27, 174)); + pen.BeginPath(); + pen.Arc(Point(x, y), (float)(.24 + spray.NextDouble() * .46) * scale, 0, 360); + pen.Fill(); + } + } + } +} diff --git a/Assets/Soundings/Runtime/TycoonWordmark.cs.meta b/Assets/Soundings/Runtime/TycoonWordmark.cs.meta new file mode 100644 index 0000000..d17ddfe --- /dev/null +++ b/Assets/Soundings/Runtime/TycoonWordmark.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9e47fc0dae83c5566adfbe2b53b2dd7a \ No newline at end of file diff --git a/Assets/Soundings/Runtime/VesselExterior.cs b/Assets/Soundings/Runtime/VesselExterior.cs index 96fe071..7156713 100644 --- a/Assets/Soundings/Runtime/VesselExterior.cs +++ b/Assets/Soundings/Runtime/VesselExterior.cs @@ -3,7 +3,7 @@ using UnityEngine; namespace Soundings { - internal sealed class VesselExterior + internal sealed partial class VesselExterior { internal const float DeckBase = 5.38f, DeckSpacing = 2.62f; internal const float PoolHalfLength = 2.61f, PoolHalfWidth = 1.43f, PoolWaterHeight = .24f; @@ -68,6 +68,7 @@ namespace Soundings for (int side = -1; side <= 1; side += 2) { + BuildHullFittings(side); int portholes = 25 + ship.HullIndex * 7; for (int i = 0; i < portholes; i++) { @@ -336,8 +337,11 @@ namespace Soundings { float pool = plan.PoolCenter; if (plan.HasPool) + { PoolBasin(Coat(Paint.Pearl), Coat(Paint.BlueGlass), Coat(Paint.Pool), new Vector3(pool, top, 0), plan.PoolHalfSize, .37f, PoolWaterHeight); + BuildPoolDeckFittings(plan, top); + } for (int side = -1; side <= 1; side += 2) { @@ -404,15 +408,18 @@ namespace Soundings float radius = Mathf.Min(.31f, halfSize.y * .45f); const float surround = .23f; Vector2[] inner = RoundedRectangle(center, halfSize.x, halfSize.y, radius); + Vector2[] edging = RoundedRectangle(center, halfSize.x + .036f, halfSize.y + .036f, radius + .036f); Vector2[] outer = RoundedRectangle(center, halfSize.x + surround, halfSize.y + surround, radius + surround); float rim = foot.y + rimHeight; float surface = foot.y + waterHeight; coping.Loft(outer, center, false, new Vector3(1f, foot.y, 1f), new Vector3(1f, rim, 1f)); - water.Loft(inner, center, true, new Vector3(1f, surface, 1f)); + water.WaterSurface(inner, center, surface, halfSize); for (int i = 0; i < outer.Length; i++) { int next = (i + 1) % outer.Length; coping.Quad(HarborMesh.Point(outer[next], rim), HarborMesh.Point(outer[i], rim), + HarborMesh.Point(edging[i], rim), HarborMesh.Point(edging[next], rim)); + tile.Quad(HarborMesh.Point(edging[next], rim), HarborMesh.Point(edging[i], rim), HarborMesh.Point(inner[i], rim), HarborMesh.Point(inner[next], rim)); tile.Quad(HarborMesh.Point(inner[i], surface), HarborMesh.Point(inner[next], surface), HarborMesh.Point(inner[next], rim), HarborMesh.Point(inner[i], rim)); @@ -631,7 +638,7 @@ namespace Soundings private static Vector2[] RoundedRectangle(Vector2 center, float halfLength, float halfWidth, float radius) { - const int cornerPoints = 5; + const int cornerPoints = 8; var contour = new Vector2[4 * cornerPoints]; for (int corner = 0; corner < 4; corner++) { diff --git a/Assets/Soundings/Runtime/VesselFittings.cs b/Assets/Soundings/Runtime/VesselFittings.cs new file mode 100644 index 0000000..f80dac3 --- /dev/null +++ b/Assets/Soundings/Runtime/VesselFittings.cs @@ -0,0 +1,91 @@ +using UnityEngine; + +namespace Soundings +{ + internal sealed partial class VesselExterior + { + private void BuildHullFittings(int side) + { + // The bow marks are painted on the changing cross-section just above the waterline. + for (int mark = 0; mark < 6; mark++) + { + float y = .51f + mark * .247f; + var (at, along, outward) = SideFrame(.895f, y, length * 1.001f, + beam * Mathf.Lerp(.977f, 1f, mark / 5f), 0, side, HullStations); + at += outward * .038f; + SidePanel(Coat(Paint.Pearl), at, along, side, mark % 3 == 0 ? .32f : .18f, .046f); + if (mark % 3 == 0) + SidePanel(Coat(Paint.Pearl), at + Vector3.up * .047f - along * .136f, along, side, .047f, .116f); + } + + for (int position = 0; position < 2; position++) + { + float station = position == 0 ? .113f : .835f; + var (at, along, outward) = SideFrame(station, 4.52f, length * 1.010f, beam * 1.029f, + 0, side, HullStations); + Coat(Paint.Steel).Disc(at + outward * .046f, along * (side * .47f), Vector3.up * .21f, 12); + Coat(Paint.Black).Disc(at + outward * .054f, along * (side * .367f), Vector3.up * .136f, 12); + Coat(Paint.Steel).Rod(at + outward * .062f + along * .085f - Vector3.up * .121f, + at + outward * .062f + along * .085f + Vector3.up * .120f, .042f, 8, true); + } + + // Frames and a cabling run break up the flush embarkation hatch. + var (door, hinge, face) = SideFrame(.56f, 3.22f, length * 1.004f, beam * 1.016f, 0, side, HullStations); + Vector3 center = door + face * .046f; + SidePanel(Coat(Paint.Steel), center + Vector3.up * .718f, hinge, side, 2.08f, .034f); + SidePanel(Coat(Paint.Steel), center - Vector3.up * .724f, hinge, side, 2.08f, .034f); + for (int edge = -1; edge <= 1; edge += 2) + { + Vector3 jamb = center + hinge * (edge * 1.032f); + SidePanel(Coat(Paint.Steel), jamb, hinge, side, .035f, 1.44f); + SidePanel(Coat(Paint.Gold), jamb + hinge * (edge * .15f) + Vector3.up * .55f, hinge, side, .106f, .17f); + } + } + + private void BuildPoolDeckFittings(SunDeckLayout plan, float floor) + { + for (int side = -1; side <= 1; side += 2) + { + float drainZ = side * (plan.PoolHalfSize.y + .36f); + float strip = plan.PoolHalfSize.x * 1.92f; + var center = new Vector3(plan.PoolCenter, floor, drainZ); + Coat(Paint.Steel).Box(center + Vector3.up * .017f, new Vector3(strip, .033f, .116f)); + Coat(Paint.Black).Box(center + Vector3.up * .031f, new Vector3(strip - .033f, .014f, .072f)); + int slats = Mathf.CeilToInt(strip / .16f); + for (int i = 0; i < slats; i++) + { + float x = (i + .5f) * strip / slats - strip * .5f; + Coat(Paint.Steel).Box(center + new Vector3(x, .045f, 0), new Vector3(.027f, .017f, .091f)); + } + + // Fit the storage against the pool end and out of the walking lane along the rail. + float cabinetZ = side * plan.HalfBeam * .48f; + var basePoint = new Vector3(plan.PoolCenter - plan.PoolHalfSize.x - 1.42f, floor, cabinetZ); + Coat(Paint.Navy).Box(basePoint + Vector3.up * .48f, new Vector3(.95f, .96f, .55f)); + Coat(Paint.Teak).Box(basePoint + Vector3.up * .978f, new Vector3(1.04f, .054f, .61f)); + Coat(Paint.Steel).Box(basePoint + new Vector3(0, .45f, side * .284f), new Vector3(.31f, .032f, .036f)); + for (int towel = 0; towel < 3; towel++) + { + Vector3 end = basePoint + new Vector3(towel * .239f - .238f, 1.053f, -.14f); + Coat(towel == 1 ? Paint.DeckCanvas : Paint.Pearl).Rod(end, end + Vector3.forward * .29f, .062f, 10, true); + } + var buoy = basePoint + new Vector3(.604f, 1.15f, 0); + Coat(Paint.Steel).Rod(buoy - Vector3.up * 1.15f, buoy + Vector3.up * .21f, .035f, 8, true); + BuildLifebuoy(buoy, .214f); + } + } + + private void BuildLifebuoy(Vector3 center, float radius) + { + const int segments = 16; + for (int i = 0; i < segments; i++) + { + float angle = i * Mathf.PI * 2 / segments; + float next = (i + 1) * Mathf.PI * 2 / segments; + Vector3 a = center + new Vector3(Mathf.Cos(angle), Mathf.Sin(angle), 0) * radius; + Vector3 b = center + new Vector3(Mathf.Cos(next), Mathf.Sin(next), 0) * radius; + Coat(i % 4 == 0 ? Paint.Pearl : Paint.Lifeboat).Rod(a, b, .053f, 8); + } + } + } +} diff --git a/Assets/Soundings/Runtime/VesselFittings.cs.meta b/Assets/Soundings/Runtime/VesselFittings.cs.meta new file mode 100644 index 0000000..4afe2e2 --- /dev/null +++ b/Assets/Soundings/Runtime/VesselFittings.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4ba760a75f0b4d5e9fd7b62563c286e4 diff --git a/Assets/Soundings/Runtime/VisualSmoke.cs b/Assets/Soundings/Runtime/VisualSmoke.cs index cd0d87b..80e47d1 100644 --- a/Assets/Soundings/Runtime/VisualSmoke.cs +++ b/Assets/Soundings/Runtime/VisualSmoke.cs @@ -31,6 +31,13 @@ namespace Soundings Vector2[] pacific = MapPaths(new[] { 15, 16 })[0]; if (!CheckSmoke(Mathf.Abs(pacific[MapSamples].x - pacific[0].x) < 45, "Voyage map wraps the date line")) yield break; + if (!CheckSmoke(deckAmbience.Ready && titleArt != null && titleArt.name == "BigShipTycoonTitle", "New title art and all deck ambience loops are loaded")) + yield break; + brandingPreview = true; + Render(); + yield return CaptureSmoke(directory, "00-big-ship-tycoon-thumbnail"); + brandingPreview = false; + Render(); yield return CaptureSmoke(directory, "01-title"); if (!CheckSmoke(guidedCareer, "The guide is on by default") @@ -39,12 +46,16 @@ namespace Soundings || !CheckSmoke(Ship?.Name == "MV Meridian" && guideContext == GuideStep.SetCourse, "Guided used start")) yield break; yield return CaptureSmoke(directory, "02-harbor"); + yield return new WaitForSecondsRealtime(.45f); float harborOverview = harbor.OrbitVerticalSpan; + float farDeckFocus = deckAmbience.Focus; Vector3 harborCenter = harbor.OrbitTarget; harbor.Zoom(-90, new Vector2(.56f, .54f)); yield return new WaitForSecondsRealtime(.65f); if (!CheckSmoke(harbor.OrbitVerticalSpan < harborOverview * .22f && harbor.OrbitCameraIsClear - && Vector3.Distance(harborCenter, harbor.OrbitTarget) > 2f, "Harbor wheel reaches close inspection and follows the pointer")) + && Vector3.Distance(harborCenter, harbor.OrbitTarget) > 2f, "Harbor wheel reaches close inspection and follows the pointer") + || !CheckSmoke(deckAmbience.Focus > farDeckFocus + .35f && deckAmbience.Level(DeckSound.Deck) > .05f, + $"Zooming in brings up local deck audio ({farDeckFocus:F2} to {deckAmbience.Focus:F2}, deck {deckAmbience.Level(DeckSound.Deck):F2})")) yield break; harbor.Zoom(90); yield return new WaitForSecondsRealtime(.65f); @@ -56,6 +67,16 @@ namespace Soundings yield return new WaitForSecondsRealtime(.55f); yield return CaptureSmoke(directory, "02a-harbor-close-up"); harbor.ResetView(true); + int laundry = Ship.CrewCount(CrewRole.Laundry), treasury = company.Cash; + int recruitment = CrewMarket.HireFee(Ship, CrewRole.Laundry), dailyPayroll = Ship.DailyPayroll; + if (!SubmitSmoke("harbor-crew-office") || !SubmitSmoke($"crew-hire-{(int)CrewRole.Laundry}") + || !CheckSmoke(page == CrewOfficePage && Ship.CrewCount(CrewRole.Laundry) == laundry + 1 + && company.Cash == treasury - recruitment && Ship.DailyPayroll > dailyPayroll, + "Recruiting crew at the office spends cash and adds to voyage payroll")) + yield break; + yield return CaptureSmoke(directory, "02b-crew-office"); + if (!SubmitSmoke("nav-0")) + yield break; if (!SubmitSmoke("plan-voyage") || !CheckSmoke(page == 3 && destination == 1 && guideContext == GuideStep.Fare, "Set course and fare guide")) yield break; yield return CaptureSmoke(directory, "03-passage-chart"); @@ -79,7 +100,8 @@ namespace Soundings yield break; if (!SubmitSmoke("dispatch") || !CheckSmoke(underway != null && livePassage != null && Ship.Port == 0 && company.Voyages == 0 && PassageDuration(underway) >= 175 && livePassage.Assisted && underway.Weather == WeatherCondition.Calm - && underway.Plan?.FoodUnits == 1120 && underway.Plan.Program == EntertainmentProgram.LiveMusic, + && underway.Plan?.FoodUnits == 1120 && underway.Plan.Program == EntertainmentProgram.LiveMusic + && underway.Crew == Ship.DailyPayroll * underway.Days && livePassage.AssignedCrew(CrewRole.Laundry) == laundry + 1, "Cast off into an assisted live crossing")) yield break; if (!CheckSmoke(harbor.PortCinematicActive && Harbor.PortCinematicDuration < 5 @@ -237,6 +259,20 @@ namespace Soundings || !CheckSmoke(livePassage.GalleyBoost, "Extend galley service")) yield break; yield return CaptureSmoke(directory, "06c-galley"); + yield return new WaitForSecondsRealtime(.65f); + if (!CheckSmoke(deckAmbience.Level(DeckSound.Galley) > .04f, "The galley has its own local audio") + || !SubmitSmoke("service-area-6") || !CheckSmoke(passageServiceArea == 6 && harbor.FirstPersonPositionIsClear + && livePassage.LaundryCapacity > 0, "Explore the crewed laundry")) + yield break; + yield return new WaitForSecondsRealtime(.7f); + if (!CheckSmoke(deckAmbience.Level(DeckSound.Laundry) > .04f && deckAmbience.Level(DeckSound.Laundry) > deckAmbience.Level(DeckSound.Galley), + "Walking into the laundry changes the local mix") + || !SubmitSmoke("service-operate") || !CheckSmoke(livePassage.LaundryBoost, "Run an extra laundry shift at sea")) + yield break; + yield return CaptureSmoke(directory, "06d-laundry"); + if (!SubmitSmoke("passage-crew-manifest") || !CheckSmoke(root.Q("crew-manifest") != null, + "Review the signed roster and laundry load while underway") || !SubmitSmoke("crew-manifest-close")) + yield break; if (!SubmitSmoke("service-area-2") || !CheckSmoke(passageServiceArea == 2, "Inspect stores") || !SubmitSmoke("service-area-3") || !SubmitSmoke("service-operate") || !CheckSmoke(livePassage.RepairCredit > 0, "Service machinery") || !SubmitSmoke("service-area-4") || !SubmitSmoke("service-operate") || !CheckSmoke(livePassage.PumpsBoost, "Boost freshwater pumps") @@ -684,7 +720,7 @@ namespace Soundings "Resolve the late group and clear the next departure")) yield break; - Debug.Log($"Soundings player smoke passed at {Screen.width} × {Screen.height}."); + Debug.Log($"Big Ship Tycoon player smoke passed at {Screen.width} × {Screen.height}."); Application.Quit(0); } @@ -722,7 +758,7 @@ namespace Soundings { if (!condition) { - Debug.LogError("Soundings player smoke failed: " + label); + Debug.LogError("Big Ship Tycoon player smoke failed: " + label); Application.Quit(1); } return condition; diff --git a/Assets/Soundings/Runtime/VoyagePresentation.cs b/Assets/Soundings/Runtime/VoyagePresentation.cs index 8e536e2..0be099d 100644 --- a/Assets/Soundings/Runtime/VoyagePresentation.cs +++ b/Assets/Soundings/Runtime/VoyagePresentation.cs @@ -17,6 +17,10 @@ namespace Soundings if (root == null) return; + float delta = Time.unscaledDeltaTime; + deckAmbience.Mix(delta, !title && !paused && !fleetOpen && !voyageMapOpen && !crewManifestOpen + && !ShorePlanningOpen && careerMenu == CareerMenu.Closed && !harbor.PortCinematicActive && HarborOnScreen, + livePassage, passageAudio.CurrentAnnouncement.HasValue); if (careerMenu != CareerMenu.Closed) { if (Input.GetKeyDown(KeyCode.Escape)) @@ -25,7 +29,6 @@ namespace Soundings } AutosaveCareer(); - float delta = Time.unscaledDeltaTime; if (harbor.PortCinematicActive) { if (!paused) @@ -46,6 +49,8 @@ namespace Soundings { if (ShorePlanningOpen) CloseShorePlanning(); + else if (crewManifestOpen) + ToggleCrewManifest(); else if (!paused && fleetOpen) ToggleFleetOverview(); else if (!paused && underway != null && voyageMapOpen) @@ -65,7 +70,7 @@ namespace Soundings if (!paused && !title) { - if (!ShorePlanningOpen && !EditingText() && Input.GetKeyDown(KeyCode.F2)) + if (!ShorePlanningOpen && !crewManifestOpen && !EditingText() && Input.GetKeyDown(KeyCode.F2)) ToggleFleetOverview(); AdvanceShoreCalls(delta); UpdateBackgroundPassages(delta); @@ -111,7 +116,7 @@ namespace Soundings if (passageHelm.Manual) ReleaseHelm(); } - else if (!ShorePlanningOpen) + else if (!ShorePlanningOpen && !crewManifestOpen) rudder = ReadNavigationControls(); passageHelm.Advance(delta * passageSpeed, rudder, livePassage.SpeedFactor, underway.Weather); @@ -129,11 +134,12 @@ namespace Soundings return; } - if (!fleetOpen && !ShorePlanningOpen) + if (!fleetOpen && !ShorePlanningOpen && !crewManifestOpen) UpdatePassageView(delta); UpdatePassageUi(progress); UpdateServiceNavigation(); + RefreshCrewManifest(); UpdateHelmControls(); UpdateStationInteractions(); UpdateAnnouncement(); diff --git a/Assets/WebGLTemplates/Soundings/index.html b/Assets/WebGLTemplates/Soundings/index.html index ee01075..1e1b06e 100644 --- a/Assets/WebGLTemplates/Soundings/index.html +++ b/Assets/WebGLTemplates/Soundings/index.html @@ -20,8 +20,8 @@
- -
SoundingsLoading simulator…
+ +
Big Ship TycoonLoading simulator…