Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AlgoOy/TinySquare
A tiny 2D square game engine for Cortex-M series processors. 一个面向Cortex-M系列处理器的轻量化2D方块游戏引擎
https://github.com/AlgoOy/TinySquare
learn
Last synced: 25 days ago
JSON representation
A tiny 2D square game engine for Cortex-M series processors. 一个面向Cortex-M系列处理器的轻量化2D方块游戏引擎
- Host: GitHub
- URL: https://github.com/AlgoOy/TinySquare
- Owner: AlgoOy
- License: apache-2.0
- Created: 2023-06-01T15:04:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-20T16:14:42.000Z (11 months ago)
- Last Synced: 2024-03-20T17:36:09.160Z (11 months ago)
- Topics: learn
- Language: C
- Homepage:
- Size: 49.6 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rt-thread - TinySquare - A lightweight square game engine running on Cortex-M. (Packages / Misc)
- awesome-rt-thread - TinySquare - A lightweight square game engine running on Cortex-M. (Packages / Misc)
README
# TinySquare
[中文页](./docs/README_cn.md)
## 1. Introduction
TinySquare is an embedded block game engine designed to provide a lightweight game development solution for devices targeting Cortex-M processors. TinySquare's design principles are small code size and lightweight running costs to ensure that the engine can run efficiently on resource-constrained embedded devices. TinySquare has the following features and advantages:
- Layer rendering uses the Arm-2d library as the underlying support, which is specifically optimized for the Cortex-M processor. By fully utilizing the characteristics of the Cortex-M processor, the engine can provide efficient performance and optimized gaming experience.
- In order to meet the resource constraints of embedded systems, TinySquare focused on the small code size of the engine and the lightweight running environment during the development process. During the running process, dynamic dirty matrix refresh technology was used, and only one dirty region is needed to refresh all dirty regions. All layers greatly save RAM overhead during runtime to ensure that the performance and functionality of the engine can be balanced under limited resources.
- TinySquare focuses on block game types. Whether it is classic games like Snake, Tetris, or other innovative block-based gameplay, the engine provides highly customized configuration items for layers to support game development and customization.
- TinySquare focuses on lightweight design, while also having a certain degree of flexibility and high configurability. The engine provides a concise and powerful set of APIs: only 24 C APIs and only 18 Python APIs. A rich set of configurable options allows developers to customize according to their needs to create a unique and satisfying gaming experience.
- TinySquare code writing and API naming follow RT-Thread coding standards. The development process follows the principle of minimum information disclosure. In theory, developers using TinySquare only need to pay attention to the API documentation to quickly get started with TinySquare development.Using a minimally functional Snake as a reference, the space overhead and performance of TinySquare are given. Note that this use case does not use the Python virtual machine:
Reference data
-Os optimization
-Oz optimization
Remark
Configuration
Main frequency
80MHz
80MHz
——
Optimization level
-Os -lto
-Oz -lto
——
Screen
240 * 240
240 * 240
——
PFB
240 * 4
240 * 4
——
Heap
0x100
0x100
——
Stack
0x100
0x100
——
rt heap
0x2400
0x2400
——
Performance
FPS
140:7ms
128:7ms
——
Program size
Code
34156
29688
——
RO-data
2520
2512
——
RW-data
180
180
——
ZI-data
16052
16052
Including LCD buffer, PFB pool, rt heap, rt stack, stack, heap, snake resource, etc.
Combining the above data, it is not difficult to conclude that the engine itself takes up very little resources, and the corresponding performance is also very powerful! The embedded world simply doesn't need 128 or even 140 FPS. Therefore, the above data can be further optimized, the size of the PFB can be further reduced, and the task stacks of engine tasks and game tasks are also very rich in the current test environment, and can be further compressed to reduce the rt heap size.
To sum up, TinySquare meets the design principle of "small code size and lightweight running cost", while also showing excellent performance.### 1.1 Contents
| Name | Description |
| ---- | ---- |
| docs | Document directory |
| examples | examples directory |
| library | dependent library directory |
| port | ported code directory |
| source | source code directory |### 1.2 License
TinySquare is licensed under the Apache-2.0 license, see the `LICENSE` file for details.
### 1.3 Dependence
- Arm-2D v1.1.5
- RT-Thread
- pikaPython## 2. How to port TinySquare
- [C library porting](./docs/guide_with_c_en.md)
- [pikaPython library porting](./docs/guide_with_pikaPython_en.md)## 3. How to use TinySquare
- [C library usage - Tetris](./docs/example_tetris_en.md)
- [pikaPython library usage - Snake](./docs/example_snake_en.md)
- [API](./docs/api_en.md)## 4. Notice
- [Notice](./docs/notice_en.md)
## 5. Contact & Thanks
* Maintainer: [AlgoOy](https://github.com/AlgoOy)
* Home page: https://github.com/AlgoOy/TinySquare
* Thanks: [GorgonMeducer](https://github.com/GorgonMeducer)