Share your development triumphs

Ancalagon

Honorary Master
Joined
Feb 23, 2010
Messages
18,207
Reaction score
3,678
So... all of us developers occasionally come across problems that we think we have no idea how to fix. And eventually, by luck, hard work or sometimes, in rare cases, talent, we manage to fix them. I just thought I'd start this thread for us to share such eureka moments, since they are pretty awesome when they happen.

As most of you probably know, I'm writing a game in C++ using the Ogre rendering engine. Yesterday, I implemented pathfinding according to the A* algorithm (very interesting algorithm and subject by the way). It seemed to work okay during testing, spitting out a sequence of tiles for my character(s) to follow. So far so good. This morning, I implemented a feedback mechanism that would highlight the potential path in green. That worked fine too, but what I noticed was that the path took a few seconds to be generated. This is on a 2.8Ghz 6 core Phenom II. So, I had heard that running in Debug mode seriously slows things down compared to release mode. I thought, this might be a good opportunity to make sure I can actually do a release build (I had never done a release build for my game before) and test whether the pathfinding is really slow or whether its just debug mode slowing everything down. I do the release build - works first time! - and start the game up. It crashes as soon as I try to generate a path. Again and again. But now, being in release mode, it doesnt tell me where the problem is. I know its occurring when I click, but not how or why. I google the problem, and someone mentions Intel's Parallel studio, which I download to help me track the problem down. I run the profiler, which makes the game run 10x slower than even debug mode, and while it turns up some minor problem, none of them are THE problem. Hmmm. I try running release with debug information, problem doesnt happen. Eventually I start inserting return statements into the method causing the problem, moving it down line by line until the exception occurs.

Turns out, a function that I used to find a reference, had no return value if nothing matched. In C#, the compiler will throw an error and say something like not all code paths have a return statement. Mine didnt, the function just ended. I changed it by simply inserting return 0, fixed the problem! I was overjoyed! Plus path generation is super speedy on release mode, clearly a debug mode issue.
 
It's always the easy problems that are the hardest to find and fix.. It's very satisfying to get something to work after hacking at it for a while.. :) Great job!

I normally make mistakes when I'm tired, if I'm at it to late. It's fun going over the code then next morning and spotting a mistake instantly that I searched for ages and never found..

These are the little things that some people that don't program just don't grasp and call it a boring job.. I Just wish there was more time to do more projects... :)
 
When are you releasing your game for testing purposes? Any youtube vids of what you have done so far?

No vids yet. At least a month or two before any demo comes out.
 
I'm currently doing a artificial intelligence module at UNISA, where we discuss and A* algorithm, very nice algorithm if you know how to use it.
 
I'm currently doing a artificial intelligence module at UNISA, where we discuss and A* algorithm, very nice algorithm if you know how to use it.

Yeah I found it fascinating, although it took me a while to get my head around it. Works fine though.

I used these pages as sources of information. Very informative.
 
"Share your development triumphs"
Getting the effing splitviewcontroller to work (sort of) for an iOS app!
 
"Share your development triumphs"
Getting the effing splitviewcontroller to work (sort of) for an iOS app!

Lol, yeah, I hear you.
That one's a fun one (especially if it's your first app) since the documentation around it is so poor/unintuitive.
 
Top
Sign up to the MyBroadband newsletter
X