   What makes a good code sample?
  Hello everyone,I had a general question about someone struggling to get into the gaming industry. (I am not complaining :))I will be a fresh college graduate soon. Have been involved in a large number of projects mostly towards making games and simulations. Have made a few games of my own and am really interested in AI and Character Animation systems. Have no 'real' experience in the industry, I guess.Lately, I have been applying to a lot of game companies. I have been using my A* path planner (simple, non-generic implementation) as my sample code. I guess it is not having the right find of impact.Can someone suggest me, what would be a better way to approach of writing a sample code ?Thank you,GauravI guess this question has been asked a few times. Let me ask again :)I have a good demo, well commented, STL based C++ AStar Path Planner. How can I improve it to make it a better demo? How can I help convince the lead programmers that I can code at the level required in the Gaming industry?   
Quote:Can someone suggest me, what would be a better way to approach of writing a sample code ?Easy: Don't.Although every employer will be looking for something slightly different, the purpose of "sample code" is generally to show them your best work, the stuff you are most proud of.That code is almost always code you've already written, either because it was for a challenging assignment you were really proud of or because it was a personal side project you were really passionate about.It can be surprisingly easy to tell whether somebody's sample code comes from a real-world project or was written specifically as "sample code."Obviously, if you have nothing you're really proud of, you're basically in a position where you need to generate something that is "sample code," but you shouldn't produce it with that goal in mind. You should decide on a project or task that appeals you to and do it. Make something real, something you are interested in, something you can talk about, something that shows off your best skills.   ;Quote:Original post by bharajI have a good demo, well commented, STL based C++ AStar Path Planner. How can I improve it to make it a better demo? How can I help convince the lead programmers that I can code at the level required in the Gaming industry?The question is: what does your A* path planner do?  Basic A* and Dijkstra path finding can be implemented in 5-10 minutes off the top of your head.  It's what you do with the output (and/or the input) that's important.  Since you're applying to game companies, creating some sort of little real-time demo that shows units navigating through a map will obviously have greater appeal than, say, an application that just draws the shortest path from A to B with a couple of lines.   ;Quote:Original post by bharajHave made a few games of my own and am really interested in AI and Character Animation systems. I have... my A* path planner (simple, non-generic implementation) as my sample code. I guess it is not having the right find of impact.How can I improve it to make it a better demo? How can I help convince the lead programmers that I can code at the level required in the Gaming industry?All you have to show them is your one piece of code? Then write more. You need multiple code samples, not just one. They should all illustrate an elegant solution for different kinds of problems one encounters in the development of a game. Especially you should have AI and character animation samples, to solve different problems in those areas, since those are your special interest. When you say you "made a few games of my own," why isn't the code for those games in your portfolio, and why don't you make a few more?   ;Quote:Original post by bharajLately, I have been applying to a lot of game companies. I have been using my A* path planner (simple, non-generic implementation) as my sample code. I guess it is not having the right find of impact.As you can already see from some of these replies, a path planner you made specifically for sample code is just not going to cut it unless a company is all about giving every applicant an interview, and even then it would put you behind the curve.jpetrie is most accurate in his assertion that a company can tell whether a program was created for sample code or not, and they will prefer code that was created in an environment that is more like what they do at the company.My suggestion:Write up a design document with friends at the school for a game. You're probably working on some sort of final project at the moment, so either alter your design document or work on something after graduation if need be. You want a design that includes a number of technical implementations for things that you and your peers can do, and something that can be done within whatever time-frame you think you have before you need to be working. Switch off with your peers at times within the project to get a more rounded experience working with different systems. Learn from each other anything you may have misunderstood during school, because you'll need it. Toward the end, polish it as much as possible. Use this example to apply for jobs.Advantages:- It shows you can work in a group.- It shows you can work under time restraints.- It shows you can COMPLETE something of considerable size.- It shows you understand complex systems.- It shows you care about presentation and polish.   ;  I have a similar but different question.I was recently asked by a company I applied to to fill out a survey and at the end it asked for a short source code sample where it asked that it not be a whole project and just enough to give an idea of how you write code.What would be suggested in those situations?;Quote:Original post by way2lazy2careI have a similar but different question.I was recently asked by a company I applied to to fill out a survey and at the end it asked for a short source code sample where it asked that it not be a whole project and just enough to give an idea of how you write code.What would be suggested in those situations?That's a fairly common thing for them to request, as it requires less time for them to look through it and determine your skill level. For that, I might suggest a nice functional algorithm that you've written in one of your projects, especially if it is well commented and easy to understand while still being unique and something that completes a semi-complex task at least. If you do this, though, make sure to note on the submission that you would be willing to provide a larger example if they would like one.Ideally, you would have code examples of multiple sizes ready and could just link the company to them with short descriptions of what each one is / what it does, as well as how big it is. If you did this, also note any specific features the code has such as design patterns or tricks like a butterfly switch.   