No announcement yet.

Interesting QC Bugs

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Yeah, you're right. I had to shuffle a few things around but now it's basically 'check melee, check ranged'.

    I trimmed the check attack system as far as i could without implementing more advanced techniques (if available, but not my current focus) or adding new fields. The dog and demon run dedicated check functions which really can't be rolled into something more generic. The scrag is off on its has almost zero things in common with other monster's check attacks. I can live with 3 classname checks for the time being. It used to be like 6 or 7, and a giant monstrous generic check attack following them. Now, there are three, and the generic check attacks are SUPER trim, maybe less than 30-40 lines that govern 8 or 9 other monsters. Some behavior is handled differently based on field inputs for individual monsters in their spawn function...these are fields already heavily in use for other ents like doors, so I didn't feel bad using them.

    I used to not give a shit about repetitive code and reference spamming. Since my focus has shifted to 'trim trim and trim some more' and field reduction, I feel that I am writing much more robust and solid code in half the normal space. What a great learning exercise.

    EDIT: example for monster behavior using pre-existing fields: In the ranged check attack function, the field .lip (previously only used for buttons and doors) is used to determine the severity of random-ness of launching an attack. This replaces the slew of 'if else if else' statements id had for almost EVERY monster. Behavior isn't identical, but it's damn close, because you can now set .lip in the monster's spawn function to closely mimic traditional behavior. I'm ok with that, cause I turned about 80 lines of code into 8. I use self.height as the maximum effective distance of a monster's ranged attack (i.e. if distance is greater than .height, don't launch the attack). The shambler was the only original monster to have a limit (600 quake units for the lightning attack). However, by transferring this check over to a field, I was able to roll his check attack into a more universal one.
    Last edited by Dutch; 10-28-2017, 05:13 AM.
    'Replacement Player Models' Project