Pages: [1]
Author Topic: Brush vehicles  (Read 25118 times)

Cakes 35
Posts: 14520

« on: May 30, 2015, 11:34:58 PM »

You know in Counter-Strike beta 7.0 back in 2000 they added vehicles that could be driven?  It was a really hacked up drivable train but with player turning and acceleration withrudimentary physics added..

Surely there's a way to do the same in this rotatable-brush engine too in a simpler form (no physics and fixed height). Not that it'll be important to OA or anything, i'm just curious on how to do the same in id Tech 3. as i've not seen it ever and I can only ponder on the possibility.

So far i've cloned func_rotating, took out the actual rotating and made it say a message when the player touches it.  Ideally i'd want the player to lock to some 'driver seat' entity position or something and turn the player input into manipulating the rotation and velocity of the brush entity, and the player getting out of the vehicle by pressing the Use Item button again.

I'm only modifing the game module at this point, because I think it could be done in just game alone.

and right now this is all the code is, these useless bare things at the end of g_movers.c, more theories and comments than there are actual code





/*QUAKED func_vehicle (0 .5 .8)
You need to have an origin brush as part of this entity.  The center of that brush will be
the point around which it is driven.

"model2" .md3 model to also draw
"speed" maximum speed
"dmg" damage to inflict when blocked (250 default)
"color" constantLight color
"light" constantLight radius
"driverOrg" Origin of driver to place in vehicle
"pass1Org" Origin of first passenger of vehicle
"pass2Org" Origin of second passenger of vehicle
"pass3Org" Origin of third passenger of vehicle
"pass4Org" Origin of fourth passenger of vehicle

void Touch_VehicleHasPerson(gentity_t *ent, gentity_t *other, trace_t *trace ) {
if ( !other->client ) {

// do nothing.

void Touch_Vehicle(gentity_t *ent, gentity_t *other, trace_t *trace ) {
if ( !other->client ) {

// take control of the vehicle immediately

trap_SendServerCommand( -1, va("cp \"Your In An Vehicle !\""  ));

//other->ps->pm_type = PM_FREEZE; // we want the player to be still in the vehicle
ent->touch = Touch_VehicleHasPerson; // change touch to prevent hijacks.

void SP_func_vehicle (gentity_t *ent) {
if ( !ent->speed ) {
ent->speed = 100;

// set the axis of rotation
ent->s.apos.trType = TR_LINEAR;

if (!ent->damage) {
ent->damage = 250; // vehicles should smack and kill

trap_SetBrushModel( ent, ent->model );

ent->touch = Touch_Vehicle;

InitMover( ent );

VectorCopy( ent->s.origin, ent->s.pos.trBase );
VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin );
VectorCopy( ent->s.apos.trBase, ent->r.currentAngles );

trap_LinkEntity( ent );

« Last Edit: May 30, 2015, 11:46:10 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github

Cakes 24
Posts: 584

« Reply #1 on: May 31, 2015, 04:23:33 AM »

I'm sure it could be done.

Will need changes in PmoveSingle() to change the way client input is handled, though bg_pmove.c is shared by game and cgame.

Last time I sat on a func_train in OA, the view was jerky as hell, lack of prediction I presume, so to make a vehicle that is not unpleasant to drive will require work on prediction stuff (in cgame).
In the year 3000

Cakes 45
Posts: 4394

« Reply #2 on: June 01, 2015, 12:53:19 AM »

That could be very nice, for some "extra" map... although considering that, of course, vehicles would not work with any old mod.
Good luck!  Smiley

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.

Cakes 2
Posts: 402

« Reply #3 on: June 02, 2015, 04:00:42 AM »

I thought the gameplay should be left untouched in OA?

I'm good at everything but can't do anything...
In the year 3000

Cakes 49
Posts: 3775

Trickster God.

« Reply #4 on: June 02, 2015, 05:36:55 AM »

I thought the gameplay should be left untouched in OA?
This is not placed in any of the OA-related forums, but rather in one of the "general idtech3" subforums.

"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Pages: [1]
Jump to: