Friday, December 5, 2014

Kart stuff

So, there are these karts, and some spells that go along with them. However, the default spell mechanics are not too fun. From GMOD Tower there were some kart maps already made around the racing theme since the HL2 engine supported buggies. Anyhow, I developed two modifications around this, one to manage race mechanics, and another to provide ability/kart specific mechanics.
The race modification tracks player positions, switches circuits, slows players when they drive off of the track, resets players when they fall off of the map, re-orients them to face the track, etc.
The kart modification provides some gameplay similar to that of Mario Kart, though there are some differences. Included items are: banana, fake item box, green shell, red shell, red mushroom, ghost, banana x3, green shell x3, red mushroom x3, blue shell, gold mushroom, star, and thunderbolt.

Overall it plays fairly well. Items are gained with the roll system, by passing over a box. I use a simple left/right mouse system for attacking. Alt-fire will deploy a held item (and orbit it around you or carry it behind you), and primary-fire will use the item, or send it forward. Using alt-fire on a held item will fire it backward or drop it.

The projectile mechanics involving the shells will need a little more work to smooth out their behavior. They are fired freely and allowed to think for themselves. Due to a mix of geometry (models, displacements, players, etc) in the maps, they can sometimes make random movements at times. Since they are props, I have to constantly apply velocity to them, predict bounces, and try to keep them on the ground so that they have fluid movement.

The mods use a checkpoint system to calculate racer positions, as well as projectile positions. This allows for several advantages. Players will be automatically reoriented to look toward the next checkpoint, which will always face them properly down the track. Projectiles can make decisions on which way to path (or in the case of the blue shell, can make laps around the track smoothly on their own).

For now there are two general crash mechanics, a spin-out which twirls the player around, and a blast which sends them upward into the air. It would be nice to work out another, but I'm not sure what that would be.

I am somewhat limited by what I can accomplish since SoruceMod is a server-side modification, and I can not edit many things on the client as far as actual functionality and prediction goes.

One setback, causes collision between players on the same team to not function. For now, I have disabled collision all together, as with high amounts of players it is quite annoying. I may implement my own in the future, that is less intense and more fitting for the player count.

Another issue arising from these limitations involves the reliability of projectiles protecting the karts. It is very hard to block items arriving from different angles and to have entity-entity collision when they are not client predicted. Because of this, the protection items have had their functionality changed so that they will always block attacks on the player, regardless of their physical position at time of impact. It seems to work fairly well. However I have plans to make it more realistic. Most likely I will implement something basic to test whether a block should occur with some simple rules, like probability with the orbiting shells (based on number available), or just check if the incoming projectile is behind the player if they have a trailing item.

No comments: