Coder Social home page Coder Social logo

fusionengine-org / fusion Goto Github PK

View Code? Open in Web Editor NEW
69.0 6.0 11.0 50.77 MB

A custom open-source game engine on Python and Pygame, it is written in pure Python! It is easy and fast!

Home Page: https://fusion-engine.tech/

License: GNU General Public License v3.0

Python 100.00%
game game-development game-engine pure-python python python-game python-game-engine python-game-library python-games pygame

fusion's Introduction

logo

PyPI PyPI - Python Version PyPI - License PyPI - Status PyPI - Downloads GitHub contributors Lines of code

Fusion is a game engine for creating graphical applications using OpenGL and the programming language Python. It provides a simple coding interface for creating windows, rendering graphics, and handling user input. It is and engine to create games fast and easy!

πŸ—œοΈ Table of Contents

πŸ’Ύ Installation

➑️ Using PyPi

To install our package, run this:

 pip install fusion-engine

Our PyPI package is at this link

πŸͺ² Install from source/devel

if you want to install the package from source and get the latest changes then you do it like this:

 git clone https://github.com/dimkauzh/fusion-engine.git
 cd fusion-engine
 pip install .

πŸƒβ€β™‚οΈ Run example

The examples are located here If you want to run the example, then follow these instructions:

  1. First, make sure you have fusion engine installed.
  2. If fusion engine is installed, you can run the first example with the following command:
 python -m fusionengine.examples.example1

For other examples, you can modify the command to run the other example. Just change the number of the example.

πŸ‘₯ Community

We have a discord server at this link. Need to contact us? Just #dimkauzh in discord and he will try to react as fast as possible

πŸ’β€β™‚οΈ Contributing

Our community is just growing, so if you want to help us with the project, it will be very helpful! We are welcome to all people who want to contribute, but you do need to follow the contribution rules Special thanks to all the contributors, they made the project even better! And thanks to our community of course!

πŸ₯Ž Tutorials

Are you exited to start with fusion engine but you dont know where to start? Then maybe its worth looking though one of our tutorials! We tried to make them as simple as possible but still very informative. You can find them here

πŸ“― Coming features

We are working hard to implement very basic and complex stuff so our engine becomes more rigid. To see our changelog and todo list, please go to our docs

πŸ’‘ - If you have more ideas, please tell us them in our discord server or create an issue!

πŸͺͺ License

See Licence here

πŸ—„οΈ About

This project began May 1, 2023. The original project began in C, but it's entirely rewritten in Python for it's big userbase and ease of use (productivity). This is actually also my EuroPython 2023 project. But after some time, the community has grown, and fusion had a lot of big releases. It was becoming a big project with a giant codebase.

⭐ Star History

Star History Chart

πŸ‡ΊπŸ‡¦ Ukraine

We as fusion team support Ukraine and we hope it will win. Fusion engine is dedicated to Ukraine fighting the Russian invasion. πŸ‡ΊπŸ‡¦ Please support Ukraine! πŸ‡ΊπŸ‡¦

πŸš€ About Me

A 13-year-old game developer with much passion about game development. So I made this project to grow my programming skills and just make a tool that I can use for myself or a tool for other people to help them develop games.

fusion's People

Contributors

dimkauzh avatar dvenru avatar jamim avatar nmsderp avatar techsplosion avatar xcarcedo avatar zenthm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fusion's Issues

PR and Issue Templates

This project should have PR and Issue templates for the following reasons:

  • Consistency: Templates ensure that all PRs and issues follow a standardized structure and format.
  • Clear Information: Templates prompt contributors to provide specific details about the PR or issue they are submitting.
  • Guidance for Contributors: Templates can serve as guidance for contributors who might be new to the project or inexperienced with the submission process.
  • Enhanced Project Management: By using templates, the project maintains a higher level of organization.

Entity gravity throws TypeException

Since PyMunk's gravity takes in a vector and not a number, and the gravity given by the Entity class is a number, it throws this exception:

Traceback (most recent call last):
  File "E:\FusionEngine\bug-hunting\entities.py", line 12, in <module>
    @main.window.loop
     ^^^^^^^^^^^^^^^^
  File "C:\Users\Kivanc64bit\AppData\Local\Programs\Python\Python311\Lib\site-packages\fusionengine\files\window.py", line 58, in loop
    your_loop()
  File "E:\FusionEngine\bug-hunting\entities.py", line 15, in loop
    entity.set_gravity(10)
  File "C:\Users\Kivanc64bit\AppData\Local\Programs\Python\Python311\Lib\site-packages\fusionengine\files\body.py", line 89, in set_gravity
    self.body.space.gravity = self.gravity
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Kivanc64bit\AppData\Local\Programs\Python\Python311\Lib\site-packages\pymunk\space.py", line 230, in _set_gravity
    assert len(gravity_vector) == 2
           ^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'int' has no len()

