amethyst / amethyst/specs

How to visualize the storage while debugging?

Abierto
#715 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
2.6k
Forks
215
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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!?

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.