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

Feedback: Confusing imports at interim stages of project #72

Closed
danieldeankon opened this issue Aug 2, 2020 · 2 comments · Fixed by #99
Closed

Feedback: Confusing imports at interim stages of project #72

danieldeankon opened this issue Aug 2, 2020 · 2 comments · Fixed by #99

Comments

@danieldeankon
Copy link

I'm coming into this with a few months of Rust experience, but nearly no experience with making games or using an ECS.

While working through this project I found some of the presentation of imports confusing. For example, when going from chapter 01-01 to chapter 01-03 a whole bunch of new imports are added all at once. Not all of them are actually used at the chapter 01-03 stage of the project, so I was confused by why the unused ones were added. I'm using chapter 01-03 as one example, but it seems there are unused imports at most stages of the book.

I also found the structure of the import statements unclear, e.g. importing ggez, then importing ggez::graphics, then ggez::graphics::DrawParam, expecially when some lines later the more compact curly brace notation is used. The imports feel unexplained to me in general---I would like to know things such as: whether the imported elements are modules, functions, traits, structs, or enums, a brief summary of the imported elements, and finally why they are imported at the current stage of the project. The first two questions are answered to an extent by the documentation on the crates themselves, so I feel that answering the third question here is most important.

Speaking more generally about the book itself, it is pretty good. I found it a useful exercise to go off the book's track at various places and implement my own additions to the sokoban game---the book provides enough detail to enable this. I'd like to know more about why games use ECS so often, as I do not know what kinds of problems come up that ECS is introduced to solve.

@iolivia
Copy link
Owner

iolivia commented Aug 15, 2020

hey @danieldeankon! thanks for the feedback!

Unused imports
I agree the imports are confusing, especially unused imports. They are there because code moved around in the starting stages of the book and code samples ended up split between multiple chapters so some of the imports were kind of left behind. I've created #79.

Compact imports
Yep, I think as a matter of style we should probably use compact imports throughout, created #80.

Explaining imports
I think this is probably the least explained part, but I kind of did this intentionally. I wanted to leave a bit for whoever is following to have to figure out themselves, add/remove imports and try to understand why they are there. I think once we remove unused imports and unify the import style hopefully this one will be better.

I found it a useful exercise to go off the book's track at various places and implement my own additions to the sokoban game

This is great! What did you implement extra? I might add a few ideas throughout the book for people to try out.

I'd like to know more about why games use ECS so often

This is a great question. I kind of glossed over this on purpose since it's a really big topic. I think you certainly don't have to use ECS, it's entirely possible to do a game using inheritance or composition. For rust games specifically, I have found ECS to be easier to work with the borrow checker.

@danieldeankon
Copy link
Author

My additions were:

  • Centering the game field
  • Preventing more than one box from being pushed by the player
  • Making animation frame duration more easily configurable for myself

I also partially implemented differently-coloured boxes and spots before actually reading that section of the book.

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 a pull request may close this issue.

2 participants