{"id":29738678,"url":"https://github.com/ricardoribeirorr/nityjs","last_synced_at":"2026-04-18T10:36:43.479Z","repository":{"id":303832327,"uuid":"1014011472","full_name":"RicardoRibeirorr/NityJS","owner":"RicardoRibeirorr","description":"The JavaScript game engine that feels like home for Unity developers. Build 2D games with familiar GameObject-Component architecture, physics, animations, and input handling - all in vanilla JavaScript with zero dependencies.","archived":false,"fork":false,"pushed_at":"2025-08-03T18:00:04.000Z","size":10401,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-15T02:28:57.858Z","etag":null,"topics":["canvas","discord-activities","facebook-instant-games","game","game-development","game-engine","game-frameworks","gamedev","javascript","nity","nity-2d","nity-engine","nity-game","puzzle","rpg-2d-game","unity","unity2d","vanilla-javascript","youtube-playables"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RicardoRibeirorr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-04T21:51:17.000Z","updated_at":"2025-08-03T18:00:07.000Z","dependencies_parsed_at":"2025-07-09T22:07:49.078Z","dependency_job_id":"59252d55-30b6-4ec4-b3e1-63fe8302b596","html_url":"https://github.com/RicardoRibeirorr/NityJS","commit_stats":null,"previous_names":["ricardoribeirorr/nityjs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RicardoRibeirorr/NityJS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRibeirorr%2FNityJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRibeirorr%2FNityJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRibeirorr%2FNityJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRibeirorr%2FNityJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RicardoRibeirorr","download_url":"https://codeload.github.com/RicardoRibeirorr/NityJS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRibeirorr%2FNityJS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001122,"owners_count":26083021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["canvas","discord-activities","facebook-instant-games","game","game-development","game-engine","game-frameworks","gamedev","javascript","nity","nity-2d","nity-engine","nity-game","puzzle","rpg-2d-game","unity","unity2d","vanilla-javascript","youtube-playables"],"created_at":"2025-07-25T19:01:39.041Z","updated_at":"2025-10-09T09:19:43.669Z","avatar_url":"https://github.com/RicardoRibeirorr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎮 NityJS - Unity's Power in Pure JavaScript\n\n\u003e **\"From C# to JavaScript - Same patterns, zero learning curve!\"**\n\n**The JavaScript game engine that feels like home for Unity developers.** Build 2D games with familiar GameObject-Component architecture, physics, animations, and input handling - all in vanilla JavaScript with **zero dependencies**.\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://img.shields.io/badge/Build-Passing-green.svg)]()\n[![JavaScript](https://img.shields.io/badge/JavaScript-ES6%2B-blue.svg)]()\n[![Documentation](https://img.shields.io/badge/Docs-Complete-brightgreen.svg)](./docs/)\n\n## 🚀 Why Choose NityJS?\n\n### For Unity Developers\n- **🎯 Instant Familiarity** - GameObject, Component, Scene... exactly what you know\n- **🔄 Same Patterns** - `Start()`, `Update()`, `OnCollisionEnter()` - it's all here\n- **📦 Component-Based** - Add/remove functionality just like Unity prefabs\n- **🎨 Visual Scripting** - Write code the Unity way, run it in the browser\n\n### For Web Developers  \n- **⚡ Zero Dependencies** - Pure JavaScript, no libraries needed\n- **📱 Cross-Platform** - Works everywhere JavaScript runs\n- **🔧 Easy Integration** - Drop into any web project instantly\n- **📦 Dual Distribution** - ES6 modules OR global objects\n\n### For Everyone\n- **🎓 Learn Game Development** - Perfect stepping stone into game programming\n- **⚡ Rapid Prototyping** - From idea to playable in minutes\n- **🏗️ Production Ready** - Stable collision system, optimized performance\n- **📖 Comprehensive Docs** - Every class documented with examples\n\n## ✨ Features That Unity Developers Will Love\n\n```javascript\n// Looks familiar? That's the point! 😊\nclass Player extends GameObject {\n    constructor() {\n        super(\"Player\");\n        \n        // Add components just like Unity\n        this.addComponent(new SpriteRendererComponent(\"player\", \"idle\"));\n        this.addComponent(new RigidbodyComponent());\n        this.addComponent(new BoxColliderComponent(32, 32));\n        this.addComponent(new PlayerController());\n    }\n}\n\n// Unity-style Destroy system - exactly what you expect!\nDestroy(player);                              // Destroy GameObject\nDestroyComponent(player, RigidbodyComponent);  // Remove specific component\nDestroyAll();                                 // Clear entire scene\n\n// Metadata-driven components - ALL components support this!\nconst playerSprite = SpriteRendererComponent.meta({\n    spriteName: \"player_idle\",\n    width: 64,\n    height: 64,\n    opacity: 0.9,\n    color: \"#FF6B6B\",\n    flipX: true,\n    flipY: false\n});\n\nconst physics = RigidbodyComponent.meta({\n    gravity: true,\n    gravityScale: 400,\n    bounciness: 0.2\n});\n\nconst collider = BoxColliderComponent.meta({\n    width: 32,\n    height: 48,\n    trigger: false\n});\n\n// Animation clips with metadata too!\nconst walkClip = SpriteAnimationClip.meta({\n    name: \"walk\",\n    spriteNames: [\"player:walk_0\", \"player:walk_1\", \"player:walk_2\"],\n    fps: 8,\n    loop: true\n});\n\n// Perfect for visual editors and JSON scene files\nconst componentData = {\n    type: \"SpriteRendererComponent\",\n    metadata: {\n        spriteName: \"enemy_walk\",\n        width: 48,\n        height: 48,\n        color: \"#FF6B6B\",\n        opacity: 0.8\n    }\n};\n\n// ALL 8 components + SpriteAnimationClip support metadata:\n// SpriteRenderer, Image, Shape, Rigidbody, BoxCollider, \n// CircleCollider, SpriteAnimation, Camera + SpriteAnimationClip!\n\n// Component - the new MonoBehavior but with more style! 😊\nclass PlayerController extends Component {\n    start() {\n        this.speed = 200;\n        this.jumpForce = 400;\n    }\n    \n    update() {\n        // Input handling you already know\n        if (Input.isKeyDown('Space')) {\n            this.jump();\n        }\n        \n        // Frame-rate independent movement\n        const moveX = Input.isKeyDown('d') ? 1 : 0 - Input.isKeyDown('a') ? 1 : 0;\n        this.rigidbody.velocity.x = moveX * this.speed;\n    }\n    \n    onCollisionEnter(collision) {\n        if (collision.gameObject.hasTag(\"Enemy\")) {\n            this.takeDamage();\n        }\n    }\n}\n```\n\n## 🛠️ Core Systems\n\n| System | Unity Equivalent | Status |\n|--------|------------------|--------|\n| **GameObject-Component** | GameObject/MonoBehaviour | ✅ Complete |\n| **Unity-Style Destroy** | Destroy/DestroyImmediate | ✅ Complete |\n| **Layer System** | Sorting Layers/Canvas | ✅ Complete |\n| **Metadata Components** | Editor Inspector | ✅ Complete |\n| **Scene Management** | Scene System | ✅ Complete |\n| **Physics \u0026 Collision** | Rigidbody2D/Collider2D | ✅ Stable |\n| **Input System** | Input Manager | ✅ Enhanced |\n| **Sprite Animation** | Animator/Animation | ✅ Complete |\n| **Asset Management** | Resources/AssetDatabase | ✅ Complete |\n| **Time \u0026 Delta** | Time.deltaTime | ✅ Complete |\n| **Tilemap System** | Tilemap/TilemapRenderer | ✅ Complete |\n| **Audio System** | AudioSource/AudioListener | ✅ Complete |\n\n## 📚 Comprehensive Documentation\n\n**Everything is documented!** From beginner tutorials to advanced patterns:\n\n### 📖 **[Complete Documentation Hub](./docs/)**\n\n#### 🎯 Getting Started\n- **[Quick Start Guide](./docs/README.md)** - Build your first game in 5 minutes\n- **[Unity Developer's Guide](./docs/index.md)** - Transition from Unity seamlessly\n- **[Architecture Overview](./docs/core/Game.md)** - Understand the engine structure\n\n#### 🔧 Core Systems\n- **[Game \u0026 Scene Management](./docs/core/)** - Game loop, scenes, lifecycle\n- **[GameObject \u0026 Components](./docs/core/GameObject.md)** - Entity-component architecture\n- **[LayerManager](./docs/core/LayerManager.md)** - Internal OffscreenCanvas layer system for depth-based rendering\n- **[Browser Compatibility](./docs/core/BrowserCompatibility.md)** - Cross-browser support, polyfills, and compatibility guidance\n- **[Component Metadata System](./docs/core/ComponentMetadata.md)** - Data-driven development \u0026 visual editor integration\n- **[Input System](./docs/input/Input.md)** - Keyboard, mouse, events, callbacks\n- **[Physics System](./docs/physics/)** - Movement, collision, gravity\n- **[Rendering System](./docs/renderer/)** - Sprites, animations, shapes\n- **[Asset Management](./docs/asset/)** - Loading, caching, optimization\n\n#### ⚡ Advanced Features\n- **Universal Metadata Support** - All 8 component types + SpriteAnimationClip support metadata creation\n- **JSON Scene Serialization** - Perfect for visual editors and level designers  \n- **Unity-Style Validation** - Type-safe metadata with helpful error messages\n- **Static Factory Methods** - Component.meta() for declarative creation\n- **Runtime Metadata Application** - Update components with applyMeta()\n- **Backward Compatibility** - Traditional constructors still work perfectly\n\n#### 🎮 By Game Type\n- **Platformers** - Player movement, collision, gravity\n- **Puzzle Games** - Input handling, state management  \n- **Action Games** - Fast collision, animations, effects\n- **Physics Simulations** - Realistic movement and forces\n\n#### 🚀 Advanced Topics\n- **Performance Optimization** - Object pooling, efficient rendering\n- **Architecture Patterns** - Component composition, state machines\n- **Integration** - Embedding in web apps, build systems\n\n## 🚀 Quick Start\n\n### Build Commands\n```bash\nnpm install\nnpm run build        # Build all versions (dev + prod)\nnpm run build:dev    # Development builds only (readable code)\nnpm run build:prod   # Production builds only (minified)\n```\n\n### Build Outputs\n- **`dist/nity.js`** - IIFE format, non-minified (development, browser script tags)\n- **`dist/nity.min.js`** - IIFE format, minified (production, browser script tags)\n- **`dist/nity.module.js`** - ES6 modules, non-minified (development, modern apps)\n- **`dist/nity.module.min.js`** - ES6 modules, minified (production, modern apps)\n\n### Your First Game (Unity Style!)\n```javascript\nimport { Game, Scene, GameObject, SpriteAsset, SpritesheetAsset, SpriteRendererComponent, ShapeComponent, Destroy } from './dist/nity.module.min.js';\n\n// Create game (like Unity's Game window)\nconst canvas = document.getElementById('gameCanvas');\nconst game = new Game(canvas);\n\n// Create scene (like Unity's Scene)\nconst gameScene = new Scene({\n  create() {\n    // Load assets - they register automatically!\n    new SpriteAsset(\"player\", \"assets/player.png\");\n    new SpritesheetAsset(\"enemies\", \"assets/enemies.png\", {\n      spriteWidth: 32,\n      spriteHeight: 32,\n      columns: 4,\n      rows: 2\n    });\n\n    // Create player (like Unity's GameObject)\n    const player = new GameObject(\"Player\");\n    player.position.set(100, 100);\n    \n    // Add sprite component (like Unity's AddComponent)\n    player.addComponent(new SpriteRendererComponent(\"player\"));\n    \n    // Create shape with metadata (perfect for visual editors!)\n    const enemy = new GameObject(\"Enemy\");\n    enemy.position.set(200, 100);\n    \n    // Multiple component creation methods:\n    // 1. Traditional constructor\n    enemy.addComponent(new ShapeComponent(\"circle\", { radius: 25, color: \"red\" }));\n    \n    // 2. Metadata-driven (ideal for editors)\n    const healthBar = ShapeComponent.meta({\n        shapeType: \"rectangle\",\n        options: {\n            width: 50,\n            height: 8,\n            color: \"#00FF00\",\n            filled: true\n        }\n    });\n    \n    // 3. All components support metadata factory\n    const camera = CameraComponent.meta({ zoom: 1.5 });\n    const animation = SpriteAnimationComponent.meta({ \n        defaultClipName: \"idle\", \n        autoPlay: true \n    });\n    \n    // 4. Animation clips with metadata\n    const idleClip = SpriteAnimationClip.meta({\n        name: \"idle\",\n        spriteNames: [\"player:idle_0\", \"player:idle_1\"],\n        fps: 4,\n        loop: true\n    });\n    \n    // Unity-style destruction\n    setTimeout(() =\u003e {\n      Destroy(enemy);  // Just like Unity!\n    }, 3000);\n    \n    // Add to scene (like Unity's Instantiate)\n    Instantiate.create(player);\n    Instantiate.create(enemy);\n  }\n});\n\n// Enable Layer System (like Unity's Sorting Layers)\ngame.configure({\n    useLayerSystem: true  // Enables 3 default layers: background, default, ui\n});\n\n// Objects automatically go to 'default' layer, or set explicitly:\n// background.layer = 'background';  // Background objects\n// ui.layer = 'ui';                  // UI elements\n\n// Launch game (like Unity's Play button)\ngame.launch(gameScene);\n```\n\n## 🎯 Examples \u0026 Demos\n\nExplore complete game examples in the [`examples/`](./examples/) directory:\n\n- **🏃 Basic Movement** - [`examples/basic.js`](./examples/basic.js)\n- **🎮 Input Handling** - [`examples/inputs/`](./examples/inputs/)\n- **⚽ Physics Systems** - [`examples/physics/`](./examples/physics/)\n- **🎨 Animations** - [`examples/animation/`](./examples/animation/)\n- **🕹️ Complete Games** - [`demo/flappy_bird/`](./demo/flappy_bird/)\n\nEach example includes:\n- ✅ Fully commented code\n- ✅ Step-by-step explanations  \n- ✅ Unity comparison notes\n- ✅ Live demos (where applicable)\n\n## 🤝 Looking for Collaborators!\n\n**Help us make NityJS the go-to JavaScript game engine!**\n\n### 🎯 What We Need\n- **Unity Developers** - Help us perfect the Unity-like experience\n- **Web Developers** - Optimize for modern web standards\n- **Game Designers** - Create example games and tutorials\n- **Documentation Writers** - Improve guides and examples\n- **Performance Engineers** - Optimize rendering and physics\n- **Community Builders** - Grow the ecosystem\n\n### 🚀 How to Contribute\n1. **⭐ Star this repo** - Show your support!\n2. **🐛 Report issues** - Found a bug? Let us know!\n3. **💡 Suggest features** - What would make this better?\n4. **📝 Improve docs** - Help others learn faster\n5. **🎮 Build games** - Show what's possible!\n6. **🔧 Submit PRs** - Code contributions welcome!\n\n### 💬 Join the Community\n- **GitHub Discussions** - Share ideas and get help\n- **Issue Tracker** - Report bugs and request features\n- **Pull Requests** - Contribute code and documentation\n\n## 🎯 Roadmap\n\n### ✅ Current (v1.0)\n- Complete GameObject-Component system\n- Stable physics and collision detection\n- Comprehensive input handling system\n- Sprite animation system with metadata support\n- Tilemap system for tile-based level design\n- Layer system with OffscreenCanvas optimization\n- Universal metadata support for all components\n- Enhanced ShapeComponent with polygon support\n- Browser compatibility detection and polyfills\n- Audio system with 3D spatial audio and procedural generation\n- Comprehensive documentation and examples\n\n### 🚧 Coming Next (v1.1)\n- **Particle System** - Visual effects and animations\n- **Raycast System** - Physics raycasting for line-of-sight and collision detection\n- **Mobile Touch** - Touch input and gestures for mobile devices\n- **Debug Tools** - Visual debugging and performance profilers\n- **Visual Editor** - Browser-based scene editor with metadata integration\n\n### 🌟 Future (v2.0+)\n- **3D Support** - Basic 3D rendering capabilities\n- **Advanced Editor** - Full visual scripting with metadata system\n- **Plugin System** - Extend engine functionality\n- **WebXR Support** - VR/AR game development\n- **Performance Profiler** - Built-in optimization tools\n\n## 📈 Performance \u0026 Compatibility\n\n- **⚡ Lightweight** - ~23KB minified\n- **🔧 Zero Dependencies** - Pure JavaScript\n- **🌐 Universal** - Works in all modern browsers\n- **📱 Mobile Ready** - Touch-optimized input\n- **⚙️ Node.js Compatible** - Server-side game logic\n\n### Browser Support\n- **Chrome/Edge**: Full support (recommended)\n- **Firefox**: Full support\n- **Safari**: Full support (iOS 16.4+ for LayerManager)\n- **Mobile Browsers**: Full support on modern devices\n- **Legacy Support**: Automatic fallbacks for older browsers\n\n### Layer System Compatibility\n- **OffscreenCanvas**: Chrome 69+, Firefox 105+, Safari 16.4+\n- **Fallback Mode**: Graceful degradation to single canvas rendering\n- **Detection**: Automatic capability detection with console warnings\n\n## 📄 License\n\nMIT License - Use it anywhere, build anything!\n\n### Disclaimer\nThis project is not affiliated with or endorsed by Unity Technologies. “Unity” is a trademark of Unity Technologies. This engine is independently developed and simply follows similar design patterns for familiarity.\n\n## 🙏 Credits\n\nBuilt with ❤️ for the game development community. Inspired by Unity's elegance and the web's accessibility.\n\n---\n\n### 🎮 Ready to Build Your Game?\n\n**[📖 Start with the Documentation](./docs/)** | **[🎯 Try the Examples](./examples/)** | **[🤝 Join the Project](https://github.com/yourusername/nityjs/issues)**\n\n*\"The game engine that speaks Unity, thinks JavaScript, and runs everywhere.\"*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardoribeirorr%2Fnityjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricardoribeirorr%2Fnityjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardoribeirorr%2Fnityjs/lists"}