WhalesState / pixel-engine

Pixel Engine is a 2D Godot Engine.
MIT License
30 stars 2 forks source link

Pixel Engine

Welcome to Pixel Engine!

Logo

Overview

This project aims to create a specialized version of the Godot Engine that focuses exclusively on 2D game development by completely removing the 3D functionality from the source code. The goal is to provide a streamlined and optimized engine tailored specifically for 2D game development, while reducing the complexity and overhead associated with 3D rendering.

Join us in supporting the official Godot Engine project, where numerous talented developers are working tirelessly to enhance the engine's capabilities. Together, we can contribute to the growth and success of the entire Godot community.

Check out the Godot Engine repository on GitHub and get involved in shaping the future of game development! Let's collaborate and make a lasting impact.

We believe that a specialized 2D-only version of the Godot Engine will empower developers to create amazing 2D games with optimal performance and ease. Join us in this exciting journey and let's revolutionize the world of 2D game development with the Godot Engine!

Important note:

Please be aware that I am unable to guarantee the stability of the project or any Engine releases. It is highly recommended to use the Godot Engine or create a backup before importing your 4.x Godot project. Additionally, please note that this project was originally intended to be private, but due to limitations with GitHub actions, it had to be made public. Therefore, if you choose to use it, please understand that it is at your own responsibility and discretion.

Project Goals

Benefits of Using the 2D-Only Engine

Key Features

License

Revolutionizing Rendering and Streamlined Source Code Structure

Rendering Process Comparison: 2D vs 3D

Step 2D Rendering Process 3D Rendering Process
Scene Setup ✔️ ✔️
Viewport Setup ✔️ ✔️
Camera Setup ✔️ ✔️
Transformations ✔️ ✔️
Visibility Checks ✔️ ✔️
Sorting ✔️ ✔️
Batching ✔️
Shader Application ✔️
Lighting and Shading ✔️
Shadow Mapping ✔️
Post-processing ✔️
Rendering ✔️ ✔️
Display ✔️ ✔️

2D Rendering Process:

  1. Scene Setup: The 2D scene hierarchy is constructed by adding nodes such as sprites, textures, and other visual elements.
  2. Viewport Setup: The viewport is configured to define the target area where the 2D scene will be rendered.
  3. Camera Setup: A 2D camera, usually an orthographic camera, is set up to define the view and projection parameters for the scene.
  4. Transformations: The positions, rotations, and scales of the 2D nodes are applied to transform the objects in the scene.
  5. Visibility Checks: The renderer checks which objects in the scene are visible within the viewport and should be rendered.
  6. Sorting: The visible objects are sorted based on their rendering order, which can be controlled by the layer and Z-index properties.
  7. Batching: Similar objects with the same materials are batched together to optimize rendering performance.
  8. Shader Application: Shaders, if applied to the objects, are executed to calculate the final color and visual effects.
  9. Rendering: The final image is constructed by rasterizing the visible objects onto a 2D image buffer using pixel-based techniques.
  10. Post-processing: Optional post-processing effects such as blur, color correction, or bloom can be applied to the rendered image.
  11. Display: The resulting 2D image is displayed on the screen or within a texture for further usage.

3D Rendering Process:

  1. Scene Setup: The 3D scene hierarchy is constructed by adding nodes such as meshes, lights, cameras, and other 3D objects.
  2. Viewport Setup: The viewport is configured to define the target area where the 3D scene will be rendered.
  3. Camera Setup: A 3D camera, typically a perspective camera, is set up to define the view and projection parameters for the scene.
  4. Transformations: The positions, rotations, and scales of the 3D nodes are applied to transform the objects in the scene.
  5. Visibility Checks: The renderer checks which objects in the scene are visible within the viewport and should be rendered.
  6. Culling: Objects that are outside the frustum of the camera are culled (not rendered) to optimize performance.
  7. Sorting: The visible objects are sorted based on their distance from the camera to ensure correct rendering order.
  8. Lighting and Shading: Lighting calculations are performed to determine the interaction of light sources with the 3D objects. Shading models such as Phong or PBR can be used to calculate the final color and appearance of the objects.
  9. Shadow Mapping: If enabled, shadows are calculated and applied to the scene to enhance realism.
  10. Post-processing: Optional post-processing effects such as depth of field, motion blur, or ambient occlusion can be applied to the rendered image.
  11. Rendering: The final image is constructed by rasterizing the visible 3D objects onto a 2D image buffer using techniques like z-buffering or ray tracing.
  12. Display: The resulting 3D image is displayed on the screen or within a texture for further usage.

Godot 4 Source Code Structure

The Godot game engine source code follows a modular structure that is organized into different directories and files. Here is an overview of the main directories in the Godot 4 source code:

Please note that this is not an exhaustive list, and there may be additional directories depending on the specific version and configuration of Godot you are using.

RenderingServer Class in Godot

The RenderingServer class in the Godot game engine is a crucial component responsible for handling the rendering of 2D and 3D graphics in a game or application.

Here are some key points about the RenderingServer class and its usage:

Overall, the RenderingServer class plays a critical role in managing the rendering pipeline and provides a high-level API for performing various rendering operations in the Godot game engine.

lib size comparison

image

obj file comparison

image