More actions
(Blanked the page) Tags: Blanking 2017 source edit |
No edit summary Tag: 2017 source edit |
||
Line 1: | Line 1: | ||
=== The Sim and the View === | |||
The game is divided into two conceptual layers, the "sim" and the "view." The sim layer contains all objects that exist anywhere in the game, visible or not. The view is only objects close enough to the player to be visible. Both layers can be access globally under the current `GameInstance` | |||
When an object is created, it must first be created in the sim. The sim persists data and is what is stored in a save game. Generally, the sim layer does _not_ involve any Unity data (`GameObject`, `MonoBehaviour`, etc). The main object for managing the sim is `UniverseModel` | |||
<code> | |||
GameManager.Instance.Game.UniverseModel | |||
GameManager.Instance.Game.UniverseView | |||
</code> | |||
Sim objects _rougly_ mimic how Unity objects work. That is, there is a base object type `SimulationObjectModel` that represents a "blank slate" object, and then the object must be decorated with one or more `Component` classes to be able to do anything. | |||
When a view object is needed, a corresponding `SimulationObjectView` (`KerbalMonoBehaviour`) is created and populated with `Behavior`s that correspond to the sim object. View objects are unity `GameObject`s that connect the sim layer to the Unity game engine. | |||
{| class="wikitable" | |||
|+ Common Components | |||
! Sim Component Name !! View Behavior Name !! Description | |||
|- | |||
| CelestialBodyComponent || CelestialBodyBehavior || Represent stars and planets. Provides data such as atmospheric drag, gravity, ocean levels, buoyancy data, PQS data, and terrain colliders. | |||
|- | |||
| VesselComponent || VesselBehavior || Vessel (or EVA'ing kerbal) global data, such as target, aggregate mass information, etc. | |||
|- | |||
| PartComponent || PartBehavior || Data about individual parts. Fuel storage, kerbals on board, etc. Parts are normally owned by a vessel, but can be free floating (orphaned) such as debris or discard fairings/decouplers. | |||
|- | |||
| PartOwnerComponent || PartOwnerBehavior || A part owner has a 1:1 relationship with `Vessel` and is a list of parts owned (1:many) by that vessel. Data about individual parts (mass, direction, rotation, etc) is aggregated by the Owner. | |||
|- | |||
| RigidbodyComponent || RigidbodyBehavior || represents physical properties (torque, thrust, inertia, etc) of a part or vessel. Vessel rigidbodies represent averages or other aggregation (eg, moment of inertia) of all of the part rigidbodies owned by the vessel. | |||
|} |
Revision as of 10:27, 13 September 2024
The Sim and the View
The game is divided into two conceptual layers, the "sim" and the "view." The sim layer contains all objects that exist anywhere in the game, visible or not. The view is only objects close enough to the player to be visible. Both layers can be access globally under the current `GameInstance`
When an object is created, it must first be created in the sim. The sim persists data and is what is stored in a save game. Generally, the sim layer does _not_ involve any Unity data (`GameObject`, `MonoBehaviour`, etc). The main object for managing the sim is `UniverseModel`
GameManager.Instance.Game.UniverseModel
GameManager.Instance.Game.UniverseView
Sim objects _rougly_ mimic how Unity objects work. That is, there is a base object type `SimulationObjectModel` that represents a "blank slate" object, and then the object must be decorated with one or more `Component` classes to be able to do anything.
When a view object is needed, a corresponding `SimulationObjectView` (`KerbalMonoBehaviour`) is created and populated with `Behavior`s that correspond to the sim object. View objects are unity `GameObject`s that connect the sim layer to the Unity game engine.
Sim Component Name | View Behavior Name | Description |
---|---|---|
CelestialBodyComponent | CelestialBodyBehavior | Represent stars and planets. Provides data such as atmospheric drag, gravity, ocean levels, buoyancy data, PQS data, and terrain colliders. |
VesselComponent | VesselBehavior | Vessel (or EVA'ing kerbal) global data, such as target, aggregate mass information, etc. |
PartComponent | PartBehavior | Data about individual parts. Fuel storage, kerbals on board, etc. Parts are normally owned by a vessel, but can be free floating (orphaned) such as debris or discard fairings/decouplers. |
PartOwnerComponent | PartOwnerBehavior | A part owner has a 1:1 relationship with `Vessel` and is a list of parts owned (1:many) by that vessel. Data about individual parts (mass, direction, rotation, etc) is aggregated by the Owner. |
RigidbodyComponent | RigidbodyBehavior | represents physical properties (torque, thrust, inertia, etc) of a part or vessel. Vessel rigidbodies represent averages or other aggregation (eg, moment of inertia) of all of the part rigidbodies owned by the vessel. |