This can easily be fixed by replacing line 89 (self.body.space.gravity = self.gravity) with self.body.space.gravity = 0, -self.gravity or self.body.space.gravity = -self.gravity, 0 depending on where the vertical component of the vector is located (basically which number is the y axis, it's probably the second value). The negative sign basically inverts the direction to down instead of up, and maybe these constants could be used:

MERCURY = 3.7
EARTH = 9.807
MOON = 1.62
MARS = 3.71
JUPITER = 24.79
SATURN = 10.44
URANUS = 8.87
NEPTUNE = 11.15
PLUTO = 0.62
ERIS = 0.82
HAUMEA = 0.401
MAKEMAKE = 0.5

All are from Google searches of these planets, dwarf planets and moons' gravities.

I know that the physics engine isn't done yet, and I'm trying to help by reporting bugs and offering potential solutions to these bugs.

Redundant files and debugfiles directories

The src/fusionengine/files and src/fusionengine/debugfiles directories are redundant and absurd, the contents of these directories should be placed in the src/fusionengine directory.

The src/fusionengine/debugfiles/fe.png file can be src/fusionengine/icon.png.

Textures covered up by transparent textures on top

The bug is that transparent textures render over other textures, despite being transparent.

You need to create two textures, one transparent, and draw the transparent texture over the non-transparent one by calling the transp. texture draw after the non-transp. texture draw. Non-transp. will not render.

The non-transp. texture should render.

I have two screenshots that are important, one showing where no texture is on top of another and another where there is. The texture has solid pixels, but the background is transparent.

This is without the overlap.
This demonstrates the bug. The yellow dot has a transparent background.
This demonstrates how it should look. I did some image editing in order to achieve the picture.

I see this issue in Windows 11 Moment 4 Update.

I witnessed the issue before, though.

Textures not clearing properly

The textures do not properly clear, and the previous frame's render can be seen.

Create a program with a moving texture.

The textures should clear.

Expected
expected
Reality
reality
Windows 11 Moment 4 update, observed in previous OS releases.

RGBA Alpha doesn't work properly - bug

This code inside the loop below:

main.draw.draw_rect(window, 0, 0, 100, 100, (0x02, 0x8a, 0xf2, 0xff))
main.draw.draw_rect(window, 50, 50, 100, 100, (0x4a, 0xf2, 0x02, 0x7f))

Should produce this, but instead, the green square is treated as if it is fully opaque (alpha = 255) and produces this, which is not correct.

Automated testing

This project lacks on automation and is crucial for any software development project. One of the most important automation is testing, there are several reasons why automated testing is necessary:

  • Maintaining Code Quality: Automated tests help ensure that the library functions as expected. They can catch bugs and regressions early on, preventing the introduction of new issues with each code change.

  • Regression Detection: As a library evolves and new features or bug fixes are added, there is a risk of introducing unintended side effects or breaking existing functionality. Automated tests act as a safety net to catch regressions, making it easier to identify and fix issues.

  • Confidence in Refactoring: Automated tests provide confidence when refactoring or optimizing code. Developers can refactor with the assurance that if the tests pass, the changes have not broken existing functionality.

  • Platform and Environment Independence: Python libraries are often used in various environments and platforms. Automated tests ensure that the library behaves consistently across different setups, reducing the likelihood of environment-specific issues.

  • Time and Cost Savings: Although setting up automated tests initially takes some effort, they save time and cost in the long run. Identifying and fixing issues early reduces the time spent debugging and maintaining the library.

  • User Trust and Adoption: A well-tested library inspires trust among users and potential adopters. When users see that a library has a comprehensive test suite, they are more likely to rely on it for their projects.

Fusion Engine 4.2 gives error upon key press detection

The bug is an error with Fusion Engine:

Traceback (most recent call last):
  File "D:\Dot\game.py", line 191, in <module>
    movement_check()
  File "D:\Dot\game.py", line 12, in movement_check
    if engine.Key.key_down(engine.KEY_w) or engine.Key.key_down(engine.KEY_UP):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Kivanc64bit\AppData\Roaming\Python\Python312\site-packages\fusionengine\events\event.py", line 13, in key_down
    return keys[self.key]
                ^^^^^^^^
AttributeError: 'int' object has no attribute 'key'

You need to add a key_down function to the loop.

It should've run, but it didn't.

This is what I expected to see:
expected

Windows 11 (10.0.26016, Win10 build 26016) w/ Fusion Engine 4.2.

Entity images don't work

The Entity.image(window, image_path, x, y, width, height) method is supposed to render an image for the entity, but in the method, instead of the image argument using image_path in the open_image method, it uses image, which causes an error when running the Entity.image method.

Need to make it not possible to close window w/o killing process

This feature is (pretty much) required for my game Dot. The entire game can be skipped via closing the window (which skips to the next level).

I'd prefer a method -something named like window.disable_close()-. It disables the close button like on error popups.

I have considered directly interacting with window.window - although I will have to do some research on PyGame.

For example, the feature request would make enabled_close look like disabled_close.

Ruff implementation

Description

The project has a poor CI (Continuous Integration) at the time, and this issue is dedicated for adding a simple CI for linting the project and formatting with Ruff. This tool is a new absurdly fast all-in-one tool for linting and formatting, which means we don't need to set up other tools (e.g., isort, black, flake8, etc.)

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.