Incorporate AI NPC History Professor with Dialogue System, Typewriter, Voice, and Full-Stack Gemini Integration
Analytics
Summary
This issue documents the integration of a fully functional AI NPC, specialized as a History Professor, into the game. The implementation spans both frontend and backend, and includes:
- Dialogue System Integration
- Typewriter Text Effect
- Voice / Speech Synthesis
- Full-Stack Backend Integration with Gemini API for AI Responses
Work Completed
Frontend Enhancements
- Integrated
DialogueSystemfor NPC interactions. - Added typewriter effect for AI response text.
Commits (Frontend):
- Dialogue system and typewriter integration
- Voice synthesis for NPC responses
- Enhanced dialogue interaction and UI improvements
- Current commit
AI NPC History Professor
- Implemented an AI NPC system + an example sprite who is a History Professor.
- Supports user prompts, chat history, and example knowledge topics.
Commits:
Notes:
- The backend uses Flask to handle AI requests securely with environment-stored Gemini API keys.
- This is a full-stack implementation, unlike previous local or mock AI NPC interactions.
- A pull request was created for the backend to merge these changes.
Planning
Feedback
Video Demo
MCQ
What I Did Well
- Object-Oriented Logic: My high scores in Units 1 and 3 show I understand how classes are structured, how to instantiate objects, and how to call methods.
- Syntax: I’m not making basic Java writing mistakes — my errors are mostly in code tracing.
- Pacing: I’m moving through MCQs at a good speed.
ArrayList Methods
Error: I chose [2, 3, 2, 1] instead of [2, 0, 2, 1].
Key Idea:
set(index, value)→ replacesadd(index, value)→ shifts
I forgot that set(0, 2) replaces the value rather than moving it.
Loop Logic
Error: I confused i < m*n with nested loop behavior.
Key Idea: The inner loop ran n − 1 times, so total executions = [ m(n - 1) = mn - m ]
I also missed an infinite loop case: if i++ is inside an if that doesn’t run, i never changes and the loop runs forever.
Indexing & Tracing
Error: I chose the first item instead of the second.
Key Idea: Java uses zero-based indexing:
get(0)= first itemget(1)= second item
I forgot that cList.get(1) refers to the second element.