meisei4 / yakuzaishi

1 stars 0 forks source link

World Inspector Related #9

Closed meisei4 closed 1 month ago

meisei4 commented 4 months ago

Add a debug stem to query custom entities and get info

louiswulterkens commented 4 months ago

Just to start the ball rolling on this, it looks like Rust has a concept of Traits which could be applied to Types. I can envision making a Trait on most of your entities which could be a toString-ish method for important parameters, and you implement it on all your entities to make it super easy to print something out in any given spot.

Implement the toString once, you can then call that toString method on any of your entities and it'll spit out a string of whatever format you want. Also, since it goes directly to console logging, hopefully this means you don't need to worry about borrow checking or anything like that. Just a single line vomit and you're back to your regularly scheduled programming.

Not sure if that's what you mean by "Debugging", this is a very loose interpretation of "query" (select all params) to vomit into console.

Forgot to provide link: https://doc.rust-lang.org/book/ch10-02-traits.html

meisei4 commented 4 months ago

I did some searching through the discord about debugging and luckily found this thread of a person struggling with debugging issues with spawning an Entity. https://discord.com/channels/691052431525675048/1246691257754062878

And the second comment led me to https://github.com/jakobhellermann/bevy-inspector-egui which is exactly the tool I was looking for.

At this point it looks like strapping a full fledged custom GUI for live game asset/resource manipulation is not that far off 😭😭😭😭😭

For now I am very happy with the capabilities of the WorldInspector, which i think really helps in minimizing the need for even stuff like utility based "logs". Since its so easy to just run the game and then navigate the Inspector tab to find potential issues.

meisei4 commented 4 months ago

I will keep this issue open thought because I still have some things i want to add later related to adding components that integrate with the WorldInspector. So far I have only added the "Name" feature.