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

docs: Improve documentation at Klondike Tutorial Step 5 #3078

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

nickf2k
Copy link

@nickf2k nickf2k commented Mar 14, 2024

Description

This PR for solving the issue #3076

1. What would I do to improve this tutorial:

  • Add missing content, eliminate confusing interruptions, and include omitted code sections.
  • Incorporate images and example animations to illustrate our objectives.
  • Introduce additional sections where necessary (though the final source code remains intact).
  • Provide logical transitions between sections.
  • Address why we need to follow specific approaches and not others.
  • Include links and information about general game development concepts (such as the concept of "seed" in game programming).

2. Contents I will add or modify:

  • The Klondike draw
  • Making cards move
  • Animating a card-flip
  • Model and View
  • Ending and restarting the game

I believe these sections are satisfactory, so I won't make any edits to them. I will begin editing from the section: A New World.

  • Immediately after the Start and restart actions section, I will provide an explanation of the "KlondikeWorld" class. Consequently, the adjustment of the "KlondikeGame" class is merely a necessary step when migrating the onLoad() function to KlondikeWorld, rendering the "A stripped-down KlondikeGame class" section redundant.

  • The section Using a Random Number Generator seed appears reasonable. However, I intend to supplement more references to this definition of "seed." If you have any documents or suggestions on this topic, please provide further information. Otherwise, I will utilize the following link: Link to Reddit.

  • The section Introducing the new KlondikeWorld class was previously covered, hence it will be omitted here. Please note that I will enrich the previous instruction with additional details.

  • Button: I will retain and expand upon this section as it lacks significant information.

  • Anchors and coordinates: This section may be considered supplementary information within the Button section. Therefore, I will incorporate and merge it into the Button section.

  • The deal() method: I will maintain this section in its current position, perhaps making minor sentence edits or none at all.

  • More animations of moves: Similar to the section "The deal() method."

  • A graphics glitch: As above.

  • Winning the game: I find this section quite comprehensive; hence, I may not make any alterations.

  • Ending a game and restarting it: This section lacks crucial details and is rather confusing. I will rewrite it to clarify.

  • Have fun button: This section is well-structured; therefore, I may retain it with minor adjustments if necessary.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

This PR solve the issue #3076

@nickf2k
Copy link
Author

nickf2k commented Mar 14, 2024

I am still working there. Please feel free to discuss about this PR

@nickf2k nickf2k force-pushed the docs-improve-klondike-step-5 branch from 2e47588 to bf1592a Compare March 20, 2024 17:11
@@ -413,6 +413,141 @@ FlameGame. The new world contains (almost) everything we need to play the game a
re-created during each of the above actions.


### KlondikeWorld class

In Flame, a ```World``` is a type of ```Component``` that can contain other ```Components```,
Copy link
Member

Choose a reason for hiding this comment

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

These should only have a single back-tick, tripple back-ticks are for multi-line code

Copy link
Author

Choose a reason for hiding this comment

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

Sure! Let me change this

@spydon
Copy link
Member

spydon commented May 24, 2024

@nickf2k any update on this?

@spydon
Copy link
Member

spydon commented Oct 3, 2024

@nickf2k are you planning to continue working on this PR?

@nickf2k
Copy link
Author

nickf2k commented Oct 3, 2024

@spydon
I forgot that I was working on this PR. I was in the middle of it when something came up, and I lost track of completing it. This is my fault. I will get back to it and work on it right away.
I'm so sorry

@nickf2k
Copy link
Author

nickf2k commented Oct 3, 2024

@spydon To avoid forgetting, I set a deadline for myself to complete this PR for you to review by next Tuesday. Thank you


You can learn more about `World` in game programming here:

- An introduction to `World` in game programming: [Ecampus](https://ecampusontario.pressbooks.pub/gamedesigndevelopmenttextbook/chapter/what-is-a-game-world/)
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't have links to external resourced in here, you can link to the world section in the docs instead.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks. I will change this

Comment on lines +485 to +491
Ohhh, so what happened to the `onLoad()` method? Well, previously, `KlondikeGame` handled everything in the `onLoad()` method, managing all the game components like `Piles` and `Cards`. But now, to make things cleaner and more organized, we’ve moved that responsibility over to `KlondikeWorld`.

Everything that used to be inside the `onLoad()` method of `KlondikeGame` is now in `KlondikeWorld`'s `onLoad()` method. This keeps the code more modular, meaning it's easier to maintain and update. Instead of `KlondikeGame` getting messy with too many tasks, we let `KlondikeWorld` handle the game setup and logic.

And what’s this `seed` thing? Ah, good question! So, the `seed` attribute is like a magic key. It lets you replay the same game configuration by selecting `Action.sameDeal`. This is super useful when you want to give players the option to retry the exact same game setup. The `seed` ensures that the randomness in the game (like card shuffling) can be repeated exactly the same way. Think of it as a way to recreate the same starting point in a game.

So, with the `seed` safely stored in `KlondikeGame`, the `KlondikeWorld` can use it to keep everything consistent between rounds. If you choose `Action.sameDeal`, it will load the same shuffled deck and game state, letting you replay that round with the same starting conditions. Pretty cool, right?
Copy link
Member

Choose a reason for hiding this comment

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

Formatting (max 100 line length)

Copy link
Author

@nickf2k nickf2k Oct 25, 2024

Choose a reason for hiding this comment

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

Sure. Thank you

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.

2 participants