mikecann / mikecann.blog

Mike Cann's Blog
https://mikecann.blog
4 stars 1 forks source link

Tinkering With Entitias – Entitiasteroids #116

Open mikecann opened 1 year ago

mikecann commented 1 year ago

Tinkering With Entitias – Entitiasteroids

http://www.mikecann.co.uk/?p=5782

mikecann commented 1 year ago

imported Disqus comment by 'Simon Schmid' @2015-11-12 04:15:00_

Hi Michael,

thanks for your writeup on your example project with Entitas. I'm happy to hear that you like the code generator. The reflection based code generator is currently complaint #1, and we're trying to find a nice and easy way to be able to generate even when your solution has compile errors. The .NET Compiler Roslyn might be the solution... In the meantime you could check out @astro75 Roslyn based code generator for Entitas - https://github.com/sschmid/...

I would also like to take the time and reply to some of your points:

Prefabs

Prefabs are one of the things that make Unity great. But you already got it right: in order to run the same code on the client AND server, we had to avoid being dependent on UnityEngine. This ability to run and verify your simulation logic on a server can be very powerful and important. I also think, separating the data, logic and the view leads to an overall better architectural design. But you got a valid point here: nobody except the devs wants to dig in the code to change some values. But prefabs basically are just configuration

> If we think about it, Unity prefabs and Unity scenes are just configuration files. When we hit play, Unity will transform this configuration into runtime data and mono behaviours will start acting on this runtime data.

--

(Maxim Zaks - @icex33 - https://medium.com/@icex33/...

Putting your configuration not on prefabs but in a json or xml file has a few benefits. Game Designers and Balancers can go wild in their spreadsheets and export them to e.g. a json file. You also can do A/B Testing, which means an already released game can load different configurations based on if a user is in a certain test group. These configurations can be maintained and updated, even when the game is already rolled out.

Prefabs let you quickly put stuff together, which is great, but I'm not sure how easy it is, to do things like A/B Testing.

But it's important that we don't mix up what we mean: for views, animations and for lot of other things I use prefabs, too! But for "tweaking values", meaning configuration, I would not recommend it for a real live game.

Cryptic Error Messages

True. I'll work on that :) Better error messages would be indeed very helpful.

Adding systems automatically

One of the most important things with systems is the order in which they are executed. Usually a lot of though goes into where to put systems in the chain. Adding them automatically is maybe not a good idea. Also, depending on your game, you might have different phases and scenes in your game, where different sets of systems are executed. You might also end up having multiple nested systems and parent systems to ensure a certain order of execution. Again, adding all systems from the assembly automatically is not a good idea then.

ReplaceX with lots of arguments

If you end up replacing components where only one field changed, but you have to pass all the other parameters, too, I think there are two ways to address this:

1. Think of splitting up the component into multiple ones, maybe the component contains too much data

2. Add an extension method that only takes one parameter and passes in all the others automatically

ReactiveSystems

You are right, most of the time you end up iterating over the entities with a foreach loop. But there are also other cases where you don't. By providing a system that only processes one entity at a time, you lose a lot of the context and is too specific to a certain need. But that's ok, games always have specific needs, that's why I try to keep Entitas as open and flexible as possible. You can easily add a custom implementation of a ReactiveSystem that would only process an entity at a time.

Example projects with different version

Oh, that's bad. I wonder if you maybe got a wrong link or sth, because usually I update both example projects with each release with breaking changes... I'll check twice from now on ;) Thanks for pointing out.

If you keep on trying Entitas and you have more feedback or ideas, I'd love to hear them. Great post!

Simon

mikecann commented 1 year ago

imported Disqus comment by 'mikeysee' @2015-11-12 07:47:19_

Thanks Simon, thats some excellent points. I agree with pretty much all of them.

I do however still stand by my point tho that people that are used to Unity and are looking for a better way to architect their game would probably find Unity-Ash easier to get started then Entitias. Having said that however, I think Entitias is probably a smarter framework in general.

mikecann commented 1 year ago

imported Disqus comment by 'Kristian Atanasov' @2016-06-13 01:18:36_

Thank you for making the example project! I'm currently using it to learn how to work with Entitas. I think its true (at least for me) that people coming from a standard OOP background and used to Unity that aren't already familiar with entity-components systems can have a hard time getting started with Entitas. But personally, I find way too much value in using it so the initial frustration of figuring it out is worth it. I'm secretly hoping somebody decides to make a more step-by step video tutorial series about it, but hopefully that will also happen as more and more people start using it for their games. ( Also I really hope the code generator issues get resolved soon its THE thing that causes the most frustration, otherwise its an amazing framework )

mikecann commented 1 year ago

imported Disqus comment by 'mikeysee' @2016-06-13 07:37:20_

My pleasure. Im glad you find the same issues that I did.

I was thinking of doing some more work on Unity Ash soon too if I get a second :)

mikecann commented 1 year ago

imported Disqus comment by 'Kristian Atanasov' @2016-06-14 03:00:48_

Ash also looks quite interesting so far, Ill be following your work on that. I'm thinking of trying it out soon. It's always good to have a few alternatives and Ash looks a bit more familiar and closely coupled to Unity( which I don't see as a bad thing mind you ). No matter the framework though it'll be good to finally get away from OOP and the many headaches that causes when used for systems architecture :D

mikecann commented 1 year ago

imported Disqus comment by 'mikeysee' @2016-06-14 01:59:37_

Awesome :) Dont totally dismiss OOP tho. OOP can great if done well, it just can also be done very poorly (lots of inheritance instead of composition)

mikecann commented 1 year ago

imported Disqus comment by 'Kristian Atanasov' @2016-06-14 11:24:31_

Oh I don't mean to bash the whole concept. For many cases where you need custom data types with some functionality or objects with a very specific role its great. Even fairly self-sustained systems are not a problem. My headaches with it mostly show up when systems get larger and need to communicate with each other more and/or share state in some way. And when they need to be changed and extended later on during development. Some things are just inherently better tools for certain tasks I suppose. But yea its also important how you use them :D

mikecann commented 1 year ago

imported Disqus comment by 'mikeysee' @2016-06-15 05:36:57_

I couldnt agree with you more! OO gives you must more rope to hang yourself with on large projects!