パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.10.1

dartemis

ゲーム開発向けのエンティティシステムフレームワーク。Artemisに基づく。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
140
いいね数
13
Pub ポイント
160

パッケージをインストール

flutter pub add dartemis

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Dartemis は、Artemis フレームワークにインスパイアされた、Dart でのゲーム開発向けの軽量なエンティティ-コンポーネント-システム(ECS)フレームワークです。ゲームエンティティ、コンポーネント、システムを管理するための構造的なアプローチを提供し、パフォーマンスとスケーラビリティを促進します。Flutterとの連携を目的として設計されており、Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームをサポートしています。関心の分離を通じて効率的なデータ駆動型ゲームロジックを実現しており、複雑なゲームアーキテクチャに最適です。開発者はカスタムシステムやコンポーネントを使用して機能を簡単に拡張できます。

用途

  • 2D/3Dゲームの作成
  • 多数のゲームエンティティの管理
  • データ駆動型ゲームロジックの実装
  • モジュール式ゲームシステムの作成
  • ゲームループにおけるパフォーマンスの最適化

主な機能

  • エンティティ・コンポーネント・システムアーキテクチャ
  • 高パフォーマンスかつ低メモリオーバーヘッド
  • クロスプラットフォーム対応
  • 拡張可能なシステムおよびコンポーネントモデル
  • 組み込みイベントおよびクエリシステム

適している対象

  • Flutterを使用するゲーム開発者
  • スケーラブルなエンティティ管理を必要とするプロジェクト
  • 複雑なゲームメカニクスを構築するチーム
  • ECSのベストプラクティスを探している開発者
  • パフォーマンスが重要なアプリケーション

注意事項

  • ECSパターンの理解が必要です
  • 初心者には学習曲線が急峻です
  • 限られた組み込みグラフィックスまたはオーディオサポート
  • 完全なゲームエンジンではありません
  • デバッグ用の追加ツールと併用するのが最適です

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

dartemis

Build Status Coverage Status Pub

Content

About

dartemis is a Dart port of the Entity System Framework Artemis.

The original has been written in Java by Arni Arent and Tiago Costa and can be found here: https://gamadu.com/artemis/ (archived) with the source available here: https://code.google.com/p/artemis-framework/

Ports for other languages are also available:

  • C#: https://github.com/thelinuxlich/artemis_CSharp
  • Python: https://github.com/kernhanda/PyArtemis

Some useful links about what an Entity System/Entity Component System is:

Getting started

  1. Add dartemis to your project by adding it to your pubspec.yaml:

    dependencies:
      dartemis: any
    
  2. Import it in your project:

    import 'package:dartemis/dartemis.dart';
    
  3. Create a world:

    final world = World();
    
  4. Create an entity from a list of components. Entities with different components will be processed by different systems:

    world.createEntity([
      Position(0, 0), 
      Velocity(1, 1),
    ]);
    

    A Component is a pretty simple structure and should not contain any logic:

    class Position extends Component {
      num x, y;
      Position(this.x, this.y);
    }
    

    Or if you want to use a PooledComponent:

    class Position extends PooledComponent {
      late num x, y;
     
      Position._();
      factory Position(num x, num y) {
        final position = Pooled.of<Position>(() => Position._())
          ..x = x
          ..y = y;
        return position;
      }
    }
    

    By using a factory constructor and calling the static function Pooled.of, dartemis is able to reuse destroyed components and they will not be garbage collected.

  5. Define a systems that should process your entities. The Aspect defines which components an entity needs to have in order to be processed by the system:

    class MovementSystem extends EntityProcessingSystem {
      late Mapper<Position> positionMapper;
      late Mapper<Velocity> velocityMapper;
    
      MovementSystem() : super(Aspect.forAllOf([Position, Velocity]));
    
      void initialize() {
        // initialize your system
        // Mappers, Systems and Managers have to be assigned here
        // see dartemis_builder if you don't want to write this code
        positionMapper = Mapper<Position>(world);
        velocityMapper = Mapper<Velocity>(world);
      }
    
      void processEntity(Entity entity) {
        Position position = positionMapper[entity];
        Velocity vel = velocityMapper[entity];
        position
          ..x += vel.x * world.delta
          ..y += vel.y * world.delta;
      }
    }
    

    Or using dartemis_builder

    part 'filename.g.part';
    
    @Generate(
      EntityProcessingSystem,
      allOf: [
        Position,
        Velocity,
      ],
    )
    class SimpleMovementSystem extends _$SimpleMovementSystem {
      @override
      void processEntity(Entity entity, Position position, Velocity velocity) {    
        position
          ..x += velocity.x * world.delta
          ..y += velocity.y * world.delta;
      }
    }
    
  6. Add your system to the world:

    world.addSystem(MovementSystem());
    
  7. Initialize the world:

    world.initialize();   
    
  8. Usually your logic requires a delta, so you need to set it in your game loop:

    world.delta = delta;
    
  9. In your game loop you then process your systems:

    world.process();
    

Documentation

API

Reference Manual

Example Games using dartemis

  • darteroids - Very simple example included in the example folder of dartemis, (Source)
  • Shapeocalypse - A fast paced reaction game using Angular, WebAudio and WebGL
  • damacreat - An iogame similar to agar.io about creatures made of dark matter (circles) consuming dark energy (circles) and other dark matter creatures (circles), which can shoot black holes (circles)

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。