# QFramework | Godot/Unity3D System Design Architecture

**URL:** <https://onehack.st/t/qframework-godot-unity3d-system-design-architecture/288318>\
**Category:** Tools & Scripts\
**Tags:** freebies\
**Created:** [August 17, 2024, 8:21pm UTC](https://onehack.st/t/qframework-godot-unity3d-system-design-architecture/288318 "2024-08-17T20:21:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WhiteHat](https://onehack.st/user_avatar/onehack.st/whitehat/32/162514_2.png) [@WhiteHat](https://onehack.st/u/WhiteHat)\
**Post date:** [August 17, 2024, 8:21pm UTC](https://onehack.st/t/qframework-godot-unity3d-system-design-architecture/288318/1 "2024-08-17T20:21:00Z")

</div>

[![LOGO](https://camo.githubusercontent.com/fecd26bd448f537a1a58bebd8a9bd2c8a732436ccf047f0537360546bc95312c/68747470733a2f2f66696c652e6c69616e6778696567616d652e636f6d2f36376361326332372d643731312d343062322d393666332d6432663630373165336633632e706e67)](https://camo.githubusercontent.com/fecd26bd448f537a1a58bebd8a9bd2c8a732436ccf047f0537360546bc95312c/68747470733a2f2f66696c652e6c69616e6778696567616d652e636f6d2f36376361326332372d643731312d343062322d393666332d6432663630373165336633632e706e67)

[![](https://camo.githubusercontent.com/2bb6ac78e5a9f4f688a6a066cc71b62012101802fcdb478e6e4c6b6ec75dc694/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/liangxiegame/QFramework/blob/master/LICENSE) [![Build Status](https://camo.githubusercontent.com/1024b7e047768fa513cdba85028aaa52a001ced6e207a1a39e1da2ae455cbe5f/68747470733a2f2f7472617669732d63692e6f72672f6c69616e6778696567616d652f514672616d65776f726b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/liangxiegame/QFramework)

# QFramework Intro

[中文](https://github.com/liangxiegame/QFramework/blob/master/README)|[English](https://github.com/liangxiegame/QFramework/blob/master/README_EN.md)

[QFramework](https://github.com/liangxiegame/QFramework) is a framework. she support solid pricinple、domain design driven、event-driven、data-driven、layered、mvc、cqrs、modulization、extendable、scalable architecture. Simple but powerful! she only has 800 lines of code.can save to a note-taking app.

## Architecture diagram

[![](https://camo.githubusercontent.com/891a52f9e4365ed88082043cb19c427b87bce0453f7e60f52f064d65f65ecefb/687474703a2f2f70726f636573736f6e2e636f6d2f63686172745f696d6167652f3563323730616136653462303037626135643530323964632e706e67)](https://camo.githubusercontent.com/891a52f9e4365ed88082043cb19c427b87bce0453f7e60f52f064d65f65ecefb/687474703a2f2f70726f636573736f6e2e636f6d2f63686172745f696d6167652f3563323730616136653462303037626135643530323964632e706e67)

## For Example（😂）

[![](https://camo.githubusercontent.com/336c167f063942110625123da598a7f649abb1df9581ce44038aa1dbeb060a05/68747470733a2f2f66696c652e6c69616e6778696567616d652e636f6d2f35666364663664312d303630352d346165362d623462662d3132653636316562326631652e706e67)](https://camo.githubusercontent.com/336c167f063942110625123da598a7f649abb1df9581ce44038aa1dbeb060a05/68747470733a2f2f66696c652e6c69616e6778696567616d652e636f6d2f35666364663664312d303630352d346165362d623462662d3132653636316562326631652e706e67)

## Schematic diagram of various situations

[![](https://camo.githubusercontent.com/4658123ca4f923c9b9d52014a4485509c2b7f2b813aef7bc8b283ef8ee8f5efe/687474703a2f2f70726f636573736f6e2e636f6d2f63686172745f696d6167652f3563626231656463653462306261623930393630613466362e706e67)](https://camo.githubusercontent.com/4658123ca4f923c9b9d52014a4485509c2b7f2b813aef7bc8b283ef8ee8f5efe/687474703a2f2f70726f636573736f6e2e636f6d2f63686172745f696d6167652f3563626231656463653462306261623930393630613466362e706e67)

## Architecture Rule

**QFramework System Design Architecture has 4 layers：**

- Presentation Layer：ViewController Layer. Using IController interface，recive input from user and state changed event from model. In unity MonoBehaviour is on presentation layer
  - Can get System
  - Can get Model
  - Can send Command
  - Can listen Event

- System Layer：Using ISystem interface. share IController’s part of responsibility. Sharing logic shared across multiple presentation layers，suchas time system、shop system、archivement system.
  - Can get System
  - Can get Model
  - Can listen Event
  - Can send Event

- Model Layer：Using IModel interface.Responsible for data definition, data addition, deletion, query and modification methods.
  - Can get Utility
  - Can send Event

- Utility Layer：Using IUtility interface.Responsible for providing infrastructure, such as storage method, serialization method, network connection method, Bluetooth method, SDK, framework inheritance, etc. Nothing can be done. You can integrate third-party libraries or encapsulate APIs
- In addition to the four layers, there is a core concept - command
  - Can get System
  - Can get Model
  - Can send Event
  - Can send Command

- Layer Rule：
  - IController change ISystem、IModel’s state by Command
  - Notify icontroller after the change of ISystem and IModel must use event or bindableproperty
  - IController can get ISystem、IModel for data query
  - ICommand cannot have state
  - The upper layer can directly obtain the lower layer, and the lower layer cannot obtain the upper object
  - Events for lower layer to upper layer communication
  - The communication between the upper layer and the lower layer is called by method (only for query and command for state change). The interaction logic of IController is special, and command can only be used

（照抄自：[学生课堂笔记1](https://github.com/Haogehaojiu/FrameworkDesign)）

### Environment

- Unity 2018.4.x ~ 2021.x

## Install

- QFramework.cs
  - copy [this code](https://github.com/liangxiegame/QFramework/blob/master/QFramework.cs) to your project

- QFramework.cs With Examples
  - [downlowd unitypackage](https://github.com/liangxiegame/QFramework/blob/master/QFramework.cs.Examples.unitypackage)

- QFramework.ToolKits
  - [downlowd unitypackage](https://github.com/liangxiegame/QFramework/blob/master/QFramework.Toolkits.unitypackage)

- QFramework.ToolkitsPro
  - install by [Asset Store](http://u3d.as/SJ9)

## Resources

**Version**  
QFramework.cs Implementation of qframework ontology architecture [code file](https://github.com/liangxiegame/QFramework/blob/master/QFramework.cs)  
QFramework.cs With Examples QFramework.cs and Examples：CounterApp、Point Point Point、CubeMaster、FlappyBird、ShootingEditor2D、SnakeGame etc (QFramework.cs included) [downlowd unitypackage](https://github.com/liangxiegame/QFramework/blob/master/QFramework.cs.Examples.unitypackage)  
QFramework.ToolKits QFramework.cs with UIKit/ActionKit/ResKit/PackageKit/AudioKit (QFramework.cs and examples included) [downlowd unity package](https://github.com/liangxiegame/QFramework/blob/master/QFramework.Toolkits.unitypackage)  
QFramework.Toolkits.Demo.WuZiQi Gobang Demo by QFramework.Toolkits（Need Install QFramework.Toolkits） [download unitypackage](https://github.com/liangxiegame/QFramework/blob/master/QFramework.Toolkits.Demo.WuZiQi.unitypackage)  
QFramework.Toolkits.Demo.Saolei Mine clearance Demo by QFramework.Toolkits（Need Install QFramework.Toolkits） [download unitypackage](https://github.com/liangxiegame/QFramework/blob/master/QFramework.Toolkits.Demo.SaoLei.unitypackage)  
QFramework.ToolKitsPro More Powerful Tools version based on QFramework.ToolKits (QFramework.Toolkits included) [AssetStore](http://u3d.as/SJ9)  
**Community**  
github issue github community [address](https://github.com/liangxiegame/QFramework/issues/new)  
gitee issue gitee community [address](https://gitee.com/liangxiegame/QFramework/issues)  
**ShowCase** email me or publish on github’s issue. My email: [liangxiegame@163.com](mailto:liangxiegame@163.com)  
《When The Train Buzzes For Three Seconds》 [Steam](https://store.steampowered.com/app/1563700/_/) [TapTap](https://www.taptap.cn/app/208258)  
《The First Mountain》 [Steam](https://store.steampowered.com/app/2149980/The_First_Mountain/)  
《Hi Eggplant》 [Steam](https://store.steampowered.com/app/2091640/Hi_Eggplant/)  
《Under The Ghost Mountain》 [Steam](https://store.steampowered.com/app/1517160/_/)

## Star Trends

[![Stargazers over time](https://camo.githubusercontent.com/e8a6d019877338220ea0b01f76377174d889d8c9e1093d8a1395ea9efc9633b4/68747470733a2f2f7374617263686172742e63632f6c69616e6778696567616d652f514672616d65776f726b2e737667)](https://starchart.cc/liangxiegame/QFramework)

## GitHub:

[https://github.com/liangxiegame/QFramework](https://github.com/liangxiegame/QFramework)

Click on English to explorer English version!
