Page 1 of 1

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

Posted: Sat Mar 26, 2011 3:12 am
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

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

Posted: Sat Mar 26, 2011 3:22 am
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:

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

Posted: Sat Mar 26, 2011 3:32 am
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.

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

Posted: Sat Mar 26, 2011 3:38 am
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!

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

Posted: Sat Mar 26, 2011 4:57 am
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.

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

Posted: Sat Mar 26, 2011 10:11 am
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.

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

Posted: Sat Mar 26, 2011 12:40 pm
by PaxBritannia
Everything seems harder when you were young.

pax.

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

Posted: Sat Mar 26, 2011 1:15 pm
by lucius
I think that everything seems harder if you are inexperienced.

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

Posted: Sat Mar 26, 2011 3:56 pm
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.

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

Posted: Sat Mar 26, 2011 11:40 pm
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