by date
Plan for Gonzo T. Exterminator
Plan for Gonzo T. Exterminator
| Name: | Gonzo T. Clown | ![]() |
|---|---|---|
| Date Posted: | Oct 24, 2004 | |
| Rating: | 5.0 out of 5 | |
| Public: | NO | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Gonzo T. Clown |
Blog post
A lesson in humility
How good is too good? Are you as good as you think you are? Or are you too good for your own damn good? Am I fooling myself? I feel like a noob.
Amazing the thoughts that come to your mind when you solve a major problem. "Major problem? You should be proud." Yeah, well, you might not think so when you find out why I'm writing this. For months I had seen others wrestle with the hover aspect of the flying vehicles. Many persons had failed to get them to act the way they were supposed to act. It's a very frustrating thing to not be able to get hours worth of moddeling and/or coding work to perform properly. So one day I decided I would see if I could tackle the problem. I love to challenge myself, in fact, it seems I love it just a little to much.
My first mistake was to assume I was in for a major challenge of debugging and analyzing the full aspect of the function and its performance. Scrutinizing the details of the Math and the operational aspects that are branched into various parts of the engine. Pouring piece by piece, line by line trying to get a fully functioning model in my head of exactly what the function was doing, so I could see exactly where the flaw in someones logic was and fix it. Days and days later I was no closer to a hovering flyer than I was when I started. It just didn't make sense. I couldn't see the flaw in the logic. My mind was screaming at me "There has to be a flaw, it doesn't work right, if you can't find it, then you're just as flawed as it is." Frustration and self doubt sets in.
Finally, I gave in. My skills in doubt, my esteem shot. I had to give it up. My only comfort was that I was not the only guy to fail, but that didn't make me feel any better. That would have been the end of this story except by chance Martin "Muerte" Schultz sends me an email asking me if I ever managed to solve the issue. Like many others he had most likely assumed that since the thread went dead, a solution was found. After searching and not finding that solution, he mailed me. I can't say I was happy to answer his question(I hate to fail), so I took a very deep breath and popped open the FlyingVehicle.cc file and started to look at it again.
WHAM!!!!! Like a brick to the head I was knocked silly when the answer just jumped right out at me as if I been mailed the answer from the heavens above. I was dumbfounded by the fact that I could have, and should have seen this type of mistake in a matter of minutes, and in some cases, even seconds. I was instantly newbiefied. I felt so stupid for letting myself believe that the problem was harder than it was before I even started on it. I knew damn well that a problem is only as hard as you make it, and I made this one my toughest ever. No excuse for it. Arrogance, complacency, and illogical assumptions had led me to basically abandon all the skills I not only prided myself on, but needed and depended on to do the job right. That main skill was to look for the obvious first before going into the detail.
I cannot stress enough, that no matter what your skill level when coding, things will only be as hard as you make them. Too much thinking and too much analyzing can be just as bad as not enough.
"So what's the fix Gonzo?" Glad you asked, here it is....
In FlyingVehicle.cc, at line 523 in the FlyingVehicle::getHeight() function, replace this line....
if(!mContainer->castRay(sp, ep, 0, &collision) == true)
with this line...
if(!mContainer->castRay(sp, ep, ~TerrainObjectType, &collision) == true)
then recompile and bask in the glory of a hovering flyer that sits at exactly the height above the ground that you always wished for it to. Then, jump in, push the nose into the ground and watch it raise itself back up and level out. It's a wonderful thing, I swear.
"Not much of a plan Gonzo."
For me it is, I 'plan' to never let myself make this kind of mistake again. Learn, don't burn.
Important EDIT:(Thanks to Stefan Lundmark for asking)
While my intent was to solve the problem of hovering above terrain, you can adjust this as follows.....
To hover above everything(Boxes, trees, buildings, etc...) change the line to....
if(!mContainer->castRay(sp, ep, sClientCollisionMask, &collision) == true)
If asked, I would recommend that line for addition to the HEAD. And if you like, you can also add in the players and make a vehicle hover over your head till you walk out from under it and then it will settle down to the terrain....
if(!mContainer->castRay(sp, ep, sClientCollisionMask & ~PlayerObjectType, &collision) == true)
Enjoy!
Amazing the thoughts that come to your mind when you solve a major problem. "Major problem? You should be proud." Yeah, well, you might not think so when you find out why I'm writing this. For months I had seen others wrestle with the hover aspect of the flying vehicles. Many persons had failed to get them to act the way they were supposed to act. It's a very frustrating thing to not be able to get hours worth of moddeling and/or coding work to perform properly. So one day I decided I would see if I could tackle the problem. I love to challenge myself, in fact, it seems I love it just a little to much.
My first mistake was to assume I was in for a major challenge of debugging and analyzing the full aspect of the function and its performance. Scrutinizing the details of the Math and the operational aspects that are branched into various parts of the engine. Pouring piece by piece, line by line trying to get a fully functioning model in my head of exactly what the function was doing, so I could see exactly where the flaw in someones logic was and fix it. Days and days later I was no closer to a hovering flyer than I was when I started. It just didn't make sense. I couldn't see the flaw in the logic. My mind was screaming at me "There has to be a flaw, it doesn't work right, if you can't find it, then you're just as flawed as it is." Frustration and self doubt sets in.
Finally, I gave in. My skills in doubt, my esteem shot. I had to give it up. My only comfort was that I was not the only guy to fail, but that didn't make me feel any better. That would have been the end of this story except by chance Martin "Muerte" Schultz sends me an email asking me if I ever managed to solve the issue. Like many others he had most likely assumed that since the thread went dead, a solution was found. After searching and not finding that solution, he mailed me. I can't say I was happy to answer his question(I hate to fail), so I took a very deep breath and popped open the FlyingVehicle.cc file and started to look at it again.
WHAM!!!!! Like a brick to the head I was knocked silly when the answer just jumped right out at me as if I been mailed the answer from the heavens above. I was dumbfounded by the fact that I could have, and should have seen this type of mistake in a matter of minutes, and in some cases, even seconds. I was instantly newbiefied. I felt so stupid for letting myself believe that the problem was harder than it was before I even started on it. I knew damn well that a problem is only as hard as you make it, and I made this one my toughest ever. No excuse for it. Arrogance, complacency, and illogical assumptions had led me to basically abandon all the skills I not only prided myself on, but needed and depended on to do the job right. That main skill was to look for the obvious first before going into the detail.
I cannot stress enough, that no matter what your skill level when coding, things will only be as hard as you make them. Too much thinking and too much analyzing can be just as bad as not enough.
"So what's the fix Gonzo?" Glad you asked, here it is....
In FlyingVehicle.cc, at line 523 in the FlyingVehicle::getHeight() function, replace this line....
if(!mContainer->castRay(sp, ep, 0, &collision) == true)
with this line...
if(!mContainer->castRay(sp, ep, ~TerrainObjectType, &collision) == true)
then recompile and bask in the glory of a hovering flyer that sits at exactly the height above the ground that you always wished for it to. Then, jump in, push the nose into the ground and watch it raise itself back up and level out. It's a wonderful thing, I swear.
"Not much of a plan Gonzo."
For me it is, I 'plan' to never let myself make this kind of mistake again. Learn, don't burn.
Important EDIT:(Thanks to Stefan Lundmark for asking)
While my intent was to solve the problem of hovering above terrain, you can adjust this as follows.....
To hover above everything(Boxes, trees, buildings, etc...) change the line to....
if(!mContainer->castRay(sp, ep, sClientCollisionMask, &collision) == true)
If asked, I would recommend that line for addition to the HEAD. And if you like, you can also add in the players and make a vehicle hover over your head till you walk out from under it and then it will settle down to the terrain....
if(!mContainer->castRay(sp, ep, sClientCollisionMask & ~PlayerObjectType, &collision) == true)
Enjoy!
Recent Blog Posts
| List: | 01/17/06 - Been a great year! 06/09/05 - Plan for Gonzo T. Clown 05/24/05 - Plan for Gonzo T. Clown 11/18/04 - Plan for Gonzo T. Clown 10/24/04 - Plan for Gonzo T. Exterminator 10/19/04 - Plan for Gonzo T. Clown |
|---|
Submit your own resources!| Stefan Lundmark (Oct 24, 2004 at 10:58 GMT) Resource Rating: 5 |
Cool to see that someone new to programming can get these fixes going, good eye.
| Nauris Krauze (Oct 24, 2004 at 11:59 GMT) |
| Xavier "eXoDuS" Amado (Oct 24, 2004 at 12:11 GMT) |
| Jorgen Ewelonn (Oct 24, 2004 at 12:15 GMT) |
The hovering issue aside, your point about how to tackle a problem is well made and applies to just every aspect of life (not to mention gamecreation).
Keep'em coming !
| Stefan Lundmark (Oct 24, 2004 at 12:40 GMT) Resource Rating: 5 |
Will this fix make it harder to dive into the ground, or does it only apply when the flying vehicle is created? Nevertheless, great fix.
| Ian Omroth Hardingham (Oct 24, 2004 at 13:36 GMT) |
:p
Ian
| Chris Newman (Oct 24, 2004 at 14:14 GMT) Resource Rating: 5 |
| X-Tatic (Oct 24, 2004 at 16:48 GMT) |
| Martin Schultz (Oct 24, 2004 at 16:53 GMT) Resource Rating: 5 |
Hopefully GG adds this fix to HEAD - surely lot's of other developers need this fix.
Best,
Martin
indies@work
| Harold "LabRat" Brown (Oct 24, 2004 at 18:11 GMT) |
if (!mContainer->castRay(sp,ep,-1,&collision))
NOTE: This is what was used in Tribes 2
| Gonzo T. Clown (Oct 24, 2004 at 23:04 GMT) |
@ Nauris - it's mine, keep away, lol.
@ Xavier - Amen. Thanks
@ Jorgen - Thanks, and I gotta say, I got a chill when I read your profile. Had we not been separated by thousands of miles I would have said we grew up as twins. I could not believe how much of your life mirrored my own. If we ever met I'll bet we would get along great.
@ Ian - Tell it to GG, lol. It's their code, I only wanted it fixed, not perfected.
@ Chris - Westy is correct.
@ Martin - Much thanks dude. It was your email that made this happen.
@ Harold - Although it's been so long now that I can't positively remember, I'm pretty sure I tried the -1 without success. I suppose I could try it again but at this point, it's functioning perfectly as is so I'm not inclined to waste any more time on it myself. I kinda want to forget I ever did this, lol. But I will note that none of the other ray casts in the engine use the -1, all of them are after a certain mask.
Edited on Oct 24, 2004 23:23 GMT
| Ben Garney (Oct 24, 2004 at 23:58 GMT) |
| Michael Cozzolino (Oct 25, 2004 at 10:35 GMT) |
| Martin Schultz (Oct 25, 2004 at 14:02 GMT) Resource Rating: 5 |
www.garagegames.com/mg/forums/result.thread.php?qt=22455
if someone searches for the solution via the forums and not via the resources (where this .plan will be found).
| Michael-Paul Jakovlevski (Nov 02, 2004 at 16:36 GMT) |
| Treb Connell (formerlyMasterTreb (Nov 17, 2004 at 22:53 GMT) |
| Matt Sanders (Feb 10, 2005 at 21:12 GMT) |
also not sure if it makes a difference but my original did not look like
if(!mContainer->castRay(sp, ep, 0, &collision) == true)
it looked like this:
if (!mContainer->castRay(sp,ep,0,&collision))
Edited on Feb 10, 2005 21:19 GMT
You must be a member and be logged in to either append comments or rate this resource.



5.0 out of 5


