Implementation contracts
Namespace: Rampage. Unity 6, HDRP. Units metres/seconds; forward +Z, up +Y. Shared ownership is explicit: world agent owns Runtime/World; vehicle art agent owns Runtime/Visuals; gameplay agent owns Runtime/Bike, Runtime/Combat, Runtime/AI, Runtime/Racing. Root owns application, UI, camera, input, audio, editor/build setup. Do not edit other owners' files without coordination.
World API (world agent implements)
enum Biome { Forest, Desert, City }TrackDefinition: publicstring Id, Name, Subtitle, Description; publicBiome Biome; publicColor Accent; publicVector3[] ControlPoints.TrackCatalog.All:TrackDefinition[], exactly three tracks in forest/desert/city order.TrackRuntime : MonoBehaviour: publicTrackDefinition Definition {get;};float Length {get;};float RoadWidth {get;};void Build(TrackDefinition definition, bool scenery = true).TrackSample Sample(float distance): wraps distance, centre position plus tangent/right/up.TrackSamplepublic fieldsVector3 Position, Forward, Right, Up; float Distance.float NearestDistance(Vector3 position, float hint = -1f): track projection, no player clamping.float LateralOffset(Vector3 position, float distance).- Generated root under TrackRuntime. Asphalt top collider on layer 8 (Road), other environment colliders layer 0. Bike layer 9. Road smooth continuous closed loop. Road width ~12 metres. Sample surface should match collider. Road origin start is distance zero, forward direction consistent.
MaterialLibrary.Get(string key, Color color, float metallic=0f, float smoothness=.4f): owned world agent, cached HDRP/Lit materials;Resources.Load<Texture2D>("Textures/"+key+"_color"),_normal,_maskoptional. All material keys documented by agent. Other owners may call Get.
Vehicle visual API (art agent implements)
BikeVisual : MonoBehaviour:void Build(Color livery, bool includeRider=true);void SetPose(float speedKph, float leanDegrees, float steer, float throttle, float attackSide, float attackPhase, float impact);void SetLivery(Color color).- Root local position zero is bike physics COM/reference approx road + .65 metres. Axles at z +/- .75, wheel radius .34; tyre contact local y=-.65. Hero dimensions ~2.1m long, .8m wide, rider helmet top local y1.15. Detailed own meshes/PBR materials, not cube placeholders. Wheels and separate mechanical parts animate; left/right kick via side and phase. Visual contains no colliders/Rigidbody. Parent transform owns physics. Build can be called in garage too.
Gameplay API (gameplay agent implements)
struct BikeCommand { public float Throttle, Brake, Steer; public bool Boost, AttackLeft, AttackRight; }BikeController : MonoBehaviour:public BikeCommand Command; public bool DriveEnabled, IsPlayer; public TrackRuntime Track; public BikeVisual Visual; public float SpeedKph, LeanDegrees, Boost01, Stability01, AttackSide, AttackPhase; public bool IsCrashed; public float DistanceAlongTrack;(read-only properties fine except Command, DriveEnabled, IsPlayer, Track, Visual).void Initialize(TrackRuntime track, bool isPlayer, Color livery)builds Rigidbody/collider and BikeVisual if none. Root places bike initially at sample +Up*.65.void ResetToTrack(float distance, float lateral=0f)handles safe physics reposition and protection.BikeController.Active: enumerable/list of active bikes for combat/proximity, cleans on destruction.event Action<BikeController> Crashedoptional;event Action<float> Impactoptional but inform root.BikeAI : MonoBehaviour: publicBikeController Bike; public int Difficulty; public float LaneOffset;follows Track, makes BikeCommand; never teleports to race catchup.RaceProgress: plain class withint CompletedLaps {get;},float TotalDistance {get;},bool Finished {get;}; constructor(TrackRuntime track, int targetLaps);void Update(Vector3 position);void Reset(float initialDistance=0f);float SafeDistance {get;}. Ordered track sectors/checkpoints prevent shortcut/reset exploitation; racer resets use SafeDistance. Race starts near distance 0 with grid behind start. Coordinate exact start semantics with root.
Root may adapt narrowly if required. Report any API changes before implementing consumers. All source files UTF-8. Plan in DEVELOPMENT-PLAN.md remains product target. No paid assets or other project modifications. Parallel development is allowed; Unity builds only root runs to avoid asset/database locks.