informa
/
2 MIN READ
Blogs

I'm gonna have to learn to cope with this

It's probably a testament to bad planning, but a choice I made early on in the development of my program has forced me to rewrite a lot of code. It's all back to where I want it now though.

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. 

Latest Jobs

Cryptic Studios

Remote
1.19.23
Senior Producer

Anne Arundel Community College

Arnold, MD, USA
1.30.23
Instructor/Assistant Professor, Game Art

Night School Studio

Los Angeles, CA, USA
1.09.23
Level Designer / Scripter, Games Studio
More Jobs   

CONNECT WITH US

Explore the
Subscribe to
Follow us

Game Developer Job Board

Game Developer Newsletter

@gamedevdotcom

Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Browse
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more