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

Refactor GameBoard for a more modular and game-oriented architecture #16

Open
Cheelax opened this issue Aug 20, 2024 · 16 comments
Open
Labels

Comments

@Cheelax
Copy link
Contributor

Cheelax commented Aug 20, 2024

Description:
We need to refactor the GameBoard component to improve its structure, make it more modular, and more suitable for animation. The goal is to have a more maintainable and extensible codebase for our game.

Tasks to accomplish:

  1. Create a centralized game state (GameState)
    • Define a GameState interface that encompasses all aspects of the game's state
    • Include the grid, score, combo, bonuses, etc.
  2. Develop a custom hook for game logic (useGameLogic)
    • Move the majority of the game logic into this hook
    • Implement methods to manipulate the game state (e.g., movePiece, applyGravity, clearLines)
  3. Divide GameBoard into smaller, specialized components
    • Create separate components for ScoreDisplay, BonusPanel, Grid, NextLineDisplay, etc.
    • Ensure each component has a unique and clear responsibility
  4. Integrate an animation system
    • Use React Spring or Framer Motion to handle animations
    • Create animated components for the game's cells and pieces
  5. Separate concerns into distinct files
    • Create separate files for different parts of the game logic (gravity, bonuses, etc.)
    • Organize the code logically and intuitively
  6. Test the new implementation
    • Ensure that all existing functionalities work correctly after refactoring
    • Add new unit tests if necessary

Acceptance Criteria:

  • The game functions identically to the previous version
  • The code is more readable and easier to maintain
  • The animations are smooth and performant
  • The new architecture facilitates the addition of new features

Feel free to discuss this refactoring in the comments if you have any questions or additional suggestions.

@Cheelax Cheelax added enhancement New feature or request refactoring ODHack7 labels Aug 20, 2024
@Iwueseiter
Copy link

Iwueseiter commented Aug 20, 2024

Hi @Cheelax can I work on this?
I’ve gone through the task description and I’m open to work on it.
I’d make sure to meet up with the expected criteria. And I will deliver within 3 to 4 working days.

Here is how I would work on the issue:
I’d define an interface that encapsulates all game state properties as stated in the description.
Then using react, I’d create and manage a centralize state of the game logic.
I’d create a custom hook to manage the game state and provide the methods to manipulate the state.
I would make sure to break down the code into smaller components that will focus on specific part of the game state and UI making it easier to manage and test.
I will integrate an animation system and also implement an event system for the game. I would separate concerns into distinct files for better code organization.
Finally, I will carry out unit testing to ensure all functionalities work as expected and I’d write new tests if need arises. And also regression testing to ensure the game behaves as before refactoring.

@od-hunter
Copy link

Hi @Cheelax , can I be assigned this please?

@Jemiiah
Copy link

Jemiiah commented Aug 21, 2024

I would love to work on this issue @Cheelax

@GoSTEAN
Copy link

GoSTEAN commented Aug 21, 2024

@Cheelax Can this be assigned to be?

@CollinsC1O
Copy link

Hi @Cheelax i will love to be assigned this issue. I'm a frontend and blockchain developer and this is the following ways inwhich i could solve this issue:

To refactor the GameBoard component:

Centralize Game State: Define a GameState interface and manage state using context or state management.

Create a Custom Hook: Move game logic to useGameLogic for state manipulation and game rules.

Modularize Components: Break GameBoard into smaller components like ScoreDisplay and Grid.

Add Animations: Use React Spring or Framer Motion for animated game elements.

Implement Event System: Use a game event context for component interactions.

Organize Code: Separate logic into distinct files for clarity.

Test Thoroughly: Ensure functionality and add new tests as do needed.

@martinvibes
Copy link

martinvibes commented Aug 21, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i'm a fullstack dev and i have skills in react, typescript, next.js, tailwind, sass, boostrap etc. i would love to work on this i i'm giving the oppotunity

How I plan on tackling this issue

Create Centralized GameState: Define a GameState interface to store all game state data.
Develop Game Logic Hook: Move most game logic into a custom hook, useGameLogic.
Divide GameBoard: Create smaller components for ScoreDisplay, BonusPanel, Grid, NextLineDisplay, etc.
Integrate Animation System: Use React Spring or Framer Motion for animations.
Implement Event System: Use a game event context to manage component interactions.
Separate Concerns: Create separate files for different parts of the game logic.
Test New Implementation: Ensure all functionalities work correctly and add new unit tests.

@od-hunter
Copy link

od-hunter commented Aug 22, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, please I'd love to be given the opportunity to contribute to this rep, I am a blockchain developer html, css, react, JavaScript, typescript, solidity and Cairo. I'd love to be given the opportunity to contribute to this repo

How I plan on tackling this issue

To solve this issue, I'd take the following steps:

  1. I'll create a GameState object and interface to manage all game aspects.
  2. I'll develop a custom hook(implement a useGameLogic hook for key game logic functions.
  3. I'll divide into Components: Break GameBoard into specialized components (e.g., ScoreDisplay, Grid).
  4. Next, I'll integrate Animations: Use React Spring or Framer Motion for smooth animations.
  5. I'll organize code, that is to separate concerns into distinct files for better structure.
  6. Lastly, I'll test thoroughly to ensure the game functions correctly with the new architecture.
    Please assign this issue to me, I'm ready to work

@Iwueseiter
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi @Cheelax can I work on this?
I'm a frontend smart contract developer and I've contributed to projects here on onlydust. with this experience, I'd implement the task as expected
I’ve gone through the task description and I’m open to work on it.
I’d make sure to meet up with the expected criteria. And I will deliver within 3 to 4 working days.

