djcev.com

//

Memory / Work / QuakeOneDogMode

Created , last updated . Source file.
Tags: , , .

This page is for taking notes for and tracking my work on a Quake mod. You can find the mod itself (such as it is) in this software repo. The mod in its current state is almost entirely the work of other people; you can find a credits list in the README.

Table Of Contents

TODO list

Current significant bugs:

  • camera / cutscene system needs to be refactored
  • DropStuff is currently incomplete / commented out (DropVial, DropShard, etc.)
  • Modeltrain isn't waiting on path_corners when it should (needs rework)
  • spawn_tfog & spawn_tdeath need to be reworked
  • think1 in rotate_train (and think1 in general)
  • movetarget_f code (currently in info/path_corner.qc)
  • event_lightning (in monsters/boss.qc)

In the codebase:

  • TODO immediately: rework th_pain into damage and th_die into destroy
  • TODO gibs (ThrowGib, meatspray, gore.qc, et cetera)
  • CSQC improvements (fixed tempentities [lightning], etc.)
  • Implement camera bobbing & rolling (for feature parity with Q1)
    • Improve player movement feedback in general
    • Done in CSQC; See Nuclide base/src/client/camera.qc
  • Implement Crouching
    • And crouchsliding; see Rapha's Quake Champions movement tutorial
    • And some crouch-wall-inair feature - wall sliding? wall running?
  • Improve (or implement a new) player unstick function
  • Item system rework
    • All items respawn according to DM spawntimes
    • Reduce max ammo count
  • Monster code rewrite
    • Monsters understand & can pick up items on the map
      • different monsters pick up and use different weapons
      • monsters time items?
    • New movement system for monsters (waypoints?)
      • Implement movetogoal & walkmove in Quake C
      • Study bot code: frikbot, frogbot, nexuiz, nuclide bots
  • Sounds
    • New (varied) sounds for jumping
    • Running sounds, Walking sounds (?), no crouch-moving sounds

Outside - articles, video, etc.:

  • Record a video demonstration of the new movement behavior
    • demo of SlideMove & StepSlideMove
    • demo of Quake 3 style strafejumping
    • demo of QC implementation of stepjumping / pseudo-airstepping
    • demo & explanation of doublejump and telejump
  • Write and publish an article going over the above code & changes

Naming Conventions & Style

Break lines that don't fit within 80 columns. Braces ("{}") get their own line. Always use braces for switch/case blocks, and for every member of an if / else if / else block if any member of that block has more than one line.

Use lowercase_with_underscores names for functions within the class/object hierarchy. Use upper camel case names for functions outside that structure and for functions called by the engine.

Use lowercase_with_underscores names for entity fields and local variables. Use upper camel case names for globals.

Movement

Currently implemented:

  • Quake 1-style air control (PM_AirAccelerate)
    • Active only when holding +left or +right
  • CPM/Painkiller-style +movement direction air control
    • Active only when holding +fwd or +back
  • Quake 3 strafejumping
    • Active when requesting diagonal movement while in the air, i.e. holding either forward or back and also one of the sidestep left or right keys.
  • Quake 3 wall clipping / skimming
    • 250ms window checked against the doublejump timer.
  • New slidemove based on Q1, Q3, and Nuclide.
    • Implements airsteps and Q3-like 'sticky' steps
  • Doublejumps & Stairjumps (two jumps within 400ms)
    • Now with correct ground accel behavior (done by raising wishspeed limit)
  • Teleporter jumps (doublejump through a teleporter)
  • Walljumping (based on Warsow, Xonotic, and Quake Champions Classic code)
  • Targeted trigger_push entities (Quake 3 jumppads)

Items & Weapons

Possible new armor system: a more 'metroidvania' style setup where armor upgrades set A. the maximum armor you can have and B. the absorption tier. Armor shards would then refill up to the max value set by armor upgrade. Upgrades would be: base (max 50, 1/3 absorb), Green (max 100, 1/3 absorb), Yellow (max 150, 3/5 absorb), and Red (max 200, 4/5 asborb).

