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

How to visualize the storage while debugging? #715

Open
selvavm opened this issue Dec 5, 2020 · 0 comments
Open

How to visualize the storage while debugging? #715

selvavm opened this issue Dec 5, 2020 · 0 comments

Comments

@selvavm
Copy link

selvavm commented Dec 5, 2020

First of all, this is a wonderful crate. I loved working on it and it forces me to follow the ECS principles. Thanks for your contribution,

My Setup:
I have N entities and I modify components using couple of systems independently using Dispatchers. Once it is completed, I have to pick some entities and derive some metrics (see below).

 // For example, after dispatcher I wanted to get the total heath and then end the program
 let health_storage = world.read_component::<Health>();
 let pl1_health = health_storage.get(pl1).unwrap(); // I want to avoid this
 let pl2_health = health_storage.get(pl2).unwrap(); // I want to avoid this
 let total_health = pl1_health + pl2_health;
 println!("{}", total_health);
 // Since I am working with multiple entities, I didnt do these lines as a system
 // When I set breakpoint, health_storage is shown as pointers

Now the challenge is, if I debug this using Visual C++ or llvm in VSCode, the health_storage is not showing the values. It only shows pointers and I have to use get(Entity) to visualise. I would have been happy if I can execute the command directly while debugging (like watch commands) but Rust has issues with calling trait functions.

Recently, I came to know about NatViz which help in improving visualisation while using Visual C++ debugger. In fact, I modified it to support NDArray and it works like a charm. I wanted to do the same with Storage but don't know how to list the entities-component pair. Can you help me?

image

One more question, how do you guys debug? Do you use println!?

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

No branches or pull requests

1 participant