The Graduation Game Project is an interactive visual novel built with JavaScript, HTML, and CSS. It features a dynamic dialog system, branching storylines, character affinity tracking, and a rhythm mini-game. The project is designed to provide an engaging, extensible experience for players and developers alike.
- Dynamic Dialog System: Character dialogs with a typing effect and conversation log.
- Affinity System: Tracks player relationships with characters based on choices.
- Interactive Choices: Player decisions influence the storyline and character affinity.
- Audio Management: Background music and sound effects with volume and fade controls.
- Image Management: Handles character sprites, backgrounds, and image animations.
- Save and Load: Automatic progress saving and the ability to continue from the last session.
- Customizable Storylines: Easily extendable via JSON files.
- Rhythm Mini-Game: Includes a drum rhythm game as part of the story.
main.html: Main entry point of the game.style/main.css: Game UI styles.script/main.js: Game initialization and UI logic.script/lib/: Modular classes for game systems:game.js: Core game logic.dialog.js: Dialog display and log management.button.js: Interactive button handling.image.js: Character and background image management.audio.js: Audio playback and effects.util.js: Resource loading utilities.
script/custom/: Custom mini-games (e.g.,drum.jsfor the rhythm game).resources/: Game assets and configuration:mainStory.json: Storyline definitions.audio.json: Audio resource list.image.json: Image resource list.
assets/: Icons and profile images.
toggleGamePause(): Pause/resume the game.waitForResume(): Wait for the game to resume if paused.setBackgroundImage(src): Set or update the background image.setStage(bgm, background, figures): Configure the stage with music, background, and characters.waitForUser(): Wait for user interaction (click or space).setupChoices(choices): Display choice buttons.getChoice(choices): Await and return the user's choice.saveProgress(ans, line): Save current progress to local storage.playStory(ans, line, storyResources): Play a story segment.initialize(chapter, data): Initialize game state and load resources.ending(): End the game and clear progress.startloop(chapter, data): Main story loop.
createLog(text, speaker): Add a dialog log entry.showLog(): Toggle the dialog log display.readSavedLog(log): Load and display saved logs.readWords(text): Typing effect for dialog text.setText(text): Set dialog box text.setSpeaker(speaker): Set the current speaker.setAppearance(color): Set dialog text color.show() / hide(): Show or hide the dialog box.
addButton(info, text): Add a button.showButton(): Display buttons and handle selection.clearButton(name): Remove buttons.
addAudio(name, src): Add an audio element.setVolume(volume): Set global audio volume.audPlay(name, time, fade): Play audio with optional duration/fade.audStop(name, fade): Stop audio with optional fade.fadeIn(audio, duration): Fade in audio.fadeOut(audio, duration): Fade out audio.
getImg(name, src): Get or create an image element.showImg(name) / hideImg(name): Show or hide an image.setAppearance(name, { left, top, zIndex, width, height }): Set image position and size.move(name, deltaX, deltaY, time): Animate image movement.scale(name, w, h, time): Animate image scaling.skew(name, angleX, angleY, time): Animate image skew.rotate(name, angle, time): Animate image rotation.
loadSource(img, aud): Load image and audio resources from JSON.
- Clone or download the repository.
- Open
main.htmlin your web browser. - Click "START" to begin the game.
- Add the character's image to
resources/img/. - Update
resources/image.jsonwith the character's name and image path.
- Edit
resources/mainStory.jsonto add new story nodes. - Define texts, choices, and properties for each node.
- Add audio files to
resources/aud/. - Update
resources/audio.jsonwith the audio name and file path.
- Mouse: Click to interact with dialogs and buttons.
- Keyboard:
Space: Progress through dialogs.Escape: Pause the game and return to the landing screen.L: Toggle the dialog log.`: Clear saved progress.F/J: Play the drum mini-game (red/blue notes).
- Settings:
Sync: Sync user settings automaticallySave and resume: Combines the backup files and saved local data
- Landing page:
Profile:Highlight the characters that's been unlockedPersonalization: Custom our own playable main character
This project is for educational purposes. You may modify and use it as a base for your own projects.
- Development: Kelvin Lin
- Assets: All assets are placeholders and should be replaced with original or properly licensed content for distribution.