Chapter 9. Hitmode System

Table of Contents

Introduction
Highlights
Operation

Introduction

 

The hitmode system is responsible for detecting bullet-hits on players. You might also know it as a hitbox system. As of Jaymod 2.1.0, an entirely new hitmode architecture has been implemented. I would like to acknowledge that we continue to use contributed code from Zinx Verituse for server-side player-animation tracking.

A great deal of care, thought and testing went into this system as we feel it is one of the most important aspects of gameplay. I hope you enjoy!

 
 --Mr.Mxyzptlk, January 2007.

Highlights

antilag

Antilag has been completely overhauled and integrated allowing for all bullet-fire weapons to benefit. Prior to this, mounted weapons such as Browning and MG42 did not benefit from antilag.

multiple modes

The new architecture allows for Jaymod to support multiple hitmodes in a single release and leave it up to the server to decide which mode is best for them. As such, we have implemented backwards-compatible modes offering boxes which you are accustomed to, while at the same time permitted us to address some old weaknesses and to also offer newer, more advanced modes.

efficiency

More hitmode and more sophistication usually results in a performance penalty. This is not the case with the new architecture. We use a hierarchal system to cull as many uneeded hit-checks as possible, while also no longer requiring temporary entities from the game engine. The net savings are very significant, resulting in more pound-for-pound CPU relief in typical gameplay, even when comparing a standing-up player with 7-boxes each in real mode, to 2-boxes each in pre-2.1.0 mode.

visual debugging

Visual and data debugging support has been added which allows for testing and comparisons between different hitmodes during actual gameplay. Some of these are also useful for server admins and players seeking to learn and compare the new modes available, and we've decided to keep visual debugging enabled in releases so admins are free to experiment.

Operation

Hitboxes are controlled using cvars and are effective immediately upon changing the value.

Table 9.1. Hitmode Operation

CVARDESCRIPTION
g_hitmode(cvar)set active hitmode
g_hitmodeAntilag(cvar)set antilag history in milliseconds
g_hitmodeAntilagLerp(cvar)enable/disable antilag lerping
g_hitmodeDebug(cvar)set bitflags for hitmode debugging
g_hitmodeFat(cvar)set increased torso-box size in inches
g_hitmodeGhosting(cvar)set lifetime of hit ghosting in milliseconds
g_hitmodeReference(cvar)set reference hitmode for comparison
g_hitmodeZone(cvar)set zone for debugging