Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Systems #4

Merged
merged 13 commits into from Mar 15, 2024
Merged

feat: Add Systems #4

merged 13 commits into from Mar 15, 2024

Conversation

HoJunHao2000
Copy link
Contributor

@HoJunHao2000 HoJunHao2000 commented Mar 13, 2024

Changes made thus far

  • Add SystemManager
  • Add PositionSystem
  • Add PhyiscsSystem
  • Add GameEngine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to remove .DS_Stores from being committed? It should be in the .gitignore, not sure why it's being tracked here

var dispatcher: EventModifiable { get set }
var entityManager: EntityManager { get set }

func update(by deltaTime: TimeInterval)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I clarify what is the role of this method? I'm a bit confused because I noticed that not all systems (like PositionSystem) override this method. And in PhysicsSystem, the update method basically sets all the force vectors to 0. Under what circumstance is this method called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It more like for timed components in the game, e.g. those that after a certain time will stop working like powerups


protocol System {
var isActive: Bool { get set }
var dispatcher: EventModifiable { get set }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this dispatcher do ah? Does the dispatcher represent an object that can receive requests/events and route them to appropriate methods? If so, I think it has a different set of functionalities from an EventModifiable. Perhaps a new protocol called EventDispatcher can be created.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do all systems require a dispatcher? If not, perhaps this property can be optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep can make an EventDispatcher. Can make it optional too

@HoJunHao2000 HoJunHao2000 marked this pull request as ready for review March 15, 2024 09:04
@HoJunHao2000 HoJunHao2000 merged commit 86d9cf6 into main Mar 15, 2024
1 check failed
@jasonqiu212 jasonqiu212 deleted the systems branch March 27, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants