User:Psycommando/wip About Source Vehicles: Difference between revisions
Psycommando (talk | contribs) mNo edit summary |
Psycommando (talk | contribs) |
||
Line 30: | Line 30: | ||
== The Buggy and Jalopy == | == The Buggy and Jalopy == | ||
[[File:Buggy.jpg]] | |||
== The Airboat == | == The Airboat == | ||
== The player entry code == | == The player entry code == |
Revision as of 00:19, 25 April 2011

As a courtesy, please do not edit this User while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.
The person who added this notice will be listed in its edit history should you wish to contact them.
About
This article will explain how the vehicles in source work, and what's the idea behind their current internal structure.
In General
All vehicles, including the airboat inherits from the same base classes:

At the end of the day, the typical source vehicle in made up of 3 parts:
- The main vehicle, inheriting from CPropVehicleDriveable
- The "Server" Vehicle, inheriting from CBaseServerVehicle
- The vehicle physics.
Prop Driveable entity
This is the main part of the vehicle, it's the entity that has the actual name of the vehicle and inherits from CPropVehicleDriveable. Like CPropAirboat.
This entity doesn't handle passengers or passengers entry, since the code the player uses to ride vehicles needs a IServerVehicle. That's why there is a member pointer on a CFourWheelsServerVehicle stored in the
Server Vehicle
This class's primary purpose is to handle passenger entry, and sound state, along with acting as a proxy between the Driveable Vehicle, and the physic vehicle. It uses data structures named operating, control, and vehicle params, to share informations between the driveable and physics classes. Its other purpose is to trigger the loading of the vehicle script data on its creation, along with the creation of the physics vehicle object.
Vehicle Physics
This class isn't an entity, it's mostly a wrapper between the driveable and server vehicle entities and the vehicle physics controller(IPhysicsVehicleController). It transmit data from the IPhysicsVehicleController object (that's in the physics dll) through the GetVehicleOperatingParams() method. It also transmit to the IPhysicsVehicleController the data in the control params(m_controls) structure. This object is responsible for loading and parsing the physics vehicle data, through the bool ParseVehicleScript( const char *pScriptName, solid_t &solid, vehicleparams_t &vehicle ) method.