Resource icon

koth_vehicle_example A11

Argo

L1: Registered
Apr 19, 2019
14
18
koth_vehicle_example - bsp and vmf demonstrating vehicle combat in TF2 using map logic.

Combined-arms warfare in TF2 created with map logic!


vmf and accompanying assets are shared as an open resource to be used, worked on and shared alike
(and so you can all pick this apart with better solutions that are outside of my Source knowledge because damn does this use a lot of entdata). Enjoy!

About

After Panckakebro gracefully provided insight into the workings of his arena_tankwar map, on top of discovering useful info from A Boojum Snark's Chairmania Derby thread, I essentially began my own fork to try and create a combined-arms combat experience within TF2, similar to what's seen in games like Battlefield and Halo.

Features

General

- Vehicles can be entered and exited during gameplay, some of which have multiple seats for gunners and passengers.

- Vehicles are destructible and will eject their occupants upon destruction, respawning at their team's base after 30 seconds.

- Engineers can repair friendly vehicles.

- Spies can hijack the driver's seat of enemy vehicles, kicking out existing occupants and reassigning the vehicle to their team.

- Land vehicles are able to run over enemy players. They will push friendly players out of the way.

- Ubercharged players are immune to vehicles and their weaponry.

- Players and vehicles alike are pushed away from the map boundary, rather than colliding against it.

- The spawns are set up to push away and prevent damage from enemy players and vehicles. Enemies can't move or fire in, friendlies can move and fire out.

- Light vehicles such as jeeps and helicopters will take collision damage if hitting something fast enough, whereas heavy vehicles like the tank and Anti-Air will not.

Helicopter

- The pilot can fire 8 rockets that reload automatically shortly after being depleted or the user stops firing.
- The helicopter's gunner can fire manually guided missiles!

Jet

- Jets utilise missiles that lock on to enemy players that are inside and outside of vehicles!
- An experienced pilot can land the jet should it need to be repaired.

Tank

- A single occupant toggles between driving and gunning by pressing Attack2.
- Tanks can only take damage from heavier sources such as rockets and grenades and will resist smaller arms fire.

Anti-Air

- Like the tank, a single user switches between driving and gunning with Attack2.
- Like the helicopter rockets, the AA cannons fire 8 rounds that will reload after the user stops firing or the rounds are depleted.
- The Anti-Air is naturally effective against light vehicles and aircraft, but less so against infantry, heavy vehicles and buildings.
- The AA sports the same damage resistance as the tank.

Jeep

- The jeep occupies up to 4 players; the driver, gunner and 2 passengers.
- The jeep gunner takes command of a rocket launcher that can be fired continuously!​

Known Issues and caveats.

- Do not manually restart the round after the vehicles have spawned. With the current setup, this can cause the camera view when using helicopters and jets to break.
- Vehicles spawn when the hill unlocks, which is to prevent a potential softlock/crash when being inside a vehicle when a round/pre-round ends or resets. The spawning of all the vehicles at once can potentially cause a momentary lag-spike.
- All players are kicked out of vehicles when the round reaches a conclusion, to also mitigate the aforementioned potential softlock/crash.
- Using the "kill" or "explode" commands whilst using a vehicle will render your view stuck on the vehicle's camera. Typing "retry" in the console to reestablish your session is the only way to resolve this (works when playing on a dedicated or listen server).
- Vehicles do not currently possess a self-righting mechanism or mitigations against getting stuck.
- Sometimes players will be killed when colliding with enemy vehicles even if they are not moving sufficiently fast enough.
- These vehicle setups are quite entity-heavy. This could cause performance issues for some users.
- Many of the models have hair-line cracks that I wasn't quite able to resolve when tinkering with Propper and the brushwork.
- The player's view when on a bike passenger seat may be laggy, especially when playing with a higher ping. Still trying to find a fix for this.
- Currently the jet missiles aren't damaging some vehicles properly.
About vmf/Hammer Logic

There's quite a bit of explanation required for some of the elaborate entity setups, as a lot of it is obscure bug/crash mitigation. I'll look into doing more of a write-up later on.

Additional info will be added above as I remember/discover more.

While all this is technically possible with vanilla Hammer, it was made much easier with the following tools (kudos to their respective authors. Items in bold may be required when using the vmf):

Hammer++
Ultimate Mapping Resource Pack
TF2 Spud FGD

Propper
VIDE
VTFEdit
GCFScape

Additional kudos also to those who contributed with help and info:

Panckakebro, FiCool2, A Boojum Snark, Unicake, MrBurguers, Izotope, some other fine folks who I am probably forgetting because my memory is terrible sorry.
 
Last edited:

Argo

