Skip to main content

Uma biblioteca para criação de jogos e interfaces gráficas.

Project description

EasyCells

EasyCells is a Python game development framework inspired by Unity. It allows you to create Items (equivalent to Unity's GameObjects), organize game logic into Levels (equivalent to Unity's Scenes), and add Components to define object behaviors and functionalities.

Project Structure

Your project should follow this structure:

your_game/
├── Levels/           # Game scenes
│   └── level1.py
├── Assets/           # Game resources
│   ├── Ui/
│   ├── Sounds/
│   └── image.png
└── main.py           # Entry point 

Installation

Install the required dependencies with:

pip install pygame-ce numpy numba scipy pyfmodex midvoxio matplotlib

Initializing the Game

The Game class should be created in main.py:

from EasyCells import Game

if __name__ == '__main__':
    GAME = Game("level1")
    GAME.run()

Creating a Level

Levels are files inside the Levels/ folder. Each Level must contain two main functions:

  • init(game: Game): Initializes the objects in the Level.
  • loop(game: Game): Runs every frame.

Example of a basic Level:

from EasyCells import Game
from EasyCells.Components import Sprite

# Initialize Level objects
def init(game: Game):
    camera = game.CreateItem()
    camera.AddComponent(Camera())
  
    item = game.CreateItem()  # Every Item already has a Transform automatically
    item.AddComponent(Sprite("image.png"))

# Game loop
def loop(game: Game):
    pass

RPC (Remote Procedure Call) Example

EasyCells supports Remote Procedure Calls (RPC) to synchronize actions between the server and clients. Use the @Rpc decorator to mark functions that will be called remotely. See the example below with explanations for each SendTo option:

from EasyCells.NetworkComponents import Rpc, NetworkComponent

class MyNetworkComponent(NetworkComponent):
    @Rpc(SendTo.ALL)
    def action_all(self):
        """Executed on all (ALL)."""
        print("RPC: Executed on all.")

    @Rpc(SendTo.SERVER)
    def action_server(self):
        """Executed only on the server."""
        print("RPC: Executed on the server.")

    @Rpc(SendTo.CLIENTS)
    def action_clients(self):
        """Executed on clients, except on the server."""
        print("RPC: Executed on clients.")

    @Rpc(SendTo.OWNER)
    def action_owner(self):
        """Executed only on the object owner client."""
        print("RPC: Executed on the owner client.")

    @Rpc(SendTo.NOT_ME)
    def action_not_me(self):
        """Executed on all except the sender."""
        print("RPC: Executed on all, except the sender.")

Conclusion

EasyCells allows for modular and organized game development. Use Levels to structure game stages, Items to represent game objects, and Components to add behaviors. If needed, synchronize actions over the network with RPC. Explore the framework to build your game in a simple and efficient way!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easycells-0.1.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

EasyCells-0.1.0-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file easycells-0.1.0.tar.gz.

File metadata

  • Download URL: easycells-0.1.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for easycells-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf45d790dd1566de5ba91031745e0a7d52a76713c70c10062d836a79ed0dbc91
MD5 8d4c1817b330c04697b8d2f5996e5311
BLAKE2b-256 321a1934e2e55134c1f8df36f6bba4d703e9a932707e1fd224f8cfbc94fcb837

See more details on using hashes here.

File details

Details for the file EasyCells-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: EasyCells-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for EasyCells-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c59c1f9a057e7d25a605dbad3eee2f4092cde299fd7905dfda5467f6f14196c
MD5 082f3372afd8a1cac31a19e180a0d657
BLAKE2b-256 f294d355e9e872b455ec945a720c9cb3cd76cf88933b22d8a97c7b124912ed45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page