Rustydoku — a Puzzle Game for True Rustaceans

Rustydoku — A Puzzle Game Built with Rust (Feedback Welcome!)

Hi Rustaceans! :crab:

I recently built a small game in Rust called Rustydoku — a puzzle game inspired by Woodoku. It’s a simple concept: you place blocks on a 9x9 grid and earn points by filling 3x3 squares, rows, or columns.


GitHub Repository

View Source Code on GitHub

The code is open source and licensed under MIT. Feel free to clone, explore, and comment!


Play Online

You can try the game right now in your browser — no installation needed:

Play on Itch.io


Gameplay Summary

  • Place puzzle pieces on a 9x9 grid
  • Clear space by completing:
    • A fully filled 3x3 block
    • A full row or column
  • Each cleared combo gives 9 points
  • The longer you last, the harder it gets!

Looking for Feedback

I'd really appreciate any feedback on the code:

Is architecture reliable?

Are there Rust-specific idioms I’m missing?

Any performance tips?

Suggestions to improve gameplay or user experience?

Or anything else you'd like to share!

I’m also interested in how people structure games like this in Rust — so feel free to share examples or best practices.

Thanks for reading and playing!
Feel free to leave comments here or in the GitHub Issues section.
Cheers! :crab:

5 Likes

I'm on the mobile rn, so I'll have to check the code tomorrow, but in the meantime I made it to a score of 225 :grinning_face_with_smiling_eyes:

2 Likes

Even I didn't score that many points). I am waiting for the code review)


Next time there will be more scores)

1 Like

I only got a black screen when I clicked run on my old android on firefox. On my debian firefox it works smooth. Fun game. ( I stopped playing after I beat firebits, could have gone farther.)

2 Likes

This is what I got on my third attempt :grinning_face_with_smiling_eyes:

1 Like

I got the same on Vivaldi, you just have to let it load (at least, I did).

Fun game! My only suggestion would be to have an alternative method of placing them on mobile; the overlay when you place them is super helpful, but with small pieces, it's often obscured by your finger. Otherwise, this is a fun and nicely polished experience!

1 Like

It seems to me that the game may simply take a long time to load on an old phone. I added a loader bar so that there is not just a black screen)

Also, if your browser does not support WebGL2, there will be an alert

1 Like

Thanks for the improvement tip! I added a logic Y offset when you grab the figure by your finger, so the figure itself is more visible. You can test it - https://skalse.itch.io/rustydoku

I'd be glad to hear something else, maybe even code)

1 Like

Rustydoku in Android device)

Download from Google Play

Hi, you can now test Rustydoku on Android. I'm still waiting for code review, by the way)

This is a really fun little game!

I feel like you need to make it more obvious when placing a particular block would clear something. The game board is laid out like Sudoku so I was assuming you can only clear 3x3 squares with the same colour, so I was surprised when rows/columns would start disappearing[1]. Maybe add some sort of visual queue like flashing the pieces that might be cleared?

I wouldn't call it an idiom, but I've noticed you have lots of really little modules, which means a reader needs to jump around between files a lot when navigating the code. It's not the end of the world, but can get a bit annoying. That also forces you to make loads of internal details pub so they are accessible.

Having src/constants/world/camera.rs and src/components/world/camera.rs be separate files is also pretty annoying. Especially when your src/components/world/camera.rs is a 5-line module that just exposes a component struct. It seems like unnecessary organisation that hurts discoverability.

Instead of having separate modules for constants, I would move the constants next to the code that uses them.

You've also got loads of "dumb" components (i.e. structs that just carry data and have no associated behaviour). In cases like this, it's often easier to merge all the components related to a particular system into the same module.

You've also organised your modules by "kind" (constants, events, components, logic, states, etc.) when it is much better to organise things by "system" (ui, dragging, spawner, scoring, etc.). The idea is to keep related things closer together because that makes things more maintainable and discoverable. Plus, you can often use privacy to make sure one system can't inspect another system's internals, which keeps things more decoupled and therefore easier to maintain and reuse.

I'd probably create a module for each game system and give it a corresponding Bevy plugin that runs its logic. All components and constants would be private by default and only made pub if other systems need to access them.

I also struggled to find the code that decides when to clear a 3x3, column, or row, just because there are so many files in that diff and everything is so spread out.


  1. I know you mentioned it in the gameplay summary, but I probably skimmed over that. ↩︎

5 Likes

Thank you for these tips!

I wrote about the game mechanics above, but I think the visual effect would be cool to implement.

I like small modules, I thought it would actually improve readability if I separated the components like that. Maybe I overdid it) Or it's just better to do as you wrote, separate them into services and have the necessary things there.

Can you give examples of this? I don't really understand what you mean.

This is frustratingly addictive

1 Like

I got frustrated waiting for a figure that never came, and...

// src/logic/figure/spawner.rs#L93-L98
let rotation_angle = match rng.gen_range(0..3) {
    0 => 90.0_f32.to_radians(),
    1 => 180.0_f32.to_radians(),
    2 => 270.0_f32.to_radians(),
    _ => 0.,
};

Don't these lines mean that rotation_angle will never be zero?


But yes, great work @skalse !

3 Likes

Oh my god, you're right!!! Sorry, that was very careless..

the pieces are mostly 1-5 icons , i suggest to increse the number of icons per piece to 1-7 or 1-8

1 Like

What exactly do you mean to increase the variations of figures and make more piece in them?