Entitas icon indicating copy to clipboard operation
Entitas copied to clipboard

New Video Tutorial | Entitas ECS Unity Tutorial - Git & Unit Tests

Open sschmid opened this issue 6 years ago • 14 comments

Hi everyone,

I uploaded part 2 of the "Let's build a game" series. These are the topics in this Video:

  • Set up Version Control with Git
  • Set up a unit test project with nspec
  • Implement features with TDD

You can get Entitas on the Unity Asset Store here

Entitas ECS Unity Tutorial - Git & Unit Tests

https://www.youtube.com/watch?v=DZpvUnj2dGI

entitas-shmup-part-2

sschmid avatar Feb 16 '18 11:02 sschmid

Recommendation

If you want to learn more about Unit Testing I strongly recommend Clean Code - Advanced TDD

It starts from the very basics and goes deep into the matter.

It shows you why and how you should test, how it affects design and apis, and why tests can be considered more important then the actual production code.

TDD is still a controversial topic for some. You can do if very strictly or without much discipline (but then you can just skip it altogether). If you just get started I suggest being very strict as it will train your mind to eventually produce better code down the line even if you decide to stop writing tests years later. Being disciplined and trying TDD the strict way personally made me a better dev.

sschmid avatar Feb 16 '18 12:02 sschmid

Simon (@sschmid),

Thank you for taking the time to create such comprehensive videos. While I am familiar enough to create games/applications in C#, I am still early on my path to understanding design patterns, and only just beginning to understand design methodologies. A few times, I've researched Test Driven Development, but always failed to wrap my mind around how to use it with Unity. This video helped me with that immensely.

Of course, your videos also serve as great views into Entitas best-practices.

I will also be watching Clean Code - Advanced TDD as soon as my time and budget affords me the opportunity. They appear to be an excellent resource and boon to understanding Test Driven Development.

Again, thank you greatly for creating these videos and providing the additional references. I await your next video with great excitement! - S.

sdarkwell avatar Feb 16 '18 14:02 sdarkwell

Thanks for another great video!

Do you still plan to remake the shmup demo in this tutorial series? Honestly, I think even if you expand upon the original, it's not really the best type of example. I'm now thinking an RTS would be more ideal. Since that seems like a very popular genre here and it would better demonstrate more complex game systems. It's also much more scalable, so you could use it to also demonstrate the speed of Entitas with hundreds of units at once. Like Unity did with their Job system RTS demo.

I also don't want to sound ungrateful or impatient, but how often do you plan to release new tutorials? I know they probably take a huge amount of work.

Maybe to save time you could do some informal quick game jam like tutorials. Where you create a complete simple game in one session, like breakout or space invaders. Where you just take the viewer through the process of making it without explaining everything in great detail. So they can just get a holistic view for how best to approach building a game in Entitas.

A nice side benefit of doing a video tutorial where you recreate a classic video game would be an bump in the number of hits you get on YouTube. This is because a title like "Space Invaders in Unity with Entitas" will attract people not just looking for Entitas explicitly. So it's a great way to promote the framework even further.

IsaiahKelly avatar Mar 04 '18 20:03 IsaiahKelly

Very helpful video! But I have a small suggestion: talk one topic per video. Git and Unit Test are pretty irrelevant ideas, and just like the principle of Unit Test, it's better to do one thing at a time. (And it's good for SEO too)

yhslai avatar Mar 05 '18 13:03 yhslai

@raincole Think you meant to say "unrelated" instead of "irrelevant", but in any case I think they're both very relevant and related to the topic of the video. He also spends only a minute on git, so a separate video for that would make little sense to me. I'd also rather watch one video that covers all this than a bunch of tiny clips, but that's just my personal preference.

IsaiahKelly avatar Mar 05 '18 15:03 IsaiahKelly

@IsaiahKelly Thanks for your feedback. You have some very good points. After the basics are established, it sounds like a good idea to build such games as you suggested in one run, without going too much into the details.

Regarding the interval of recording videos: I don't really know, I do them whenever I find some time.

sschmid avatar Mar 05 '18 16:03 sschmid

@IsaiahKelly Yeah sorry I meant unrelated. I guess it's fine for us who follow Entitas news constantly, but if someone searches "how to do unit test with entitas" etc I doubt they would like to see a Git tutorial first. Again it's just a suggestion.

yhslai avatar Mar 05 '18 17:03 yhslai

Hi, I really like the idea but don't know how to implement TDD with a code generator.

In unit test, we write logic first and then write some tests for it. But in TDD, it requires us to write tests first and then write logic to pass them. However, it's hard to do these in Entitas if no proper component has been generated first since the IntelliSense cannot predict it.

Write & generate component first seems working, but it's breaking TDD somewhat, any good suggestion?

zhuchun avatar May 15 '18 14:05 zhuchun

@zhuchun same could go for regular classes, until you implement a class there is nothing to test and there might be compile errors. NSpec has pending tests feature it[""]=todo; xit[""]= ()=>{}; for this situation

c0ffeeartc avatar May 16 '18 13:05 c0ffeeartc

Thank you @c0ffeeartc

I also notice if we implement architecture like How I build games with Entitas (FNGGames) did, it would be harder to be tested. Because system now relies on Services while some of them may need UnityEngine runtime.

zhuchun avatar May 16 '18 13:05 zhuchun

@zhuchun the services are all interfaces though so you can mock them up very easily (e.g. TestViewService : IViewService).

FNGgames avatar May 17 '18 08:05 FNGgames

@FNGgames Thank you, I really like your post! It clarifies a few pain points in my past works and helps me get out of there ;)

zhuchun avatar May 18 '18 13:05 zhuchun

Hi, I am getting error "ECall methods must be packaged into a system module." when instantiating GameObject in Test method or trying to Execute system with Debug.Log in it.

How to deal with it?

zizul avatar Oct 31 '19 13:10 zizul

Hi, I am getting error "ECall methods must be packaged into a system module." when instantiating GameObject in Test method or trying to Execute system with Debug.Log in it.

How to deal with it?

Hi, you'd better start a new topic so the community could help you better

zhuchun avatar Nov 01 '19 03:11 zhuchun