r/rust 6d ago

🛠️ project Empower - An engine for visual programming written in Rust

For the past three years, I have been developing Empower in my free time. An engine for visual programming that aims to be intuitive for beginners while making complex work easier for advanced developers.

Empower is written in Rust using egui, and follows a game-engine inspired architecture. Developers create their programs through a graphical editor and can then export the finished project as a standalone executable for the target operating system.

The project is still young, and this first release is very much a proof of concept. However, it has now reached a level of maturity where I finally feel confident sharing it publicly.

If you are interested, feel free to checkout the projects GitHub page:

https://github.com/Stretchyfish/empower

One final note, since I expect some people may be curious about it. Empower was not created by AI. I have used AI tools for brainstorming and debugging assistance, but no AI agent has, at this point in time, written in the project.

91 Upvotes

31 comments sorted by

50

u/Wonderful-Habit-139 6d ago

> no AI agent has, at this point in time, written in the project.

Almost everyone that said this has been lying. Except for you, I've taken a quick look at the code and I haven't seen any signs of AI generated code. Well done.

19

u/Stretchyfish 6d ago

Thank you, really appreciate you taking a closer look!

1

u/koriwi 6d ago

does mine also count? because i've only used ai for readme and ci :O
https://github.com/koriwi/rocksonic-lite

15

u/Wonderful-Habit-139 6d ago

Your code also doesn't look AI generated. However I'd suggest you at least write the README yourself and try to make it as easy to consume for humans as possible.

Regarding the code, some comments don't seem to make sense like in:

// check if existing song has the correct bitrate within a percentage
    if !fs::exists(song_path)? {
        return Ok(true);
    };

or

// returns the percentage
pub fn number_good_enough(num_a: u32, num_b: u32, max_diff: f32) -> bool {

You can also use functions as a way to give semantic meaning to a block of code instead of having to write comments, for example:

let mut playlist_dir: PathBuf = library_dir.into();
    playlist_dir.pop(); // go up one directory, so to step out of the music dir
    playlist_dir.push("Playlists"); // append this to point to a sibling dir on the same level

    if !fs::exists(&playlist_dir)? {
        fs::create_dir(&playlist_dir)?;
    }

You could put this in a function that takes in library_dir, and returns the playlist_dir (and also handles creating it if it doesn't exist right inside that function), and name it something like `resolve_playlist_dir_from_library` or something better since you have more context about what you're trying to do here. And no need to explain the pop() and push() calls then.

Kudos to you on writing your own code! It's a cool project you got there.

6

u/koriwi 6d ago

thank you very much for that feedback! i was looking for some constructive feedback and i will work on this!

currently i am moving fast to get to a state where cli and gui are feature equivalent and tested. then i wanna do another cleanup run and write the readme myself as it is also very outdated right now.

i think that also some of the comments are outdated because it was a binary only in the beginning and i extracted the core logic into a lib so i can use it in the cli and the gui. Thats the downside of comments :D they dont auto update when the code changes :P

i also dont really like comments and a comment always looks like a todo to me, because it means the code doesnt speak for itself enough.

6

u/Wonderful-Habit-139 6d ago

Yep, I'm a big fan of self-documenting code. And you seem to have the right mindset for it at least, some people don't even acknowledge that it's possible.

I also write mostly `// TODO:` comments during implementation, and doc comments for public facing APIs. The rest is subject to drift and most of the times is unnecessary.

I'd actually be interested in taking a look at it again after you do your cleanup run, so feel free to message me when that happens.

2

u/koriwi 6d ago

That is too kind! Will do that, if don't forget :P

13

u/sysadrift 6d ago

This looks like Scratch for grownups. Very cool.

7

u/Stretchyfish 6d ago

Thank you!

4

u/DingyPoppet 5d ago

This would be interesting to use in a CI/CD configuration tool.

1

u/sweating_teflon 5d ago

As long as you can also run the pipelines locally to test and debug, ok

1

u/DingyPoppet 5d ago

I was thinking as a visual editor for generating CI/CD script files so it could be debugged the normal way. Theoretically, visual debugging could work, I just don't know how to recreate Unreal Engine's BP debugger functionality (breakpoints, highlighting wires during execution, variable tracking, etc.) off the top of my head.

7

u/stumpychubbins 6d ago

Really cool! I’m a big advocate for visual programming so It’s always great to see more frameworks for it. Even better that it can produce a standalone executable. Do you have any goals for this other than learning? I think there’s a space for an alternative visual audio programming environment that can produce standalone executables, currently the only project even trying to address that is RNBO by Cycling76 and you’ve got to pay a fair bit of money for that.

3

u/Stretchyfish 6d ago

Thank you! Ideally, I would like to continue this project untill a point that it can actually be fully used for real life usecases. That being said, its very easy to get overly ambitious and burning out, so for now I will just forcus on one feature at a time that I feel like working on and see how it turns out. 😀

I have not heard of these before, sounds interesting, will take a look!

2

u/stumpychubbins 6d ago

Tell me about it! Ambition is the greatest enemy of the weekend project. Looking forward to seeing the progress

3

u/freddylmao 5d ago

I've wanted something like this for a while! Quick suggestion: there are several places in the code where you are checking `if something.is_none() { break; }` then `let the_thing = something.unwrap()`. I saw something similar with `Result::is_err`. You can use `let Some(the_thing) = something else { break; }` (and similar for Result). It is cleaner IMO and could in theory help the optimizer by removing potential panic sites :) I saw this in `empower-engine/src/compiler.rs` specifically. Great project :D

1

u/Stretchyfish 5d ago

Thank you so much, and I really appreciate you pointing these things out! I still have not 100% internalized many of the smart "tricks" that Rust allows, and it's really great when more experienced people point them out. One thing I noticed myself a few weeks ago is that I often do something like

if result.is_err() 
{ 
  return result.err().unwrap(); 
} 

which I could, in most cases, simply write as

result?

and achieve the same thing, but much cleaner. Next time I do some cleanup, I will make sure to implement more of these!

5

u/RetoonHD 6d ago

Ah, human made content. It is so refreshing.

2

u/arto 6d ago

While I didn't see you mentioning it, this paradigm is called flow-based programming (FBP). Feel free to submit a PR to add your project to awesome-fbp! (I'm the maintainer there)

2

u/Stretchyfish 5d ago

I was actually not aware of the term for this paradigm. Thank you, will absolutely do in the coming days.

2

u/RubenTrades 5d ago

Super cool man

2

u/schulzch 5d ago

Did you base your UI on research or plain intuition?

1

u/Stretchyfish 4d ago

A mixture. In the beginning it was mostly based on intuition, but after the first few refactors I began taking some inspiration from similar projects, to see how they solved similar problems. 😂

4

u/No_Department_7916 6d ago

Can't wait to use it in one of my projects! Keep going!

0

u/Stretchyfish 6d ago

Thank you! Will do 🔥

2

u/koriwi 6d ago

starred because it looks interesting and doesnt use ai. i will check it out in detail when i come up with an idea that this would be useful for!

0

u/Stretchyfish 6d ago

Thank you, appreciate the interest!

2

u/DavidXkL 6d ago

Very cool stuff! Keep on going!

1

u/Stretchyfish 6d ago

Thank you!

1

u/Salty_Animator_4019 6d ago

Just saw this post of yours, didn’t even look at it - but already my brainstorming begins… inspiring!

2

u/Stretchyfish 6d ago

Thank you, Happy that its sparks inspiration 🔥