OpenArena Message Boards

id Tech 3 => cgame/game/ui => Topic started by: fromhell on May 30, 2015, 11:34:58 PM



Title: Brush vehicles
Post by: fromhell 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 (https://www.youtube.com/watch?v=q0qQNJLh_zU)?  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.

(http://leileilol.mancubus.net/crap/vtest2.jpg)


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

Code:

/*
===============================================================================

VEHICLES

===============================================================================
*/


/*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 ) {
return;
}


// do nothing.
}

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

// 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 );
}




Title: Re: Brush vehicles
Post by: andrewj 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).


Title: Re: Brush vehicles
Post by: Gig 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!  :)


Title: Re: Brush vehicles
Post by: Suicizer on June 02, 2015, 04:00:42 AM
I thought the gameplay should be left untouched in OA?


Title: Re: Brush vehicles
Post by: Neon_Knight 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.