Download presentation
Presentation is loading. Please wait.
1
Mutant Monster Vortigaunt Ming Yang
2
Outline Goal: Crazy monster: vortigaunt Custom NPC Sub-system of AI NPC vortigaunt Damage system Demo
3
Goal To implement a crazy monster that attacks the player violently. To implement a custom NPC based on custom modeling.
4
Challenges The AI and NPC systems are huge. The functionalities are distributed in the class hierarchy tree. Some latent constraints are hard to find.
5
Results Convert the friendly ally monster vortigaunt into a crazy killer. Create a custom NPC npc_cube based on Zach’s modeling (why it cannot think?)
6
NPC vortigaunt Capable of range attack and melee attack, a loyal friend of the player that attacks the player’s enemy and heal the player. Set the player to be the enemy of vortigaunt is forbidden. The damage of vortigaunt’s attack to the player will be filtered.
7
Custom schedule Detect the player and trigger the attack Add modules in SelectSchedule(). Implement 2 kinds of custom schedules: SCHED_VORTIGAUNT_MELEE_ATTACK_PL AYER SCHED_VORTIGAUNT_RANGE_DODGE
8
Damage System Class CTakeDamageInfo wraps the damage info including the attacker, damage, damage force, damage position et al. Attacker generates CTakeDamageInfo objects and calls the victim’s TakeDamage() to send the damage and the victim responses it in OnTakeDamage().
9
Damage filter The damage sent to the player will be filtered in CBasePlayer::TraceAttack CBasePlayer::OnTakeDamage CHL2_Player::PassesDamageFilter CTeamplayRules will test if the attacker is teammate or ally. g_pGameRules->FPlayerCanTakeDamage CTeamplayRules::FPlayerCanTakeDamage
10
Demo Run run_mod.bat Test the npc with console commands: Npc_create npc_vortigaunt Npc_create npc_cube
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.