Code Monkey home page Code Monkey logo

flame_workspace's Introduction

Flame Workspace

A Workspace for Flame games.

Note

This project is unrelated to the Flame team, it is a personal project that I'm working on to make it easier to create games using Flame. For official support, see flame-engine/Flame Studio

flame_workspace_3.mp4

Progress

  • POC
    The proof of concept stage is where I try to figure out if the idea is possible and how to do it. Everything is hard coded, the project structure is not defined yet and the code is a mess.
  • Developer Preview
    The developer preview stage is where I try to implement the core features of the app. The project structure is somewhat defined, but it is still subject to change.
  • Alpha
    The alpha stage is where I try to implement most of the basic features and fix most of the bugs.
  • Beta
  • Stable

How to use?

Given the current state of the application, some manual steps are required to run it. The template/ folder contains the necessary arrangements to make it run and interact with the Workspace.

1. Clone the repository
2. Run flutter run in the flame_workspace folder to start the Workspace
3. Open the template/ folder from the Workspace
4. Run the project to start the Game Preview

Roadmap

Core Features

  • Analyze and parse a Flame project
  • Code generation
  • Code manipulation
    Manipulate the project classes, like declaring components in scenes, changing the properties of components, etc.
  • Game Preview

Basic Features

  • Create a new project
    Create a new project from the Workspace that contains all the necessary code to connect to the Workspace and interact with it.
  • Scene Editor
    A visual scene editor for designing and arranging game levels, environments, and assets.
  • Component Editor
    Create, edit and manage components isolatedaly from the Workspace.
  • Asset Management
    View, edit and manage the assets of the game from the Workspace.
  • Script Editor
    Edit the code of the game from the Workspace, without the need to open the project in external editors. The editor can take advantage of the analyzed code to provide code completion and other features.

Packages

  • flame_workspace
    The app itself. It is resposible to create, edit, generate code and connect to the server

  • template
    A template used when creating a new Flame project. The default folder structure is:

        assets/                         # Contains the assets of the game
        lib/                            # Contains the source code of the game
          generated/                      # Contains the generated code
            components/                       # Contains the generated code of the components
            scenes/                           # Contains the generated code of the scenes
            properties.dart                   # Contains the generated code to manipulate components
          components/
            component_name.dart               # A custom component    
          scenes/
            scene_name.dart                    # A scene
            scene_name_script.dart             # The script of the scene_name
          main.dart                       # The entry point of the game
          game.dart                       # The game itself
        pubspec.yaml                    # The dependencies of the game
        flame_configuration.yaml        # Configuration options used by the workspace

    For more details, see template/README.md

  • flame_workspace_core
    The core package, in which every Flame project must depend on. It contains the necessary code that makes the interaction between the Workspace and the game itself possible.

Under the hood

The Dart Analyzer is used to parse the entire code of the game. The Workspace uses this info to display the available components, scenes and other information about the project.

Game Preview

The Game Preview is the game itself, running on a separate window. The communication between the Workspace and the Game Preview is done using the local http server created by the flame_workspace_core package, making it possible to edit the components properties from the Workspace itself, without the need to edit the code. See this for more info on how it works.

Important

The Game Preview is embedded into the Workspace using flutter_native_view, since Flutter doesn't support Platform Views on Desktop yet (by 11/05/23).

  • View the embedded preview
  • Manipulate components inside the preview
    In a "paused" state, which the game loop is stopped, the user can manipulate the components inside the preview, and the changes are reflected in the code.
  • Logs
    The logs of the game are displayed in the Workspace, making it easier to debug the game.

Game-Workspace interaction

With the analyzed code, the workspace can generate code to allow the interaction between the game and the Workspace. This is necessary because reflection is not supported on Flutter. The generated code is placed in the lib/generated/ folder:

  • properties.dart This file is generated by the PropertiesGenerator and contains functions to manipulate all the components in the project, whether they're built-in Flame components or custom components.

  • scene_${sceneName}.dart This file is generated by the SceneGenerator and contains functions to manipulate the scenes in the project. It creates a mixin with the name Scene${sceneName}, which every scene must depend on. Don't worry, this is hanlded automatically by the Workspace.

These files are generated every time the files are changed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.