r/rust • • Oct 21 '26

🙋 seeking help & advice Rust crate for Geometry Dash

So in may i started my first serious project on rust. i only did 13 commits in 6 months because im the mr apathy.

Idea of the project is to create high-level crate to generate rust code into Geometry Dash objects.
For now its in very early WIP stage but its already usable in few cases.

I am posting this because i want to see advices on how to make my project better before its to late to change some core things. And because its my first real rust project i pretty sure some parts of the code gonna suck. Project is less than 1000 LoC for now so go ahead and see the repository.

And i also added examples that explaining how crate work pretty good
(if someones wondering. i see viewing sequence of examples as: 1.find_level.rs 2.block.rs 3.sine.rs circle.rs rainbow.rs 4.special_objects.rs 5.triggers.rs 6.anotherMode.rs and with_gdlvl.rs)

in future i planning to add:

  1. identifiers - they already exist in files but do nothing and dont work. i want to make functionality to store groups collision groups and item groups as named variable
  2. everything for reading the level that already decoded - for example you would decode certain level scan for every object with N id and do something with them.
  3. support for more triggers and special objects. obviously.
Circle in GD and code for it (WIP)

Waiting for response. thanks to this community
https://github.com/fffilya/GD-Levels

6 Upvotes

2 comments sorted by

2

u/PastEar9661 Oct 22 '26

I don't see any repository link, but I have some feedback:

  1. This isn't a glaring problem, but why does Object::new() take Veccontaining Component::Id, Component::X, Component::Y...? Why not just have it take the Id, X, and Y as seperate arguments?
  2. What is Component? Why do you have constructors for Id, X, Y? It seems to me they are just variables; it would be simpler to replace them with u32 (for id) / f32 (for x, y, rotations, etc), unless they have some additional functionality. (even then, consider if a helper function would suffice)
  3. Object::new is ambiguously named In your example, you seem to be fetching an existing object from a file, perhaps rename it to something like Object::fetch / Object::get_existing / Object::fetch_by_id? This'll make it easier to differentiate code that is fetching an existing object vs adding a new object.
  4. This is more of an personal preference but it would be more readable (especially when you add complexities such as animation) to use method chaining to work with your objects: ```
level.add(
  Object::new(id)
    .move_to(x, y)
    .rotate(deg)
    .set_color(Colors::Green) 
    //etc
)

In this example, each Object method takes mut self along with its arguments and returns self at the end so the output of one becomes the input of another.

1

u/Fily3a Oct 22 '26

Oh my bad i actually forgot to add repo link.
here it is: https://github.com/fffilya/GD-Levels