Skip to content

Blogs - Vivek Bassi

Major Contributions

1.Git-Based Author Attribution

To support contributor attribution, I integrated the mkdocs-git-authors-plugin. The final configuration ensures that authors are determined strictly from the Git history of each individual Markdown file:

plugins:
  - search
  - git-authors:
      strict: true
      show_contribution: false

2. CI/CD Automation

I implemented a CI/CD pipeline to fully automate documentation deployment. On every push to the main branch:

  1. The repository is checked out with complete Git history
  2. Python and MkDocs dependencies are installed
  3. The documentation site is built
  4. The site is deployed automatically using mkdocs gh-deploy

As a result, any committed documentation change is immediately reflected on the live site, eliminating all manual deployment steps.

3. Game Manager

The base GameManager script was already written, handling the score UI and a basic countdown timer. I extended it to support:

  • Difficulty scaling — as the timer counts down, the moles get faster and spend less time above ground. I exposed startPopSpeed, maxPopSpeed, startHideTime, and minHideTime as tunable Inspector values so it's easy to balance
  • High score system — used PlayerPrefs to persist the high score between sessions, with a ★ NEW! indicator when the player beats their best
  • Game Over panel + Restart — added a RestartGame() method that reloads the scene, hooked up to a UI button

4. Mole Movement

The base mole script handled basic up/down movement from a fixed position. I modified and extended it significantly:

  • Multiple moles — refactored the script so it works as a component on any number of mole GameObjects. Each mole picks a random hole every cycle, and I added a random startup delay so they don't all pop at the same time
  • Difficulty integration — each pop cycle now pulls the current popSpeed and hideTime live from GameManager, so difficulty ramps up automatically as time runs out
  • Squash effect on hit — added a quick scale squash/restore animation on hit for game feel
  • Sound effects — integrated AudioSource.PlayOneShot() for both a pop-up sound and a whack sound, assigned via the Inspector

5. Miss Detection System

I added a separate MissDetector script that sits on background collider. It detects clicks that don't land on any mole and plays a miss sound for audio feedback.


Demo Snapshots

Game over, restart and High score

Multiple Moles


Technical Stuff I Learned / Used

  • Coroutines for smooth movement and timed sequences without blocking the main thread
  • PlayerPrefs for lightweight local data persistence
  • Physics2D.Raycast for accurate mouse click detection on sprites
  • AudioSource.PlayOneShot for overlapping sound effects without interrupting each other
  • SceneManager.LoadScene for clean scene restarting
  • Lerp-based difficulty scaling tied to the remaining time ratio

Deployment

Deployed as a WebGL build on itch.io — playable directly in the browser, no download needed.

  • Built with Unity's WebGL target, Gzip compression with Decompression Fallback enabled
  • Hosted on itch.io as an HTML5 game

Tools Used

  • Unity 2D
  • C#
  • itch.io (deployment)

Continuing from my previous contributions in Git-based documentation automation, author attribution, and core gameplay support systems, this week I worked mainly on improving the game flow and usability of the Whack-a-Mole project.

My focus was on integrating the start menu, pause functionality, restart flow, difficulty management, and audio-linked UI behavior through the GameManager.


Start Menu and Session Flow

One of the major additions this week was the integration of a proper start menu that acts as the entry point for the game.

This improved the structure of the project by giving the player a clean flow from menu to gameplay instead of starting immediately in an active session.

The start menu system includes:

  • A startMenuPanel
  • Start button logic
  • Difficulty selection
  • Menu music
  • High-score display before gameplay starts

1. Difficulty Toggle Logic

The menu allows the player to cycle through multiple difficulty levels before starting the game.

public enum Difficulty
{
    Beginner,
    Challenger,
    Insane
}

public void ToggleDifficulty()
{
    if (currentDifficulty == Difficulty.Beginner)
        currentDifficulty = Difficulty.Challenger;
    else if (currentDifficulty == Difficulty.Challenger)
        currentDifficulty = Difficulty.Insane;
    else
        currentDifficulty = Difficulty.Beginner;

    ApplyDifficulty();
    UpdateDifficultyButton();

    int highScore = PlayerPrefs.GetInt(GetHighScoreKey(), 0);
    highScoreText.text = "Best: " + highScore;
}
This made the start menu more meaningful and improved replayability.

2. Pause and Restart Management

Another major part of my work this week was extending the GameManager to support pausing and restarting during gameplay.

The game can now be paused using the Escape key, and the player can choose to resume or restart from the pause panel.

The core pause and resume logic is:

public void PauseGame()
{
    isPaused = true;
    pausePanel.SetActive(true);
    Time.timeScale = 0f;
}

public void ResumeGame()
{
    isPaused = false;
    pausePanel.SetActive(false);
    Time.timeScale = 1f;
}
This made the gameplay much easier to control during demos and testing.

The restart flow was also improved so that the game resets cleanly without leaving leftover game state behind. The system returns the player to the menu, resets score, timer, and combo values, reapplies difficulty, and restores the correct audio state.

3. Audio and UI Interaction Support

I also worked on improving UI interaction by adding button-click sounds and cleaner menu/game transitions.

Important improvements included:

  • Button click sound
  • Start game sound
  • Game over sound
  • Menu background music
  • WaitForSecondsRealtime() for button actions while paused

This was especially important because pause logic uses Time.timeScale = 0, so normal timing logic would not behave correctly.

What I Learned This Week

This week helped me strengthen my understanding of:

  • Centralized game-state control in Unity
  • Pause logic using Time.timeScale
  • Real-time UI and audio synchronization
  • Menu-driven initialization and restart systems
  • Integrating multiple gameplay states in a single manager class

Progress Summary

My earlier work supported the technical and structural side of the project, while this week focused more on user flow and playability.

With the start menu, pause menu, restart system, and difficulty integration in place, the game now feels much more complete and easier to interact with.