Giter Club home page Giter Club logo

Comments (2)

benmoran56 avatar benmoran56 commented on August 12, 2024

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.

xFrednet avatar xFrednet commented on August 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.