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.5.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.5-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easycells-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 6e6be7a2cd911ac9212bb14d8deb74aa10654f16571e4a4d6055b30823eed90b
MD5 f17dd44c59604adaafa73daa0512f2d7
BLAKE2b-256 85528bbfb60c2c36e6a4c331c35d61823c5a23a6612735dabe648cf2ccc554e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: EasyCells-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ee8c47c4d12234e01610b3e5e3fb060215901bc1f72f522ec3cf181334fa4f14
MD5 4caf53df87f6e5657d18a84231813046
BLAKE2b-256 4ec2a2964898e4e818b65c7aab610553ceec7c94df7593887912b7d54390a3de

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