{"id":49197864,"url":"https://github.com/jcarbaugh/dreamcast3","last_synced_at":"2026-04-23T12:03:36.477Z","repository":{"id":350032303,"uuid":"1129175100","full_name":"jcarbaugh/dreamcast3","owner":"jcarbaugh","description":"A lightweight, zero-dependency web-based 2D game engine","archived":false,"fork":false,"pushed_at":"2026-04-06T21:58:16.000Z","size":213,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-08T16:40:18.902Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jcarbaugh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-06T17:59:37.000Z","updated_at":"2026-01-07T15:19:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jcarbaugh/dreamcast3","commit_stats":null,"previous_names":["jcarbaugh/dreamcast3"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jcarbaugh/dreamcast3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fdreamcast3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fdreamcast3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fdreamcast3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fdreamcast3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcarbaugh","download_url":"https://codeload.github.com/jcarbaugh/dreamcast3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fdreamcast3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32179390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T11:42:27.955Z","status":"ssl_error","status_checked_at":"2026-04-23T11:42:18.877Z","response_time":53,"last_error":"SSL_read: 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":[],"created_at":"2026-04-23T12:03:35.140Z","updated_at":"2026-04-23T12:03:36.468Z","avatar_url":"https://github.com/jcarbaugh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dreamcast3\n\n\u003e A lightweight, zero-dependency JavaScript game framework for building 2D games using native SVG rendering\n\n[![CI](https://github.com/jcarbaugh/dreamcast3/workflows/CI/badge.svg)](https://github.com/jcarbaugh/dreamcast3/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue)](https://www.typescriptlang.org/)\n[![npm version](https://img.shields.io/npm/v/dreamcast3.svg)](https://www.npmjs.com/package/dreamcast3)\n\ndreamcast3 is a modern, TypeScript-based game framework that leverages the power of SVG for 2D game development. With zero runtime dependencies and native browser APIs, it provides a simple yet powerful foundation for creating interactive games directly in the browser.\n\n## ✨ Features\n\n- 🎮 **Scene Management** - Stack-based scene system for menus, gameplay, and transitions\n- 🎨 **SVG Rendering** - Hardware-accelerated graphics using native SVG\n- 🏃 **Sprite Animation** - Frame-based animation with clip-path masking\n- 📐 **Movement System** - Smooth interpolated movement with 7 easing functions\n- 🎵 **HTML5 Audio** - Built-in audio preloading and playback\n- 📦 **Zero Dependencies** - No external runtime dependencies\n- 🔧 **TypeScript** - Full type safety and IDE autocomplete\n- 🌲 **Tree-Shakeable** - ES modules support for optimal bundle sizes\n- 🎯 **Multiple Formats** - UMD, ESM, and CommonJS builds included\n\n## 📦 Installation\n\n### NPM\n\n```bash\nnpm install dreamcast3\n```\n\n### Browser (UMD)\n\n```html\n\u003cscript src=\"https://unpkg.com/dreamcast3/dist/dreamcast3.js\"\u003e\u003c/script\u003e\n```\n\n### CDN\n\n```html\n\u003c!-- Latest version --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/dreamcast3/dist/dreamcast3.js\"\u003e\u003c/script\u003e\n\n\u003c!-- Specific version --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/dreamcast3@3.0.0/dist/dreamcast3.js\"\u003e\u003c/script\u003e\n```\n\n## 🚀 Quick Start\n\n### Browser (Global)\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n  \u003ctitle\u003eMy Game\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cdiv id=\"game\"\u003e\u003c/div\u003e\n\n  \u003cscript src=\"https://unpkg.com/dreamcast3/dist/dreamcast3.js\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n    // Create a new game\n    const game = new dreamcast3.Game('#game', {\n      width: 800,\n      height: 600,\n      frameRate: 60\n    }, (g) =\u003e {\n\n      // Create a scene\n      const mainScene = g.newScene('main', {\n        init() {\n          console.log('Scene initialized!');\n        },\n        onUpdate(delta) {\n          // Game logic here\n        }\n      });\n\n      // Create a sprite\n      const player = new dreamcast3.Sprite({\n        pos: { x: 400, y: 300 },\n        frameSize: { width: 32, height: 32 },\n        image: 'player.png'\n      });\n\n      mainScene.addActor(player);\n      g.pushScene(mainScene);\n    });\n  \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### ES Modules (Modern)\n\n```typescript\nimport { Game, Scene, Sprite } from 'dreamcast3';\nimport type { GameOptions } from 'dreamcast3';\n\nconst options: GameOptions = {\n  width: 800,\n  height: 600,\n  frameRate: 60\n};\n\nconst game = new Game('#game', options, (g) =\u003e {\n  const mainScene = g.newScene('main', {\n    onUpdate(delta) {\n      // Your game loop\n    }\n  });\n\n  const player = new Sprite({\n    pos: { x: 100, y: 100 },\n    frameSize: { width: 32, height: 32 },\n    image: 'player.png',\n    frameCount: 4,\n    animInterval: 100\n  });\n\n  mainScene.addActor(player);\n  g.pushScene(mainScene);\n});\n```\n\n### Node.js (CommonJS)\n\n```javascript\nconst { Game, Sprite, util } = require('dreamcast3');\n\nconst distance = util.distance({ x: 0, y: 0 }, { x: 3, y: 4 });\nconsole.log(distance); // 5\n```\n\n## 📖 Core Concepts\n\n### Game\n\nThe main game container that manages the SVG canvas, scene stack, and game loop.\n\n```javascript\nconst game = new Game('#game', {\n  width: 640,           // Canvas width\n  height: 480,          // Canvas height\n  frameRate: 30,        // Target FPS (0 = unlimited)\n  audioEnabled: true,   // Enable audio system\n  runOnLoad: true       // Auto-start game loop\n}, (g) =\u003e {\n  // Initialization callback\n});\n```\n\n### Scene\n\nRepresents a game state (menu, gameplay, pause screen, etc.) with lifecycle methods.\n\n```javascript\nconst scene = game.newScene('gameplay', {\n  init() {\n    // Called when scene becomes active\n  },\n  onUpdate(delta) {\n    // Called every frame with delta time\n  },\n  onDestroy() {\n    // Called when scene is popped\n  }\n});\n\n// Scene management\ngame.pushScene(scene);  // Make scene active\ngame.popScene();        // Return to previous scene\n```\n\n### Sprite\n\nAnimated game objects with position, movement, and frame-based animation.\n\n```javascript\nconst sprite = new Sprite({\n  pos: { x: 100, y: 100 },\n  frameSize: { width: 32, height: 32 },\n  image: 'spritesheet.png',\n  frameCount: 8,          // Number of animation frames\n  animInterval: 100,      // Milliseconds per frame\n  animating: true,\n  hasDirection: true      // Auto-rotate based on movement\n});\n\n// Add to scene\nscene.addActor(sprite);\n\n// Movement with easing\nsprite.moveToward(200, 200, 1000, () =\u003e {\n  console.log('Arrived!');\n}, 'easeInOutQuad');\n```\n\n## 🎨 Utilities\n\n### Easing Functions\n\nBuilt-in easing functions for smooth animations:\n\n```javascript\nimport { easing } from 'dreamcast3';\n\n// Available easing functions:\neasing.linear\neasing.easeInQuad\neasing.easeOutQuad\neasing.easeInOutQuad\neasing.easeInCubic\neasing.easeOutCubic\neasing.easeInOutCubic\n```\n\n### SVG Helpers\n\nCreate SVG elements programmatically:\n\n```javascript\nimport { svg } from 'dreamcast3';\n\nconst wrapper = svg.createSVG(800, 600);\nconst group = svg.group(wrapper, 'my-group');\nconst rect = svg.rect(group, 0, 0, 100, 100, { fill: '#ff0000' });\n```\n\n### Utilities\n\n```javascript\nimport { util } from 'dreamcast3';\n\n// Calculate distance between two points\nconst dist = util.distance({ x: 0, y: 0 }, { x: 3, y: 4 }); // 5\n\n// String padding\nconst padded = util.pad('7', 3, '0'); // '007'\n\n// Safe DOM removal\nutil.safe_remove(element);\n```\n\n## 🎮 Examples\n\nCheck out the [Star Collector demo](examples/demo.html) for a complete working example featuring:\n\n- Player movement with keyboard controls\n- Falling objects with collision detection\n- Click event handling\n- Score tracking\n- Sprite animation\n\nTo run the demo:\n\n```bash\nnpm install\nnpm run build\nopen examples/demo.html\n```\n\n## 🛠️ Development\n\n### Prerequisites\n\n- Node.js 14+ and npm\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/jcarbaugh/dreamcast3.git\ncd dreamcast3\n\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n```\n\n### Available Scripts\n\n```bash\nnpm run build          # Build all output formats\nnpm run build:prod     # Production build with minification\nnpm run dev            # Watch mode for development\nnpm run typecheck      # Type check without building\nnpm run clean          # Remove dist folder\n```\n\n### Project Structure\n\n```\ndreamcast3/\n├── src/\n│   ├── core/          # Game, Scene, Sprite classes\n│   ├── utils/         # Utility modules (util, svg, easing)\n│   ├── types/         # TypeScript type definitions\n│   └── index.ts       # Main entry point\n├── dist/              # Build output (generated)\n├── examples/          # Example games and demos\n└── rollup.config.js   # Build configuration\n```\n\n## 📚 API Reference\n\n### Game Class\n\n#### Constructor\n\n```typescript\nnew Game(selector: string | HTMLElement, options?: GameOptions, callback?: (game: Game) =\u003e void)\n```\n\n#### Methods\n\n- `run()` - Start the game loop\n- `getCurrentScene()` - Get the active scene\n- `newScene(id, options)` - Create a new scene\n- `pushScene(scene)` - Make scene active\n- `popScene()` - Return to previous scene\n- `setBackgroundColor(color)` - Set background color\n- `setBackgroundImage(x, y, width, height, path)` - Set background image\n- `preloadSounds(sounds)` - Preload audio files\n- `playSound(name)` - Play a sound\n- `getElapsedTime()` - Get total elapsed time in ms\n\n### Scene Class\n\n#### Constructor\n\n```typescript\nnew Scene(id: string, options?: SceneOptions)\n```\n\n#### Methods\n\n- `addActor(actor, layer?)` - Add sprite to scene\n- `addLayer(name)` - Create a named layer\n- `addScheduledTask(fn, delay)` - Schedule a recurring task\n- `pause()` - Pause the scene\n- `resume()` - Resume the scene\n- `isPaused()` - Check if paused\n\n### Sprite Class\n\n#### Constructor\n\n```typescript\nnew Sprite(options: SpriteOptions)\n```\n\n#### Methods\n\n- `moveTo(x, y)` - Teleport to position\n- `moveToward(x, y, duration, callback?, easing?)` - Animated movement\n- `advanceFrame(numFrames?)` - Advance animation frame\n- `remove()` - Remove from scene\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nMIT © [Jeremy Carbaugh](https://github.com/jcarbaugh)\n\n## 🙏 Acknowledgments\n\n- Inspired by classic 2D game frameworks\n- Built with modern web standards and TypeScript\n- Designed for simplicity and developer experience\n\n## 📞 Support\n\n- 📖 [Documentation](https://github.com/jcarbaugh/dreamcast3)\n- 🐛 [Issue Tracker](https://github.com/jcarbaugh/dreamcast3/issues)\n- 💬 [Discussions](https://github.com/jcarbaugh/dreamcast3/discussions)\n\n---\n\nMade with ❤️ for game developers who love the web platform\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcarbaugh%2Fdreamcast3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcarbaugh%2Fdreamcast3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcarbaugh%2Fdreamcast3/lists"}