[49] Vehicles

Antorum

05/11/2025, 11:49am

503 views

The game has vehicles now! This is a feature I've wanted to experiment with for a while, and after a lot of groundwork, the first iteration is complete.

This feature pretty much entirely works around the newly introduced VehicleComponent and RiderComponent. A VehicleSystem handles mounting and dismounting, ticking vehicles and their riders, and handling other vehicle related logic. The system isn't too flexible yet, supporting only small single rider vehicles, with a limited animation set. But, it's already a lot of fun to zip around the map.

ents/motorcycle.toml id = 84 [networked] [transform] scale = 1.0 [info] name = "Old Motorcycle" description = "A slick motorcycle. It's a bit rusty, but it still runs." model_id = 378 [vehicle] is_locked = false idle_audio_clip_id = 19 move_audio_clip_id = 20 start_audio_clip_id = 21 stop_audio_clip_id = 22 is_headlight_enabled = false [interactable] interactions = ["drive", "walk-to", "examine"] additional_client_interactions = ["exit-vehicle", "headlights"]

You can even turn on and off the headlights. It's a small touch, but it really helps with immersion and makes nighttime travel feel special. I should add a horn. Not sure why I didn't do that already.

Fun technical fact - when an entity is riding a vehicle, the vehicle actually just follows the riders position and not the other way around. Then, we make you go really fast by giving you an invisible spell effect. Neato.

spell-effects/riding.toml id = 20 name = "Riding" description = "" icon_id = 0 is_db_save_disabled = true is_net_sync_disabled = true [[status_effects]] type = "modify_stat" stat = "vehicle_speed_bonus" val = 160 [[status_effects]] type = "set_flag" flag = "is_in_vehicle" val = true

I threw together a simple riding pose for now. I'll need to add support for different vehicle animations later.

Aside from that, there are still a lot of things to polish: better models, controls, some way to purchase a vehicle, and more interesting interactions with the vehicles themselves. The foundation is there though, and I'm excited to see where it goes next.

- Declan (@dooskington)