Weapons. Each have their own ammo type & pool.

  1. Axe (id1 standard)
  2. Shotgun (id1 standard, modified damage & spread)
  3. Lasergun (same as the enforcer's gun)
  4. Nailgun (nails have knockback for climbing purposes)
  5. Stakegun (Painkiller; Q2 Railgun replacement)
  6. Grenade Launcher (TODO still needed?)
  7. Rocket Launcher (id1 standard)
  8. Lightning Gun (id1 standard)
  9. Camera (screenshot tool)

Ideas for additional items:

  • Rations (food? function as a health item?)

Weapon Firing Sequence

origin, velocity (direction), elevation (if grenade) function decl. starts with: fire_whatever (vector org, vector dir)

  1. Monster calculates projectile origin
  2. Monster calculates starting velocity w/o speed component
  3. Monster calls fire_someprojectile (origin arg, velocity arg)
  4. the firing function applies speed to the velocity arg
    1. normalize then multiply by proj_basespeed if present else a default speed
  5. spawn the corresponding projectile entity, passing these args
    1. owner, origin, velocity, avelocity (cust_avelocity), waitmin (?)
    2. homing, enemy, proj_basespeed, proj_speed_mod, projexpl
    3. mdl_proj, skin_proj, snd_hit

Where do sound and visual effects (MUZZLEFLASH) go?

Projectile Initialization Sequence

  1. classtype & classname
  2. movetype & solid
  3. set explosive if necessary (parse_projexpl)
  4. set health and takedamage if desired (for explosives)
  5. angles & avelocity
  6. check (and set if necessary) proj_basespeed
  7. check (and set if necessary) direct_damage and splash_damage
  8. setmodel and skin
  9. setup_homing
  10. setsize, setorigin
  11. think & nextthink (if not capable of homing)

Monsters

New monsters: bats, rats, spiders, etc. Maybe I can learn how to model for Quake? I dunno. That seems unrealistic.

Mapping

TODO table of biomes, associated maps, progression

Code Style

Indent with tabs. Curly brackets on their own line. Constants are CAPS_WITH_UNDERSCORES, functions are lowercase_with_underscores, variables are lowercase_with_underscores.

Object / Class structure

Function checklist for every object:

  • optional: void() objname_blocked
  • optional: void(entity attacker, float damage) objname_damage
    • was: th_pain
  • optional: void() objname_destroy
    • was: th_die
  • optional: void() objname_think
  • optional: void() objname_touch
  • optional: void() objname_use
  • void() objname_respawn
    • respawn chosen entity
  • entity(...) spawn_objname
    • accept a limited number of arguments, spawn objname entity, and return it
  • void() spawnfunc_objname (or just void() objname)
    • traditional spawn function

mapentity: func, haz, info, item, misc, mon, trig tempentity: proj

  • base_mapentity
    • func_base
      • func_name
    • haz_base
      • haz_name
    • info_base
      • info_base
    • item_base
      • item_name
    • mon_base
      • mon_fly
      • mon_swim
      • mon_walk
    • misc_base
      • misc_name
    • trig_base
      • trig_name
  • temp_base
    • proj_base

SUB_Think (triggers/camera) SUB_Regen (items/*)

All declared classes are a subclass of entity (that's how the compiler works).

entity interaction verbs

Q1 Nuclide FTE/DOG
blocked Blocked do_blocked
th_die do_destroy
th_pain do_damage
think think do_think
touch Touch do_touch
use Trigger do_use

Brief list:

  • base_entity [think, touch, use]
    • base_mapentity [+ destroy]
      • base_func [+ blocked]
        • see files in qc/func
      • base_item - item pickups [damage, destroy, think, touch, use]
        • base_item_ammo
        • base_item_armor
        • base_item_health
        • base_item_key
        • base_item_powerup
        • base_item_rune
        • base_item_weapon
        • item_backpack
      • base_monster [stand, walk, run, missile, melee, pain, turret]
        • player
        • base_bossmonster
          • boss (chthon)
          • boss2 (PD chthon)
          • oldone (shub)
          • oldone2 (PD shub)
        • base_flymonster
          • wizard (scrag)
        • base_swimmonster
          • fish
        • base_walkmonster
          • enforcer
          • hknight (death knight)
          • knight
          • ogre
          • soldier (grunt)
          • demon (fiend)
          • dog
          • shalrath (vore)
          • shambler
          • zombie
      • base_trigger (is_waiting)
    • base_tempentity
      • base_projectile [think, touch]
        • bullet
        • death knight missiles finished
        • flak finished
        • grenade finished
        • laser finished
        • lavaball (Chthon, Oldone2, Ogre, Shambler) finished
        • minigrenade / multigrenade finished
        • rocket finished
        • spike (nail) finished
        • voreball finished
        • wizard spell (Scrag/Wizard attack) finished
        • zombiechunk finished

Client Prediction Notes

in CSQCTest:

  • CSQC_Ent_Update -> ParsePlayer -> RefreshPlayer -> Pred_PlayerUpdated
  • deltalisten -> RefreshPlayer -> Pred_PlayerUpdated
  • self.predraw -> Player_Interpolate -> Pred_UpdateLocalMovement

Pred_PlayerUpdated is called when CSQC_Ent_Update reads player entity data
Pred_UpdateLocalMovement is called from the player's predraw function

in Dogmode:

  • PlayerPreDraw incorporates Pred_UpdateLocalMovement
  • PlayerUpdate calls PlayerUpdatePrediction (which replaces Pred_PlayerUpdated)

Bookmarks, Reference Links

Mapping

Mods

Movement References

Quake C

Vector Math

Sounds