L1: Registered
Apr 19, 2019
14
18
  • A basic health indicator has been added above vehicles.
  • Hit and Kill registration support has been added to vehicles, enabling scoring, hitsounds, dominations, assists, etc.
  • Targeting lasers have been added to the guns of ground vehicles that turn on when in use.
  • Added volumes around vehicles that will remove dropped weapons and ammo packs to prevent collision issues.
  • Instead of dying, occupants will now be ejected from their vehicles when they are destroyed. It is still possible for them to be killed along with the vehicle if they are caught in the final hit.
  • Vehicle handling has been tweaked and ground vehicles should no longer roll down slopes.
  • Sounds made when vehicles are hit by various sources have been adjusted.
  • Damage from vehicles will now impart a physics impulse against players, knocking them around.
  • Fixed a bug that could cause vehicles that were fully repaired to take massive damage on the next hit.
  • Mitigation against a potential bug that would break helicopter and jet pilot views.

Read the rest of this update entry...
 
Last edited:

Argo

L1: Registered
Apr 19, 2019
14
18
  • Added Motorbikes and Hoverbikes. These less entity-expensive vehicles accommodate 2 players and allow the passenger to shoot on the back freely, but are very light on armor. However, the passenger is immune whilst riding the bike (it's not a limitation, it's a feature!), giving the vehicle a powerful advantage. Those going against a bike will want to shoot and destroy the vehicle first!
  • Added the ability to flip overturned vehicles by using +use when the vehicle has no driver (tf_allow_player_use must be set to 1 on the server).
  • Added toggleable 3rd person cameras to the Helicopter and Jet driver seats.
  • Adjusted the physics of ground vehicles to improve handling and up-hill traverse.
  • Gave the jeep a turbo boost.
  • Adjusted the jet's movement on the ground and added a reverse thrust.
  • Adjusted colouring of most indicators.

Read the rest of this update entry...
 
Last edited:

Lonely Author

L2: Junior Member
Aug 27, 2021
87
42
This is the best, I have had loads of fun, but you can dismount from vehicles and get stuck in walls and roofs(triggering my sniper skills lol)

Can't wait to try out the bikes!
 

Argo

L1: Registered
Apr 19, 2019
14
18
  • Added a toggleable "freecam" to ground vehicles that allow the driver to look around.
  • Tweaked the 3rd person camera of aircraft to utilise the "freecam" mode.
  • Tweaked vehicle exit points to reduce the likelihood of getting stuck in terrain when exiting a vehicle. Note this may result in being "ejected" by the vehicle's pushing force.
  • Tweaked the power of the self-righting mechanism to be more reliable on some vehicles
  • Tweaked the physics of the hoverbikes. Hoverbikes will now also shut-down and land when not in use.
  • Adjusted pitch limited on AA and Tank turrets.

Read the rest of this update entry...
 
Last edited:

Argo

L1: Registered
Apr 19, 2019
14
18
  • A decay timer has been added to vehicles. If left driverless for 30 seconds, they'll begin to decay and eventually be destroyed. Entering the driver's seat beforehand will reset and disable the timer.
  • Fixed an oversight that prevented hoverbike righting from working.
  • Vehicles will now right when struck with any weapon when driverless, not just melee (this happened before anyway due to the relevant filters not working properly).
  • General tweaks and corrections.
Read the rest of this update entry...
 
Last edited:

Lonely Author

L2: Junior Member
Aug 27, 2021
87
42
hey, I believe this may have already come to your attention but bidding farewell while in a vehicle will crash the game, and sometimes when crashing the flying vehicles and sutch and then dying, your camera gets stuck in that vehicle unless one can maneuver themself to a nearby vehicle to fix it

otherwise, it's fun to play with a sibling!
 

Argo

L1: Registered
Apr 19, 2019
14
18
hey, I believe this may have already come to your attention but bidding farewell while in a vehicle will crash the game, and sometimes when crashing the flying vehicles and sutch and then dying, your camera gets stuck in that vehicle unless one can maneuver themself to a nearby vehicle to fix it

otherwise, it's fun to play with a sibling!
Hey, sorry for not replying sooner. To be completely honest I've been in a bit of demotivated state that's kept me from updating this project, which I've felt regrettable about.

It has been in the back of my mind this whole time though and I did intend to redo everything from scratch after discovering some potential improvements that'd hopefully make it more playable. I'll see if I can have another crack at this some time.
 

Lonely Author

L2: Junior Member
Aug 27, 2021
87
42
good luck!
Hey, sorry for not replying sooner. To be completely honest I've been in a bit of demotivated state that's kept me from updating this project, which I've felt regrettable about.

It has been in the back of my mind this whole time though and I did intend to redo everything from scratch after discovering some potential improvements that'd hopefully make it more playable. I'll see if I can have another crack at this some time.
 

Amicdict

L1: Registered
Jan 21, 2021
17
3
I can't help but imagine how bots would work with this vehicle system.



Anyway, this is a good concept. I loathe the lack of suspension though; I can't handle all that bumping.
 
Last edited:

Argo

L1: Registered
Apr 19, 2019
14
18
I can't help but imagine how bots would work with this vehicle system.



Anyway, this is a good concept. I loathe the lack of suspension though; I can't handle all that bumping.
I have tested setups with more complex suspension before, but they were more entity heavy and I fear it wouldn't work well (or at all) during actual gameplay.

As for bots, the moment they enter a vehicle and interface with a game_ui they just stop performing any actions lol. Because bots can be excluded from entering vehicles, they can still play alongside you as infantry.