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

Integration between GameEngine and Rendering #9

Merged
merged 24 commits into from Mar 17, 2024
Merged

Conversation

Junyi00
Copy link
Contributor

@Junyi00 Junyi00 commented Mar 16, 2024

Changes:

  • Introduced SDPhysicsEngine
    • Wrapper around SpriteKit
  • Introduced GameBridge component
    • Reconciliate the differences between SDPhysicsEngine objects and GameEngine's Entities

Note:

  • Temporarily set GameEngine.EntityManager as non-private to create the test game scene from view controller
  • Texture-related implementations are WIP since TextureComponent is to-be-updated
  • SKPhysicsBody has no force attribute, commented out temporarily
  • SKPhysicsBody is hardcoded to be rectangles for now as PhysicsComponent is to-be-updated to expose shapes of physics body

@Junyi00 Junyi00 self-assigned this Mar 16, 2024
@Junyi00 Junyi00 marked this pull request as ready for review March 16, 2024 16:14
@Junyi00 Junyi00 requested review from ruihan00, HoJunHao2000 and jasonqiu212 and removed request for ruihan00 and HoJunHao2000 March 16, 2024 16:14
Copy link
Contributor

@jasonqiu212 jasonqiu212 left a comment

Choose a reason for hiding this comment

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

GameBridge looking beautiful!

@jasonqiu212 jasonqiu212 changed the title Integration between GameEngine and Rendering Integration between GameEngine and Rendering Mar 16, 2024
@HoJunHao2000
Copy link
Contributor

LGTM

}

func sync(entity: Entity, from object: SDObject) {
guard let positionComponent = entityManager.component(ofType: PositionComponent.self, of: entity.id) else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the syncing be done through system manager? I did create a sync function in the position and physics systems (parameters may not be the same but that can easily be fixed in systems).

Works either way to be honest. But i just thought that systems are responsible for transforming component data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this approach makes for better design since our game engine has one less responsibility and reduced coupling to the physics engine.

@HoJunHao2000 HoJunHao2000 merged commit 2c83cd6 into main Mar 17, 2024
1 check failed
@jasonqiu212 jasonqiu212 deleted the feat/rendering branch March 27, 2024 09:57
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

3 participants