esper icon indicating copy to clipboard operation
esper copied to clipboard

Initializing the world is not working

Open Habu-Fir opened this issue 1 year ago • 1 comments

Describe the bug When attempting to initialize a new world object using world = esper.World(), an AttributeError is raised indicating that the esper module has no attribute World.

To Reproduce

  1. Install the esper library using pip install esper.
  2. Create a Python script with the following content
  3. import esper

Initialize the world

world = esper.World()

  1. Run the script.
  2. Traceback (most recent call last): File "path/to/your/script.py", line X, in world = esper.World() ^^^^^^^^^^^ AttributeError: module 'esper' has no attribute 'World'

Expected behavior A clear and concise description of what you expected to happen: The script should initialize a new World object without raising an error. The esper library should provide the World class as documented, allowing for the creation and management of entities, components, and systems.

Development environment:

Python version: [e.g., Python 3.8.10] Esper version: [e.g., esper 2.0.0]

Habu-Fir avatar Jun 18 '24 07:06 Habu-Fir

Hello, since esper version 3.0, there is no more dedicated World object. This is mentioned at the top of the README, and the documentation explains the new process.

This was done for performance reasons. Basically, every call that was a world method, is now a function on the main module. For example:

world_instance.create_entity()
# becomes:
esper.create_entity()

If you need more than one World for your game, you can use new functions to switch between World contexts. This is explained more in the README and documentation.

benmoran56 avatar Jun 18 '24 07:06 benmoran56