Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
October 22, 2014
arrowPress Releases
October 22, 2014
PR Newswire
View All
View All     Submit Event





If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 
I'm gonna have to learn to cope with this
by Jack Matthewson on 03/02/13 04:44:00 pm

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

So this has been an interesting week. The good news is that my software still works more or less the way I want it to work. The bad news is it took a lot of coding to maintain the status quo. Basically, the way I wrote my code was that the entire bank of networked computers would only have to cope with one centipede at one time. This was in the spec (multiple centipedes was an option for a higher score, but I wanted to get my baseline in early) so I figured it would be easiest to get a simple solution in and build on it later. However, I encountered a bug in my code when a centipede would leave the screen, hit an object on the next screen over, and return to the original screen before it's tail had fully moved off. The problem being that they both use the same object to controll the positions of the tail piece. Practical upshot was that two centipedes tried to exist within the space of one and instead just dissapeared all together.

So, I had to rewrite my code to deal with a linked list of centipedes rather than just one. Honestly this is the way I should have done it to begin with. It doesn't take a genius to figure out that this kind of problem was gonna occur. It's not a massive issue either because when doing so I figured out a way I could listen for new centipedes and handle existing centipedes exiting the game space at the same time, where before it was an either/or deal. Either I had a centipede on my screen and I was waiting for it to leave OR I had no centipede and was waiting for one to arrive. The next task will be to implement a class (probably a pair of daemon threads) that can do both.

Ah yeah, threads. So locking is fun! Seriously, I'm learning much more about how to program in Java now than I did during my Java lecture module. It's kind of a live fire excersie. A lot of problems with my code randomly throwing hissy fits was fixed when I figured out the correct way to use locking in my classes. Even now there's probably better ways to go about doing it, but I've cleared up my main problems.

Deadlines are looming! 22nd of March is when this has to be complete by. I've come a long way but there's still a lot to get done. 


Related Jobs

Nix Hydra
Nix Hydra — Los Angeles, California, United States
[10.22.14]

Art Director
Avalanche Studios
Avalanche Studios — New York, New York, United States
[10.22.14]

UI Programmer
University of Texas at Dallas
University of Texas at Dallas — Richardson, Texas, United States
[10.22.14]

Assistant/Associate Prof of Game Studies
Avalanche Studios
Avalanche Studios — New York, New York, United States
[10.22.14]

UI Artist/Designer






Comments


Steven Christian
profile image
What is the background to this story?

Jack Matthewson
profile image
I'm producing a cut down version of the game Centipede to run across my universities network. Check my whole blog here: http://www.gamasutra.com/blogs/JackMatthewson/913762/


none
 
Comment: