Is a junior developer expected to know state machine?

Before applying to companies to become a junior developer, I am writing an enemy ai script to show on github. It will contain about 8 9 states like (following, patroling, looking for tree…). I have never used Finite State Machine before. Do you think I should learn this and write the script like that, or will it be enough for a junior devoloper even if I write without it?

Would say yes. A basic state machine is everything but a complex algorithm and ideally you write it abstract (as in separable from the actual code executed in every state) so it doesn’t really matter if there are 4 states or 40. That’s where it differs from monolithic aproaches. 8 states are already much for “regular” aproaches. I once regretted not using a state machine when I had 5.

1 Like

Oh okey then thanks a lot

Obviously.
In game dev usually Junior Dev must know more than Junior Dev in most IT specializations.

But let me tell you this - game dev is not worth all this false romanticism around it.

5 Likes

I think it would be difficult to make a game AI without a state machine (or something similar)!

It can also be used for handling animations and I’ve used it for input handling as well - though I’m not sure that was entirely necessary.

IMO it makes for nice short code that is easy to understand.

I think you could probably understand the concept of it quickly and be able to build some test projects in just a couple days. Well worth the effort.

(i dunno anything about jobs or expectations, but if you expect to make any games I’d definitely recommend learning it)

1 Like

Actually, I was aware that I should use it because as you said, the codes I wrote became very complex and finding bugs was becoming a bigger problem but i was a bit lazy to learn. I was just wondering if this is a requirement for a junior devolooper. Thanks to you, I learned and I have already started watching tutorials, thank you.

Why do you think its not worth

Stress.
Lower salary.
Amount of time you have to invest into learning.
Crunch.
Stability.

All this after they actually hire you.

2 Likes

It is a basic algorithm. Even if you don’t know its proper name, you should’ve implemented it at some point. So I’d say yes, you should know what it is.

Yes, you should know about FSMs. If you’re applying for a paid position as a junior programmer, you should at the very least be familiar with the content that’s taught in the first year of an undergraduate software engineering or computer science program. You can probably search up schools’ curricula and fill any gaps in your knowledge using online tutorials. Or maybe take Harvard’s free online CS50 course, which is an introductory course on programming & computer science.

2 Likes

I want to add to this - this is more of an issue for traditional game companies that use a waterfall development cycle. Live service games and mobile FTP games often have a continuous stream of funding coming in, and often adopt an agile software approach that works better for that continuous development/continuous delivery approach. This results in less crunch, higher salaries, and somewhat higher stability in your job and work life balance.

Definitely not a universal statement, but you will find major positive differences in games as a service or free to play mobile games (as a developer; not talking about the player experience of those games).

5 Likes

The theoretical problem with work in game dev is that everyone wants to do it, lol.

So many people dream of developing games and many freshly studied people have experience with that field from a hobby project. Way more than other IT fields that are less accessible to hobbyists like let’s say large scale webdev with microservices, transactional programming (banking etc.), big data processing and until recently, AI as well.
The result of this, paired with relatively few game dev companies are higher requirements to be hired and less great work conditions. The job market also follows the principle of offer vs demand.

Naturally if you ARE good at what you do and found the right spot for you, happiness will follow :wink:
Just be careful about turning a hobby into a profession. That can end up with a lot of frustration instead.

2 Likes

With respect, I think you’re asking the wrong question. As you’re already aware enough of the concept to be asking about it, I believe a better question would be: Do you think that it is likely to make your code better*? If the answer is yes and it is within reasonably available resources then it doesn’t matter what is and isn’t “enough”.

Also, yes, I’d personally expect a “junior” programmer who wants to work in games to understand and be able to apply a state machine approach within their code.

  • Of course “better” is highly contextual, and sometimes dependent on personal preference. That’s perfectly ok, as that’s the kind of thing that kicks of conversations with the people you’re showing it to. Why did you think it was “better” than the alternatives? Did that turn out to be the case? Pros and cons? What’d you learn as you went? Etc.