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 

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, Camera

# 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, SendTo

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.6.tar.gz (24.2 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.6-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easycells-0.1.6.tar.gz
  • Upload date:
  • Size: 24.2 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.6.tar.gz
Algorithm Hash digest
SHA256 a97b6419d3373ac68d37a811b1afe771fffbbea2f7978363c97c845af3fca6b5
MD5 24a8a367029da09a6b3d56c5bef6f190
BLAKE2b-256 6594aa7edc4406505f94d4ee108c14b9be0cb917d0f9067e66291b6c8ba269a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: EasyCells-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 33.1 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 39ca72d82820b0736b8c28947ee862c2e2048e3e7901d1bb515334df420f82bb
MD5 01dd1271ede0d8ee5584cd13f8820b01
BLAKE2b-256 95625baf3274f8a8322fec27337a1cb0d3e8bd491bdabd6cff0b15d6503e9b31

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