Skip to content

Commit

Permalink
Better Titanic
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrieleGiuseppini committed Jun 23, 2018
1 parent 2b06184 commit 9e90529
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 32 deletions.
Binary file modified Authoring/RMS Titanic Structure.psd
Binary file not shown.
47 changes: 29 additions & 18 deletions Data/materials.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@
"element_type": "Metal"
}
},
{
"name": "Titanium Hull",
"strength": 150,
"mass": 4600,
"stiffness": 1,
"structural_colour": "#565663",
"render_colour": "#565663",
"isHull": true,
"sound_properties": {
"element_type": "Metal"
}
},
{
"name": "Titanium",
"strength": 140,
"mass": 4500,
"stiffness": 1,
"structural_colour": "#787896",
"render_colour": "#787896",
"sound_properties": {
"element_type": "Metal"
}
},
{
"name": "Iron Hull",
"strength": 110,
Expand Down Expand Up @@ -69,24 +92,12 @@
}
},
{
"name": "Titanium Hull",
"strength": 150,
"mass": 4600,
"stiffness": 1,
"structural_colour": "#565663",
"render_colour": "#565663",
"isHull": true,
"sound_properties": {
"element_type": "Metal"
}
},
{
"name": "Titanium",
"strength": 140,
"mass": 4500,
"stiffness": 1,
"structural_colour": "#787896",
"render_colour": "#787896",
"name": "Tin",
"strength": 20,
"mass": 300,
"stiffness": 0.5,
"structural_colour": "#D0D0D0",
"render_colour": "#D0D0D0",
"sound_properties": {
"element_type": "Metal"
}
Expand Down
8 changes: 4 additions & 4 deletions GameLib/ShipBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,9 @@ Physics::Springs ShipBuilder::CreateSprings(
Material const * pointAMaterial = points.GetMaterial(springInfos[s].PointAIndex);
Material const * pointBMaterial = points.GetMaterial(springInfos[s].PointBIndex);

// We choose the spring to be as strong as its strongest point
Material const * const strongestMaterial =
pointAMaterial->Strength > pointBMaterial->Strength? pointAMaterial : pointBMaterial;
// We choose the spring to be as weak as its weakest point
Material const * const weakestMaterial =
pointAMaterial->Strength < pointBMaterial->Strength? pointAMaterial : pointBMaterial;

int characteristics = 0;

Expand All @@ -589,7 +589,7 @@ Physics::Springs ShipBuilder::CreateSprings(
springInfos[s].PointAIndex,
springInfos[s].PointBIndex,
static_cast<Springs::Characteristics>(characteristics),
strongestMaterial,
weakestMaterial,
points);

// Add spring to its endpoints
Expand Down
26 changes: 18 additions & 8 deletions ShipSandbox TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,15 @@ Prev perf (before point et al destructuring)
- RenderContext::RenderCloudsEnd: 1.69%
=================================================

- Titanic:
- Introduce weak metal
- Use it underneath funnels

- Redo perf profile (should be unchanged)

- Release

+++++++++++++++++++++++++++++++++++++++++++++++

- Technical Debt:
+ Move definition of ElementIndex et al into GameTypes.h
- Move also pinned points to a PinnedPoints class, just like Bombs
- Textures are json files, with world sizes, offset, and lighting boolean
- SEE MOLESKINE
- Then:
Expand All @@ -66,7 +65,6 @@ Prev perf (before point et al destructuring)
- Water size
- Land size
- Bombs sizes and offsets
- Move also pinned points to a PinnedPoints class, just like Bombs

- Optimizations:
- See if can avoid other IsDeleted checks, via zero'ing of coefficients
Expand Down Expand Up @@ -278,9 +276,16 @@ Prev perf (before point et al destructuring)
- Add additional buffers that might simplify electrical connectivity test, e.g. Type and VisitedGen
- Current Propagation Algo (Ship::UpdateCurrentConnectivity()):
+ create new generation seq number; if new is 0 => 1
- ElectricalElement has SetVisited(curGen), bool IsVisited(curGen)
- All of the following @ new ad-hoc update step
- If mAreElementsDirty: Visit whole electrical graph, as:
- Consider adding a new "ConductsElectricity" buffer to Springs, set to true or folse at Add() depending
on whether or not both endpoints' materials have ConductsElectricity=true
- ConductsElectricity replaces all the other useless electrical properties
- This simplifies current connectivity graph visit
- Alternative is to check at visit time whether other endpoint has a non-None attached ElectricalElement index,
but this means lots of useless cache misses for getting point's buffer content (only a small percentage of points
have an ElectricalElement attached)
- ElectricalElement has SetVisited(curGen), bool IsVisited(curGen), operating on buffers
- @Sip::Update, electrical section: if mAreElementsDirty: invoke UpdateCurrentConnectivity()
- Visit whole electrical graph, as:
- For each generator point:
- if not visited=>flood all connected ElectricalElements from here
- for each node: set to visited
Expand Down Expand Up @@ -1742,6 +1747,11 @@ IF WX:
for triangles (translated from Springs::DetroyOptions)
+ Test assert's with Debug build

+ Ships:
+ Titanic:
+ Introduce weak metal
+ Use it underneath funnels

+ Fix bug: when you reload ship when paused, no clouds & no ship are visible until resumed
+ World::Initialize():
+ Calcs connected components for each ship
Expand Down
2 changes: 1 addition & 1 deletion ShipSandbox/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ AboutDialog::AboutDialog(
//

wxStaticText * titleLabel = new wxStaticText(this, wxID_ANY, _(""));
titleLabel->SetLabelText(GetVersionInfo(VersionFormat::Long));
titleLabel->SetLabelText(GetVersionInfo(VersionFormat::LongWithDate));
titleLabel->SetFont(wxFont(wxFontInfo(14).Family(wxFONTFAMILY_MODERN)));
mainSizer->Add(titleLabel, 0, wxALIGN_CENTRE);

Expand Down
8 changes: 7 additions & 1 deletion ShipSandbox/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
enum class VersionFormat
{
Short,
Long
Long,
LongWithDate
};

inline std::string GetVersionInfo(VersionFormat versionFormat)
Expand All @@ -30,6 +31,11 @@ inline std::string GetVersionInfo(VersionFormat versionFormat)
return std::string("Ship Sandbox v" VERSION);
}

case VersionFormat::LongWithDate:
{
return std::string("Ship Sandbox v" VERSION " (" __DATE__ ")");
}

default:
{
assert(false);
Expand Down
Binary file modified Ships/rms_titanic_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9e90529

Please sign in to comment.