amethyst / amethyst/specs

How to visualize the storage while debugging?

Aperta
#715 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
2.6k
Fork
215
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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::();
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](https://user-images.githubusercontent.com/16543422/101239051-9ab9ca80-370a-11eb-8edc-a1896c4625ad.png)

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.