davidpol/SurvivalShooterECS

Are the two repos different? Some other questions if you don't mind!

Closed this issue · 3 comments

Hey there,
I am trying to figure out if this repo is different from the SurvivalShooterHybridECS repo. I downloaded both thinking one was pure and one was hybrid, but in the one not labeled as hybrid (this one), I went to look at the player prefab and it looks the same as the hybrid one. I expected it to be different I suppose? I am having trouble figuring out what actually constitutes something as being "pure ecs". I know it means there is no actual gameobject and it is just an entity, but in order to create an entity don't you first have to make an empty gameobject and then add GameObject Entity component to it? Or is anything that has GameObject Entity on it automatically a hybrid ECS item?

The main thing I am trying to figure out is, I have a car prefab that has the windows and wheels as child items and I am trying to figure out how to properly make it a hybrid ecs item. I see that your player gameobject has child items on it, was under the impression that things with gameobject entity on them could not have that? What I did with my car was I made an empty gameobject, added a RenderMesh Component on it and used that to add the body of the car and the material. Then added the position, rotation, movementspeed, and a custom VehicleData components to it (which has a destination position in it so I know where to make the car move toward). I was able to move that using a job, but that ends up being just the body of the car, the windows and wheels were child objects of the original prefab, so I am not sure how I am supposed to properly include them and make them part of the car in either pure or hybrid ecs and I can't seem to find a proper explanation on what actually makes one or the other.

Sorry for the wall of text, and if you don't care to answer my second question, that is cool too, I definitely understand, lol.

No worries at all!

Both projects use the hybrid ECS indeed, but this one is more up-to-date with current ECS practices (not using injection, leveraging jobified systems where possible). It is pretty hard to go the pure ECS route as of today, because it basically means writing your own renderer, physics, animation system, etc. from scratch. My goal with this project is to keep on upgrading it in the future, as more core engine features become available to the ECS.

With regards to your hierarchy question, I believe this section of the documentation may be useful (in particular, the Attach component).

Hey there,
I appreciate the reply. A little while after I posted this I was able to figure out most of my issue. After I looked over this project a bit more I realized when using the GameObject Entity component, you can just use it on a normal prefab, it doesn't have to be on an empty game object with a bunch of ECS only components, so I just threw a GameObject Entity on my normal prefab and it was fine like that, lol : D I just need to research trying to move it using JobComponentSystem as opposed to a Monobehavior with IJobParallelForTransform inside it. Did you happen to come across that at all?

I definitely appreciate the time and effort you took to create the systems you did. I want to look them over a bit more when I get home from work to see if there is anything else that might help me out. It seems I now know just enough to make myself more confused, lol, so just going through tons of code until I see things that "click" and make sense seems like the best thing to do currently.

Thanks again,
-MH

That is right; the way I think of it is like this:

  • GameObjectEntity: It automatically creates a backing entity for the game object it is attached to.
  • ComponentDataWrapper<>: It allows you to initialize a component for that backing entity from the inspector.

Then, in code, you can do

go.GetComponent<GameObjectEntity>().Entity

and play with the backing ECS entity. I am sure we will get more convenient editor tooling around ECS in the future (similarly to what Project Tiny does).

I still have not explored transforms in a pure ECS setting, so unfortunately cannot offer any specific advice there.