Weekly Focus and Goals
This week, my primary focus was on the technical implementation and behavioral logic of the "Dog" character within the game's narrative sequence. The goal was to transition the character from a static asset into a functional, animated entity that interacts correctly with the story triggers in Unity.
Work Completed
Unity Integration: Successfully imported and set up the Dog character within the main game scene, ensuring all prefabs and narrative triggers are aligned.
Animation Suite: Completed the full animation set for the Dog (including:idle, walk, attack, etc.]), ensuring smooth transitions using Unity’s Animator Controller.
AI Logic Design: Drafted and implemented the core AI logic that dictates the Dog's behavior during story sequences.
Design Decisions and Rationale
Using an FSM makes the code much easier to read compared to nested if-else statements. Each state (Idle, Chasing, Attacking, Following) has clear entry and exit conditions.
Scalability: If I want to add a "Sleeping" or "Scared" state later, I can simply add it to the enum and create a new transition logic without rewriting the entire movement system.
Bug Prevention: It ensures the Dog cannot be in two conflicting states at once (e.g., it can't be "Following" the player while simultaneously "Attacking" an enemy).
Research and Precedents
Inspiration: In Blog-Week 3.
Reflection and Next Steps
What Worked: The integration between the Animator Controller and the FSM (Finite State Machine) logic was highly effective. The transition parameters (such as dogrun and dogattack) trigger accurately based on the AI's state changes, resulting in a responsive and fluid character feel.
Challenges: A significant amount of time was spent on Sprite Alignment and Pivot Point adjustment. Because the original sprite frames had inconsistent centers, the dog appeared to "jitter" or shift unnaturally during animation loops. I had to manually calibrate the pivot points for each frame to ensure the character remained grounded and physically consistent with its Rigidbody2D behavior.
Next Steps: Next week, I will shift my focus toward migrating and implementing additional narrative sequences.