What's the hardest section of code you've had to write.

For discussions about game development that does not fit in any of the other topics.
Post Reply
Klown
Posts: 89
Joined: Tue Feb 22, 2011 5:59 am

What's the hardest section of code you've had to write.

Post by Klown »

I just finished writing the trade function between players in my new game. I didn't realize how much effort it would have been. Most of my problems came from trying to keep trade between sender and receiver. gets so confusing after a few hundred lines of code. :|

I just wanted to know if anyone else had come up against a wall every once in a while when coding a section of a game or program they've wrote. I'm far from an expert, ive only recently taken up php / mysql and its not too hard for the most part, i think my greatest handicap is that i dont know fully what i can do with it all, i do so much experimentation based on what ive seen on other php websites and what i want my game to be like.

-Klown
if( $myGames != "Crap" ) {
  • please_donate( $money );
} else {
  • just_enjoy();
}
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: What's the hardest section of code you've had to write.

Post by Jackolantern »

Almost all of the hardest code I have ever written in PHP-based web development are client-side. Real-time features and animation in Javascript can be quite mind-bending lol. In my map-building program I released (PBBG World Builder in project showoff II), the reticle-aiming system for placing assets on the map was kind of complicated, as was the AJAX save-to-database feature, although a good chunk of PHP was involved in that, too. Just the way the whole thing came together was rather complicated. A good deal of that complexity could have been avoided if Javascript was truly OOP :roll:
The indelible lord of tl;dr
User avatar
Sakar
Posts: 520
Joined: Thu Apr 23, 2009 2:59 am

Re: What's the hardest section of code you've had to write.

Post by Sakar »

Hardest code I've ever written is a scene manager for a game in C++. Manual memory management is a bitch, especially with the horrid syntax of pointers.
User avatar
Callan S.
Posts: 2042
Joined: Sun Jan 24, 2010 5:43 am

Re: What's the hardest section of code you've had to write.

Post by Callan S. »

Pretty much!

Remember to comment! I even use multiple lines of // ########################## so I can scroll around and still know where I am by the 'landmarks' I've made! Commenting kind of splits the code up into chapters and paragraphs, to better read the whole 'story'.

I also don't try to write the whole thing all at the same time - I identfy a much smaller function of the larger thing I want to create, and write it by itself. Once I've gotten it done, then I make a back up of it and start adding more functions on. Trying to write several interlacing functions all at the same time and getting them to work is too hard for me!
Fight Cycle : My latest Browser game WIP
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: What's the hardest section of code you've had to write.

Post by Jackolantern »

Ahh, yes, outside of PHP/JS web development I have written much harder code. Just for fun I wrote a real-time chat server and client for Apple IIe when I was about 15, and that was the hardest thing I had written up to that point, and actually for a while since until I got deeper into C#. I never messed with C++ due to how ugly it seemed to me, but I know some memory management routines are extremely complex. And if you count debugging in "the hardest code you have ever written", then some C++ code with memory leaks would likely be the hardest ever! Memory leaks can be so hard to find that even some commercial studios give up and ship products knowing it has memory leaks in it.
The indelible lord of tl;dr
lucius
Posts: 22
Joined: Fri Mar 11, 2011 6:51 pm

Re: What's the hardest section of code you've had to write.

Post by lucius »

I remember my hardest part of code. In fact the whole code was complicated. I was beginner in Java at that time and our teacher gave us the whole code (it was a calculator). It had so much bugs and i my knowledge wasnt good. Nobody was able to finish it. After some time i found easier version on the internet. From that moment i am learning from videotutorials on youtube rather than from my teacher.
User avatar
PaxBritannia
Posts: 680
Joined: Sun Apr 18, 2010 1:54 pm

Re: What's the hardest section of code you've had to write.

Post by PaxBritannia »

Everything seems harder when you were young.

pax.
lucius
Posts: 22
Joined: Fri Mar 11, 2011 6:51 pm

Re: What's the hardest section of code you've had to write.

Post by lucius »

I think that everything seems harder if you are inexperienced.
User avatar
PaxBritannia
Posts: 680
Joined: Sun Apr 18, 2010 1:54 pm

Re: What's the hardest section of code you've had to write.

Post by PaxBritannia »

The most provable, scientific reason if I were to provide one, would be that during stages of neural re-weighting/inputing of 'training' data/incidence to emotional content, that the brain has more acute recollection of events.

Essentially, when memories are written to the amygdala, the more unique the experience, in this case 'frustration at code', the more meta-data which gets stored from the time of incidence. When you're trying to remember your frustration at code, most meta-data will be from earlier events which exposed you to this specific emotion.

A study was conducted, I don't remember from where exactly, about the perception of time and time slowing down during exposure to new stimulus. As always, I can't seem to find the link to the thesis I'm referring to... I should really get a record of all the papers I read. :?

pax.
Klown
Posts: 89
Joined: Tue Feb 22, 2011 5:59 am

Re: What's the hardest section of code you've had to write.

Post by Klown »

PaxBritannia wrote:The most provable, scientific reason if I were to provide one, would be that during stages of neural re-weighting/inputing of 'training' data/incidence to emotional content, that the brain has more acute recollection of events.

Essentially, when memories are written to the amygdala, the more unique the experience, in this case 'frustration at code', the more meta-data which gets stored from the time of incidence. When you're trying to remember your frustration at code, most meta-data will be from earlier events which exposed you to this specific emotion.

A study was conducted, I don't remember from where exactly, about the perception of time and time slowing down during exposure to new stimulus. As always, I can't seem to find the link to the thesis I'm referring to... I should really get a record of all the papers I read. :?

pax.
i guess reading that thesis wans't a unique enough experience to store enough meta data to remember the link to it. lol

-klown@dont.store.meta.data.because.hes.too.slow.fyi
if( $myGames != "Crap" ) {
  • please_donate( $money );
} else {
  • just_enjoy();
}
Post Reply

Return to “General Development”