diff --git a/.editorconfig b/.editorconfig index f5764e4..c3d8504 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,8 +3,11 @@ root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf +indent_style = space insert_final_newline = true [*.{js,ts,html}] -indent_style = space indent_size = 4 + +[*.{json}] +indent_size = 2 diff --git a/README.md b/README.md index 1efb1a8..2426e61 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ # Cosmic -The experimental pixi.js based engine for tile-based 2D games, created strictly for educational purposes. + +The experimental engine for tile-based 2D games, created strictly for educational purposes. ## Requirements + To run the demo project and experiment with the engine, the following tools are required. - Bun v1.3+ ## Try it out! + You can try out the ever evolving demo project at any time, by running the following commands. ```sh @@ -18,11 +21,13 @@ bun dev ``` ## Architecture + The following will explain the data-flow and general architecture of the engine, including the main class, the ECS and more! ### The `Cosmic` class ### The `Pipeline` class + Pipelines are singular, scoped and enqueue-able looping directives. For example, there might be a "rendering" pipeline, which draws the state of various entities onto the screen, on each frame, using drawing APIs. @@ -34,6 +39,7 @@ These are enqueued separately, rather than having one hard-coded main loop, to a ### The `EntityComponentSystem` class ### The `Store` class + Stores are utilized as a means of shared state throughout the engine. They are defined as static DTO-like (data transfer object) classes that extend the `Store` class. diff --git a/package.json b/package.json index 60deaf5..11629a8 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,20 @@ { - "private": true, - "contributors": [ - { - "name": "Johannes Reckers", - "email": "contact@thevoid.cafe", - "url": "https://thevoid.cafe" - } - ], - "workspaces": [ - "packages/*" - ], - "scripts": { - "dev": "cd packages/demo && bun dev", - "format": "oxfmt" - }, - "devDependencies": { - "oxfmt": "^0.16.0" + "private": true, + "contributors": [ + { + "name": "Johannes Reckers", + "email": "contact@thevoid.cafe", + "url": "https://thevoid.cafe" } + ], + "workspaces": [ + "packages/*" + ], + "scripts": { + "dev": "cd packages/demo && bun dev", + "format": "oxfmt" + }, + "devDependencies": { + "oxfmt": "^0.16.0" + } } diff --git a/packages/core/src/core/Cosmic.ts b/packages/core/src/core/Cosmic.ts index 6b8bce7..72512af 100644 --- a/packages/core/src/core/Cosmic.ts +++ b/packages/core/src/core/Cosmic.ts @@ -71,9 +71,13 @@ export class Cosmic { * @param {Pipeline} pipeline - The pipeline to enqueue. */ public enqueue(pipeline: Pipeline) { - if (!pipeline.name) throw new Error("[Cosmic::enqueue] The provided pipeline is missing the `name` property"); + if (!pipeline.name) + throw new Error( + "[Cosmic::enqueue] The provided pipeline is missing the `name` property", + ); - if (!pipeline.pulse) throw new Error("[Cosmic::enqueue] The provided pipeline is missing a `pulse` method"); + if (!pipeline.pulse) + throw new Error("[Cosmic::enqueue] The provided pipeline is missing a `pulse` method"); this.pipelines.push(pipeline); } diff --git a/packages/core/src/core/Pipeline.ts b/packages/core/src/core/Pipeline.ts index 5aee5eb..5790b95 100644 --- a/packages/core/src/core/Pipeline.ts +++ b/packages/core/src/core/Pipeline.ts @@ -19,6 +19,6 @@ export class Pipeline { * @param {number} dt - The delta time value passed on from the main engine loop. * @param {number} frame - The last recorded requestAnimationFrame ID. */ - public pulse: (dt: number, frame: number) => void - ) { } + public pulse: (dt: number, frame: number) => void, + ) {} } diff --git a/packages/demo/package.json b/packages/demo/package.json index 6ea4d1e..687345d 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -1,15 +1,15 @@ { - "name": "@cosmic/demo", - "version": "0.1.0", - "description": "Simple demo of the cosmic engine.", - "module": "src/index.ts", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" - }, - "dependencies": { - "@cosmic/core": "workspace:*", - "vite": "^8.0.0-beta.9" - } + "name": "@cosmic/demo", + "version": "0.1.0", + "description": "Simple demo of the cosmic engine.", + "module": "src/index.ts", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "@cosmic/core": "workspace:*", + "vite": "^8.0.0-beta.9" + } }