Welcome fellow Citizens to episode 7 of Bugsmashers!
Transcript by Me!
Accessing an array out of range causing memory corruption. This caused some internal crashes and data corruption.
– Mannequin is a state machine for controlling animations on vehicles and players.
– Issue involves an array going out of range.
– The piece of code that was the problem is an animation for entering the Constellation’s captain’s chair.
– Issue was created because instead of using a tool for this animation, it was entered manually.
– Fixed the issue in the code and also added in a break so that if it happens again, it won’t crash the game.
– Need to stay within the array bounds. A real-world comparison is if you you setup a target at a gun range and the bullet is supposed to stop there (limits of the array), but instead it keeps going and could go anywhere… could hit someone (overwrite memory).
– Mark demonstrates that the level loads up now (despite a few other smaller bugs popping up).
Sparky: How do you find specifically where code is broken? You have a physics issue and a character not jumping – do you know where in the thousands of lines of code where it’s located? Do you search for it somehow?
Basically, if something breaks you look for a characteristic behaviour. Is it something related to the player? Is it something related to the vehicle? Is it something related to an item? And, when you have those sections you can start jumping to those specific code blocks and it also helps that you go on Skype and yell at the people who know that particular section of the code. Once you have a general area you start looking for anything significant in the code that sticks out like – for that physics issue last week where when you jumped it would actually move the ship around – that’s obviously going to be somewhere in the physics. And, since it’s with the player it’s going to be with the player physics and so I dove into the player physics, looked around a bit, and a saw this specific flag that’s not supposed to move objects around when it’s set.
So, I went to the vehicle code and the vehicle is setting this flag but it’s still moving. So, then I went back to the player physics and was like – ‘Okay, this is getting set but where is it faulting?’
So, then you look into the other physics code and see where the impulse happens and you just go back and forth tracing and tracing and tracing. Sometimes you’re lucky and it’s like – this behaviour is gonna be here, this behaviour is gonna be there… but sometimes you have to just jump in, put break points, put in messages, and try to track it down.
The art of debugging is a really really really complicated and fun thing to do.
Some helpful links:
Suggestions on what people can do to get into the field or get an engineering position, what they can do to improve themselves.
– Every day try to code something small.
– Start with small projects, lead yourself up. Get bigger over time.
– Practice debugging. Set some break points, set some messages, try to find solutions to problems you’ve never faced.
– If you have something that you have no idea how to complete, ask for help but tell people what you’ve done to get that far. Try stepping away from it and coming back and looking at it again from another perspective.
– Join other projects. If you’re right out of school, join a small indie project. You will face problems you’ve never faced before and being able to solve those things just advances and advances and advances your programming knowledge.
– Basically, practice coding every day. Start with small projects and slowly get bigger – don’t start with big projects first, you will get overly frustrated because you don’t know how to design systems and I’ve seen many people just go ape… crap.