Skip to content

Professional code

Hello, I am a self-taught front-end developer for my day job but also have been working on personal game projects for about 5 years on and off. I have a dream of starting my own game studio one day.

So far the few game companies I have applied to rejected my applications saying that my code is not at the level they are looking for. I can find no feedback or any professional-grade code so I can study how it should be. I want to get better and working tirelessly towards that but where I am, I feel like I am flying blindly.

I have been learning about OOP, architecture, design patterns. Also I have been trying to structure and organize my code, decoupling as best as I know how to, trying to stick to SOLID principles. I have even started watching online Computer Science classes from Stanford Uni. etc. to eliminate the possibility that I am missing some perspective taught in college (I have an electronics & communication engineering bachelor, not too far from CS like civil engineering etc.)

I really want to know how "very high-quality code" looks and gets coded. Do you have any advice, pointers, resources regarding this problem?

Edit: I am adding my code as well, if you want to comment on it please don't hold back any punches #roastme I just wanna get better.
https://github.com/basaranb/interview-project

Edited 16 Apr 2021. We only hold this version.

2 points18 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
2 · 100% up
Kind
Text
ID
ms1op4

Author

3
posts
23
comments
0
media
View profile

18 comments

It's difficult to answer this, as it sounds like they didn't give you enough information about what they're looking for. Next time perhaps ask for more details.

However, as an interviewer reviewing code for "professionalness" I'd be looking for a consistent style (eg naming conventions, indentation, commenting), self-documenting APIs, reasonable use of the standard library where appropriate, not overly duplicating code.

Perhaps if you can share some of your portfolio examples here, someone can give you a quick review and some more useful feedback.

4 points

I am asking for details all the time. You know how interviews are. If you are not useful for them, they usually don't even answer your emails.

I wasn't too careful about the indentation, commenting, naming, etc. Those are the things I can easily fix with a little bit of time.

I am more concerned about the structural, architectural aspects. Things like is it decoupled enough? Is it against the SOLID principles? Did I use a public variable while I should have used a private variable + property?

1 points

I looked at your GitHub repos and most of them seem to be learning projects or empty. You have some python projects but even some of them seem like tutorials that you have gone through. If your goal is to do unity game development it appears like you only have about one project and it looks like that is a tutorial as well. I'm not sure about this but if it is they can you have to display your work. I wouldn't even have the tutorials on your public GitHub at all. I believe it would help if you add more unity projects to your portfolio as of now it looks like you have the one only.

4 points

Thank you for your comment. I don't pay too much attention to my Github actually. I have around 50 repos but all the professional projects are either private or located in the private company repos, Bitbucket or Gitlab. You are right cleaning up the tutorials and adding my game projects there might be better.

1 points

Feel free to post some of your code for critique, perhaps on Github or similar.

I notice you've not mentioned which languages you used, or which technologies. Using the right ones is non-negotiable if trying to get into games.

2 points

Thank you for your answer. I am working with unity using C#

Of course, here is my code. Please don't hold back any punches #roastme

https://github.com/basaranb/interview-project

1 points

Okay, I'll give a quick rundown of the problems I see here:

  • zero comments. You need to comment code. People disagree over how many comments you should have but you're almost never going to find a team where 'zero' is acceptable.
  • inconsistent use of private. Ball.durationAnim is private but you don't declare that. Below there you have Ball.rigidbody which does explicitly declare it. Be consistent (and ideally, explicit).
  • inconsistent naming. Some member variables start with an underscore, some do not. Some start with upper case, some do not. Pick a style and stick to it 100%.
  • inconsistent ordering of members and declarations. In SpawnManager.cs you have public members, private members, and properties all mixed in together. It's better to group them by access.
  • too little whitespace. I like 2 empty lines between methods. Many places prefer 1 empty line. Virtually nowhere accepts no empty lines. Use whitespace to mark clear separations in the code. Sometimes you also have superfluous whitespace inside methods which isn't consistent - remove that.
  • singletons - these are a sign of bad design because they're globals in disguise. To be fair 99% of games companies will use them, but that's because they are prioritising getting stuff out of the door over code quality. As an applicant you don't have that luxury.
  • typos - I see a method called StopSpwning. Spell-check everything. Attention to detail is crucial in game development.
  • 'magic' numbers - you have methods with hard-coded numerical constants all over the place. Anyone wanting to change this behaviour would have to be very intimate with what all these numbers mean and represent. It's far better to use named constants to represent these values, so that their meaning is obvious to the reader AND so that they can be changed in one central place. It's often even better if it can be made into a data-driven value, e.g. via a serialized field.
  • Missing some modern features - e.g. Tile.cs has a get/set property for tileColor that is mostly pointless, but could be replaced with an autoproperty if you truly want a property and not just a public variable.
  • Usages of FindObjectOfType - again, many games companies will do this, but they know it's bad, because it's slow, and will get slower as the scene gets bigger. Ideally you would 'wire up' these references in the scene ahead of time.
  • Poor use of types - your Utilities.RandomizeArray can only take a Color[], even though there is nothing in there that is specific to Color. That is a clear example where a generic function would be better. And I forget whether C# arrays derive from IList or not, but if not, it would be good to have an overload for generic ILists as well.
  • Comparing Unity tags by name - this is slow. You should use CompareTag.
  • 'Don't Repeat Yourself' violations - in Explode.cs you call child.GetComponent<Rigidbody> once to see if it exists, then you call it again to execute a method on the return value. What if GetComponent is a slow operation? Store results like this in a variable, partly so that you're not writing out long expressions repeatedly, but also so that you're not executing the same expression twice unnecessarily.
7 points

Are you applying to studios using Unity? You imply several applications, and well there aren't that many studios that use unity/C#. Most AA and AAA is C++.

1 points

This might be the case for the very top end of the market, but there's a very long tail of smaller studios, indies and mobile developers using Unity - a lot more of them than Unreal I would think.

3 points

I go for mobile studios. Enterprise culture is not for me. AAA work culture seems quite toxic to me with crunches, poor deadlines and burnouts.

1 points

Indie studios have all of the above as well, so be warned! And AAA is not as bad as it used to be. It varies on a case by case basis. Read Glassdoor reviews to get a feel for a place before applying.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.