How I plan on tackling this issue

Here is how I would work on the issue:
I’d define an interface that encapsulates all game state properties as stated in the description.
Then using react, I’d create and manage a centralize state of the game logic.
I’d create a custom hook to manage the game state and provide the methods to manipulate the state.
I would make sure to break down the code into smaller components that will focus on specific part of the game state and UI making it easier to manage and test.
I will integrate an animation system and also implement an event system for the game. I would separate concerns into distinct files for better code organization.
Finally, I will carry out unit testing to ensure all functionalities work as expected and I’d write new tests if need arises. And also regression testing to ensure the game behaves as before refactoring.

@martinvibes
Copy link

martinvibes commented Aug 22, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i'm a fullstack dev and i have skills in react, typescript, next.js, tailwind, sass, boostrap etc. i would love to work on this i i'm giving the oppotunity

How I plan on tackling this issue

Create Centralized GameState: Define a GameState interface to store all game state data.
Develop Game Logic Hook: Move most game logic into a custom hook, useGameLogic.
Divide GameBoard: Create smaller components for ScoreDisplay, BonusPanel, Grid, NextLineDisplay, etc.
Integrate Animation System: Use React Spring or Framer Motion for animations.
Implement Event System: Use a game event context to manage component interactions.
Separate Concerns: Create separate files for different parts of the game logic.
Test New Implementation: Ensure all functionalities work correctly and add new unit tests.

@Benjtalkshow
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi @Cheelax

I’m available to take on the task of refactoring the GameBoard component to enhance its structure, modularity, and suitability for animation. My name is Benjamin, and I have extensive experience with TypeScript and frontend development, including refactoring and optimizing complex UI components.

Understanding the Issue

The current GameBoard component is monolithic and challenging to maintain, especially as the game logic and UI grow more complex. Refactoring the component will improve the codebase’s structure, making it more modular and easier to extend, and will facilitate smooth animations.

How I plan on tackling this issue

Create a Centralized Game State (GameState)

  • Define Interface: I will define a GameState interface that includes all aspects of the game’s state, such as the grid, score, combo, bonuses, etc.
  • Centralization: This centralized state will make it easier to manage and manipulate game data.

Develop a Custom Hook for Game Logic (useGameLogic)

  • Game Logic: I will move the majority of the game logic into this custom hook, including methods like movePiece, applyGravity, and clearLines.
  • Modularity: This will help keep the GameBoard component focused on rendering, while game logic is handled separately.

Divide GameBoard into Smaller, Specialized Components

  • Component Creation: I will create separate components for ScoreDisplay, BonusPanel, Grid, NextLineDisplay, etc.
  • Responsibilities: Each component will have a clear, distinct responsibility, improving code readability and maintainability.

Integrate an Animation System

  • Animation Handling: I will use React Spring or Framer Motion to handle animations.
  • Animated Components: Animated components will be created for game cells and pieces, enhancing the visual experience.

Implement an Event System for the Game

  • Game Event Context: I will create a game event context to manage interactions between components.
  • Event Management: This system will help streamline communication and events within the game.

Separate Concerns into Distinct Files

  • File Organization: I will create separate files for different parts of the game logic (e.g., gravity, bonuses).
  • Code Organization: The code will be organized logically and intuitively, making it easier to navigate and maintain.

Test the New Implementation

  • Functionality: I will ensure that all existing functionalities work correctly after refactoring.

@josephchimebuka
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello @Cheelax I am Joseph Chimebuka I'm a full-stack software developer with 4+ years of experience in crafting innovative products. I've built a range of projects, including https://mattedsgn.vercel.app/ and https://metacrypt.vercel.app/ showcasing my expertise in React, Next.js, and blockchain technologies. I'm also an active contributor onlydust. here's my account https://app.onlydust.com/u/josephchimebuka.

How I plan on tackling this issue

I will ensure that the acceptable criteria for submission has been met before sending a pull PR and I will send it ASAP

@Cheelax
Copy link
Contributor Author

Cheelax commented Aug 22, 2024

Hi everyone.
There is a new process for the ODHack, now you must apply to the tasks directly from Onlydust: https://app.onlydust.com/hackathons/odhack-70
We will only look at application made via this process.

Copy link

onlydustapp bot commented Aug 22, 2024

The maintainer Cheelax has assigned od-hunter to this issue via OnlyDust Platform.
Good luck!

This was referenced Aug 27, 2024
Copy link

onlydustapp bot commented Sep 11, 2024

Hey @Dprof-in-tech!
Thanks for showing interest.
We've created an application for you to contribute to zKube.
Go check it out on OnlyDust!

@Iwueseiter
Copy link

Hi @Cheelax

Hi @Cheelax can I work on this? I’ve gone through the task description and I’m open to work on it. I’d make sure to meet up with the expected criteria. And I will deliver within 3 to 4 working days.

Here is how I would work on the issue: I’d define an interface that encapsulates all game state properties as stated in the description. Then using react, I’d create and manage a centralize state of the game logic. I’d create a custom hook to manage the game state and provide the methods to manipulate the state. I would make sure to break down the code into smaller components that will focus on specific part of the game state and UI making it easier to manage and test. I will integrate an animation system and also implement an event system for the game. I would separate concerns into distinct files for better code organization. Finally, I will carry out unit testing to ensure all functionalities work as expected and I’d write new tests if need arises. And also regression testing to ensure the game behaves as before refactoring.

Hi @Cheelax can I work on this?

@Verifieddanny
Copy link

Can I take this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants