Comments (2)
Hi @xFrednet,
I think the idea of a simple World subclass would be a good way to go. To prevent bloat, I'm not sure if I'd want to add something to the main code, but a simple example would be nice to include in repository perhaps.
For my personal projects, I tend to arrange them by Scenes. I use one World
instance per Scene, and add the Processors on instantiation. For those that need it, I just pass a scene reference into those Processors that need it. Something like:
def __init__(self):
self.world.add_processor(AttackProcessor(scene=self))
self.world.add_processor(CollisionProcessor(scene=self))
self.world.add_processor(MovementProcessor())
self.world.add_processor(CommandProcessor(scene=self))
.....
All Scenes
share the same high level Audio playback interface, and SaveGame interface, so all of the Processors with a reference to the scene will also be able to access these. The "SaveManager" is in essence a shared resource manager. Adding a dedicated resource manager in this same vein would be pretty easy to do.
Since I use separate World instances for each Scene in my designs, it makes sense to my brain. If I was going to use a single World instance for the entire application, I would probably just add things to the World instead (as you've mentioned).
Does this make sense? Sorry if it's a bit hard to follow 😅
from esper.
Hey thank you very much for the response. It makes sense to split up the game into different scenes. I could also add the resources in the sub class if i really need them.
Thank you for the response 🙃
from esper.
Related Issues (20)
- I know ECS is largely used for games, but can this specific library also work for database backed CRUD web apps? HOT 3
- A way to index and get Component with parameters HOT 6
- Event system, or how to decouple processors HOT 15
- `lru_cache` swallows type annotation in `get_component` HOT 2
- `get_components` type annotation: accept and return *different* component types, not the same HOT 6
- version 1.5 is not showing on pypi HOT 1
- `py.typed` file is missing. HOT 5
- event handler as function HOT 4
- enhance `get_component` HOT 4
- Create an entity with a specific id HOT 4
- Try another ECS implementation - ecs_pattern library HOT 2
- Typing of world under the processor class HOT 3
- Testing esper HOT 4
- mypy `get_components` gives "object" type HOT 1
- Relationships HOT 8
- `World().create_entity()` does not create entity if no components are given HOT 1
- `remove_component()` method removes entity if no more components left HOT 3
- Add mypy to unit tests HOT 2
- Querying entities with denylist of components HOT 5
- API Design : Why so much OOP ? HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esper.