{"id":21251884,"url":"https://github.com/nawodyaishan/oop-rpg","last_synced_at":"2026-05-08T19:32:03.226Z","repository":{"id":208782712,"uuid":"720776904","full_name":"nawodyaishan/oop-rpg","owner":"nawodyaishan","description":"A TypeScript project demonstrating Object-Oriented Programming (OOP) principles using a fantasy game simulation. It includes classes like Player, GameSession, Creature, and interfaces like Combatant, Healer, Hero, Villain.","archived":false,"fork":false,"pushed_at":"2023-11-23T08:33:59.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-07T21:31:36.871Z","etag":null,"topics":["design-patterns","nodejs","oop-principles","pnpm","singleton-pattern","solid-principles","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nawodyaishan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-19T15:15:01.000Z","updated_at":"2025-05-26T17:19:10.000Z","dependencies_parsed_at":"2023-11-23T09:41:34.781Z","dependency_job_id":null,"html_url":"https://github.com/nawodyaishan/oop-rpg","commit_stats":null,"previous_names":["nawodyaishan/oop-rpg"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nawodyaishan/oop-rpg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nawodyaishan%2Foop-rpg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nawodyaishan%2Foop-rpg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nawodyaishan%2Foop-rpg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nawodyaishan%2Foop-rpg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nawodyaishan","download_url":"https://codeload.github.com/nawodyaishan/oop-rpg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nawodyaishan%2Foop-rpg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32794603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["design-patterns","nodejs","oop-principles","pnpm","singleton-pattern","solid-principles","typescript"],"created_at":"2024-11-21T03:45:17.683Z","updated_at":"2026-05-08T19:32:03.194Z","avatar_url":"https://github.com/nawodyaishan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OOP based RPG Game with TypeScript\n\n#### Description\n\nA TypeScript project demonstrating Object-Oriented Programming (OOP) principles using a fantasy game simulation. It\nincludes classes like `Player`, `GameSession`, `Creature`, and interfaces like `Combatant`, `Healer`, `Hero`, `Villain`.\n\n#### Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Features](#features)\n- [Code Structure](#code-structure)\n- [Contributing](#contributing)\n- [License](#license)\n\n#### Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/metaroonlabs/simple-node-js-api-ts.git\n\n# Navigate to the project directory\ncd simple-node-js-api-ts\n\n# Install dependencies\npnpm install\n```\n\n#### Usage\n\n```bash\n# To start the application\npnpm start\n\n# To build the application\npnpm run build\n\n# To serve the built application\npnpm run serve\n```\n\n#### Features\n\n- Implementation of OOP concepts in TypeScript.\n- Game simulation with player interactions and game session management.\n- Extendable architecture for adding more player types and actions.\n\n#### Code Structure\n\n- `src/`: Source code directory.\n  - `index.ts`: Entry point of the application.\n  - `interfaces/`: Definitions of interfaces like `Combatant`, `Healer`.\n  - `models/`: Game models like `Player`, `GameSession`.\n- `tsconfig.json`: TypeScript configuration file.\n- `package.json`: Project metadata and dependencies.\n\n### Object-Oriented Architecture Explanation\n\n#### Core Concepts\n\n##### Classes\n\n- **Player**: Represents a generic player in the game. Inherits from `Creature` and has properties\n  like `name`, `health`, and `level`. It also includes methods like `attack()` and `defend()`.\n- **Creature**: An abstract class that serves as a base for `Player` and `Animal`. It includes methods\n  like `makeSound()` and `locate()`.\n- **Animal**: Extends `Creature`. Represents animals in the game with health properties and methods.\n- **GameSession**: Manages the game's state, including player lists and game status. It uses singleton pattern for\n  global access.\n\n##### Inheritance\n\n- **Inheritance**: Demonstrated by `Player`, `Knight`, `Priest`, `Archer`, `Witch`, and `Animal`, which inherit\n  from `Creature`. This allows for shared functionalities and properties.\n\n##### Interfaces\n\n- **Combatant, Healer, Hero, Villain**: Interfaces that define specific actions\n  like `fight()`, `heal()`, `performHeroicAction()`, and `performEvilDeed()`. Implemented by different player types to\n  ensure diverse capabilities.\n\n##### Encapsulation\n\n- Properties like `name` in `Player` and `Animal` are marked as readonly, and health is encapsulated with getter and\n  setter methods, illustrating encapsulation.\n\n#### Design Patterns\n\n- **Singleton**: Used in `GameSession` to ensure only one instance of the game session exists.\n- **Strategy Pattern**: Demonstrated by implementing interfaces on different player types, allowing them to change their\n  behavior (like fighting or healing) dynamically.\n\n#### UML Diagram\n\nRefer to the provided UML diagram for a visual representation of the relationships between classes and interfaces.\n![uml](https://github.com/nawodyaishan/oop-rpg/assets/50957846/fdcff262-5aae-4d06-ad0a-e361bfa60d27)\n\n\n\n#### Benefits of OOP in This Project\n\n- **Modularity**: The code is organized into distinct classes and interfaces, making it easier to manage and extend.\n- **Reusability**: Common functionalities are inherited, reducing code duplication.\n- **Scalability**: New player types or game features can be added with minimal changes to existing code.\n\n---\n\n#### Contributing\n\nInstructions for contributing, e.g., pull request process, coding standards.\n\n#### License\n\nMIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n### CONTRIBUTING.md\n\nProvide guidelines for how others can contribute to the project. Include:\n\n- Code contribution guidelines.\n- Pull request and code review process.\n- Issue reporting instructions.\n\n---\n\n### LICENSE\n\nInclude the full MIT License text.\n\n---\n\n### .gitignore\n\nList of files and directories to be ignored by Git, e.g., `node_modules`, build outputs.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnawodyaishan%2Foop-rpg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnawodyaishan%2Foop-rpg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnawodyaishan%2Foop-rpg/lists"}