Post by Admin on Jul 16, 2016 4:34:59 GMT
Mike Cann @mikecann Nov 04 2015 16:26
Hey hey
I have am working on an example project testing out Entitas, made a few notes while I am working on it
I can share them here if you like?
Simon Schmid @sschmid Nov 04 2015 16:30
@mikecann sure, hearing your feedback would be great
Mike Cann @mikecann Nov 04 2015 16:31
Okay, firstly im finding that deleting code is a pain with the compiler errors
not sure there is much you can do about that
if I delete a component for example it may be nice if it auto-deleted the generated stuff
infact while you are there, whenever I make a change to something it would be great if the generator ran
every single time
even if the app cant compile
is there a reason we couldnt have a watch setup which auto-generates on file changes?
I could add this as a github issue marked as a feature suggestion..
(im using Unity BTW)
Simon Schmid @sschmid Nov 04 2015 16:35
Auto generation is not the problem. The main problem with the current code generator is, that it is only able to compile if there are no compile errors...
Mike Cann @mikecann Nov 04 2015 16:35
How come?
Why cant it just watch for changes to dir structure
Simon Schmid @sschmid Nov 04 2015 16:35
It uses reflection
Mike Cann @mikecann Nov 04 2015 16:36
Ahh
Does that preclude Roslyn
Simon Schmid @sschmid Nov 04 2015 16:36
That means, if there are compile errors, you the generator still works on the previous dll
Mike Cann @mikecann Nov 04 2015 16:36
or can Roslyn work with compile errors?
can you just throw a number of cs files at it and it will work?
Simon Schmid @sschmid Nov 04 2015 16:37
In the wiki you can find a link, someone already did a Roslyn version.
Mike Cann @mikecann Nov 04 2015 16:37
okay cool ill check it out, I wonder if it will work with Unity
Simon Schmid @sschmid Nov 04 2015 16:38
A Roslyn based generator would solve a lot of problems
Mike Cann @mikecann Nov 04 2015 16:38
Okay
Next thing
It would be awesome if you didnt have to manually add the systems to the Systems object
if you could just tell it to add everything that looks like a system in the assembly
If the order is important you could decorate them with an attribute or something
Simon Schmid @sschmid Nov 04 2015 16:43
Maybe one of the most important things about systems is the order. Depending on the setup of your systems, they might meetadditional initialization. Also, eventually you'll have different phases in the game, where a different set of systems should be executed.
Adding them manually gives you the flexibility and freedom to build whatever you want
Mike Cann @mikecann Nov 04 2015 16:46
True, tho I think an extension to Systems something like .AddAllSystemsInAssembly(); would be great, sure it may less flexible than manually adding each system individually but in the beginning it would get you going faster and remove some friction. Its just a util really
anyways just a thought as I was finding it frustrating writing a system, alt tabbing into unity running the game, wondering why my feature wasnt working for a few seconds then having to jump back to the code and look around for a while, then remember that I didnt add the system, then go back to Unity, compile again and run
anything that can remove that initial frustration and friction for a new user would be awesome
Making games using entity systems IMO is so much more fun
Mike Cann @mikecann Nov 04 2015 17:52
something else, im not sure if im doing something wrong, but it would be awesome if ReplaceComponent would allow you to only replace one or two of the variables
Simon Schmid @sschmid Nov 04 2015 18:04
Yeah, I was thinking about adding convenient methods to replace components that don't take all arguments.
On the other hand, components often don't have more than one or two fields. You can also just reuse existing values:
var pos = e.position; e.ReplacePosition(10, pos.y, pos.z);
Mike Cann @mikecann Nov 04 2015 18:05
yep thats what im currently doing, still its another nicety
Another nicety would to have reactive systems that operate on a single entity
so exactly the same as ReactiveSystem except instead of public void Execute(List<Entity> entities) its public void Execute(Entity entity)
the calling logic handles the for each loop for you
as 99.9% of reactive systems look something like: public void Execute(List<Entity> entities) { foreach (var entity in entities) { ... } }
Mike Cann @mikecann Nov 04 2015 18:45
hmm
github.com/esterlus/Match-One-Multiplayer/blob/master/Assets/Sources/Features/RenderResource/RemoveViewSystem.cs
the OnEntityWillBeRemoved
that doesnt seem to be in the lib
Mike Cann @mikecann Nov 04 2015 18:54
need it so I can remove views when the entity is destroyed
Mike Cann @mikecann Nov 04 2015 19:04
Ah its forked from here: github.com/sschmid/Match-One/blob/master/Assets/Sources/Features/RenderResource/RemoveViewSystem.cs
Hmm this is the way to do it? ``` public void SetPool(Pool pool) {
pool.GetGroup(Matcher.View).OnEntityRemoved += onEntityRemoved;
}
void onEntityRemoved(Group group, Entity entity, int index, IComponent component) {
var viewComponent = (ViewComponent)component;
var gameObject = viewComponent.gameObject; ```
Okay it works
Hey hey
I have am working on an example project testing out Entitas, made a few notes while I am working on it
I can share them here if you like?
Simon Schmid @sschmid Nov 04 2015 16:30
@mikecann sure, hearing your feedback would be great
Mike Cann @mikecann Nov 04 2015 16:31
Okay, firstly im finding that deleting code is a pain with the compiler errors
not sure there is much you can do about that
if I delete a component for example it may be nice if it auto-deleted the generated stuff
infact while you are there, whenever I make a change to something it would be great if the generator ran
every single time
even if the app cant compile
is there a reason we couldnt have a watch setup which auto-generates on file changes?
I could add this as a github issue marked as a feature suggestion..
(im using Unity BTW)
Simon Schmid @sschmid Nov 04 2015 16:35
Auto generation is not the problem. The main problem with the current code generator is, that it is only able to compile if there are no compile errors...
Mike Cann @mikecann Nov 04 2015 16:35
How come?
Why cant it just watch for changes to dir structure
Simon Schmid @sschmid Nov 04 2015 16:35
It uses reflection
Mike Cann @mikecann Nov 04 2015 16:36
Ahh
Does that preclude Roslyn
Simon Schmid @sschmid Nov 04 2015 16:36
That means, if there are compile errors, you the generator still works on the previous dll
Mike Cann @mikecann Nov 04 2015 16:36
or can Roslyn work with compile errors?
can you just throw a number of cs files at it and it will work?
Simon Schmid @sschmid Nov 04 2015 16:37
In the wiki you can find a link, someone already did a Roslyn version.
Mike Cann @mikecann Nov 04 2015 16:37
okay cool ill check it out, I wonder if it will work with Unity
Simon Schmid @sschmid Nov 04 2015 16:38
A Roslyn based generator would solve a lot of problems
Mike Cann @mikecann Nov 04 2015 16:38
Okay
Next thing
It would be awesome if you didnt have to manually add the systems to the Systems object
if you could just tell it to add everything that looks like a system in the assembly
If the order is important you could decorate them with an attribute or something
Simon Schmid @sschmid Nov 04 2015 16:43
Maybe one of the most important things about systems is the order. Depending on the setup of your systems, they might meetadditional initialization. Also, eventually you'll have different phases in the game, where a different set of systems should be executed.
Adding them manually gives you the flexibility and freedom to build whatever you want
Mike Cann @mikecann Nov 04 2015 16:46
True, tho I think an extension to Systems something like .AddAllSystemsInAssembly(); would be great, sure it may less flexible than manually adding each system individually but in the beginning it would get you going faster and remove some friction. Its just a util really
anyways just a thought as I was finding it frustrating writing a system, alt tabbing into unity running the game, wondering why my feature wasnt working for a few seconds then having to jump back to the code and look around for a while, then remember that I didnt add the system, then go back to Unity, compile again and run
anything that can remove that initial frustration and friction for a new user would be awesome
Making games using entity systems IMO is so much more fun
Mike Cann @mikecann Nov 04 2015 17:52
something else, im not sure if im doing something wrong, but it would be awesome if ReplaceComponent would allow you to only replace one or two of the variables
Simon Schmid @sschmid Nov 04 2015 18:04
Yeah, I was thinking about adding convenient methods to replace components that don't take all arguments.
On the other hand, components often don't have more than one or two fields. You can also just reuse existing values:
var pos = e.position; e.ReplacePosition(10, pos.y, pos.z);
Mike Cann @mikecann Nov 04 2015 18:05
yep thats what im currently doing, still its another nicety
Another nicety would to have reactive systems that operate on a single entity
so exactly the same as ReactiveSystem except instead of public void Execute(List<Entity> entities) its public void Execute(Entity entity)
the calling logic handles the for each loop for you
as 99.9% of reactive systems look something like: public void Execute(List<Entity> entities) { foreach (var entity in entities) { ... } }
Mike Cann @mikecann Nov 04 2015 18:45
hmm
github.com/esterlus/Match-One-Multiplayer/blob/master/Assets/Sources/Features/RenderResource/RemoveViewSystem.cs
the OnEntityWillBeRemoved
that doesnt seem to be in the lib
Mike Cann @mikecann Nov 04 2015 18:54
need it so I can remove views when the entity is destroyed
Mike Cann @mikecann Nov 04 2015 19:04
Ah its forked from here: github.com/sschmid/Match-One/blob/master/Assets/Sources/Features/RenderResource/RemoveViewSystem.cs
Hmm this is the way to do it? ``` public void SetPool(Pool pool) {
pool.GetGroup(Matcher.View).OnEntityRemoved += onEntityRemoved;
}
void onEntityRemoved(Group group, Entity entity, int index, IComponent component) {
var viewComponent = (ViewComponent)component;
var gameObject = viewComponent.gameObject; ```
Okay it works