Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Revenge of the vehicles..

Sign in to follow this  


So, the more than 4 wheels thing was indeed a first, so I'm pretty chuffed about that [smile]

Today I started work on the VTOL system, which is going to involve hacking flying user controled vehicles into the Source engine. Technically speaking this shouldnt be a problem, it should work like any other vehicle control wise it just wont need a huge heap of physics code attached to it.

I've got the basic classes sorted out, after a spot of copy and pasting around the place, however i'm mildly annoyed with Valve for what I see as a daft design choice.

The basic class layout for a vehical is;

Entity => CPropVehicleDriveable => CPropVehicle,IDriveableVehicle

which, on the face of it seems pretty sane, until you start wandering into the code a bit and notice that CPropVehicle is hardcoded with a CFourWheelVehicle return in its GetVehicle() function and internally it uses an instance of CFourWheelVehicle (the one returned).

Now, on the face of things this isnt such a huge problem as HL2 only ever used 4 wheel vehicles via this system, however from a modding point of view its a slight pain.

What I should really do is go in and rewrite it so that it uses a common base class and make my life easier, and I dare say at some point I'll go back and do it once it becomes a bigger problem, for now I've got CPropVehicle, CPropVehicle2 (for the 6 wheel'd truck) and CPropVehicle3 (for the flying vehicles). However this doesnt answer the question as to why the rest of the code is pretty generic and only required the class names changing to intergrate new vehicle types yet the return type and instance is hardcoded to the 4 wheel'd physics objects?

oh well, I'm sure they had a good reason and if it looked like we were going to stick with Source long term I might be bothered to shout at someone, I'll fix it tomorrow so it sane instead, probably by adding an IVehiclePhysics as the virtual base class for the physics code and maybe creating an CWheeledVehicles class to handle the common wheeled vehicle cases and just speicalise out higher up.. yeah, that seems like a plan to me.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • What is your GameDev Story?

    In 2019 we are celebrating 20 years of! Share your GameDev Story with us.

    (You must login to your account.)


Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!