Sign in to follow this  
Guest christian

Bgl / Api crash detection

Recommended Posts

Hi,I found some code on the forum a while ago that would add crash detection to bgl's called from an api as a library object via fsregen.I have found that when an aircraft nears the object in the sim psychedelic effects appear in the sim, if I remove the crash detection everything seams fine.I have been searching for the forum for the original example to check what I did, I think it was a post by Arno, but I am unable to find it.Could someone point me in the right direction.Thanks,

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Thanks for the reply Arno,I am writing a small prog in c++ to edit small things that have to be changed in different files, changing

Share this post


Link to post
Share on other sites

Hi David.I'm attaching 2 TXT files. The first is the Object Library ASM code for a huge house, made in GMax, and processed by fsregen into an object libray BGLC code... and has the 'ripped' crash-detection added.The second file is a SCASM code that places the object.Crash detection works fine. And you should see what needs to be extracted from HouseObject.asm and where it should be added to the object library code.Dick

Share this post


Link to post
Share on other sites

Dick,I "chop n changed" my file as your example 1, but had the same problem. So could the problem be the api macro.I am using FSSC to place the macros and have three different examples, I'm not sure of the difference, or could it be FSSC causing the problem.Here are the three examples, one is FsRegen generated, another from the FsRegen tutorial and the other from the Arno tutorial.Thanks again for your help, David

Share this post


Link to post
Share on other sites

Hi David.Did you compile the bgls from the examples I attached, then used them in the sim? Can you crash into the huge house? I just saved them from the attachments and compiled them again, and they work as expected on my system with FS2002.If those examples still produce odd visual results on crashing, there's either something wrong with your computer, or your FS2002 setup ( or addons ).I don't see anything with any of those API's that would cause a problem. They just place a library object.Dick

Share this post


Link to post
Share on other sites

Hi Dick,When I tried your example, FSSC reports:Error in macro file C:MYDOCU~1FS2002~1MACROSDICKCR~1.SCM line 21 -> EndA -> unresolved label :PlaceObject1 in line 10Scasm compilation status: error(s) 1David

Share this post


Link to post
Share on other sites

Hello again, no luck,Must be something peculiar to my system. If I do things the original way and leave out the crash detection, no problem. I used Dicks example files with the correction, and the whole of my scenery was excluded.Dont know if its the directories used or what, maybe a complete re-install would help.Thanks again, David

Share this post


Link to post
Share on other sites

Hi David.One file can be drag'n'dropped onto SCASM's icon to compile. The other can be Drag'n'dropped onto BGLC. FSSC should even be used with those examples to see if they work. Just compile them, and go to the location, and crash you plane into the huge grey house. ( grey because you didn't get the textures ).I'm sensing a dependance on FSSC here that's interfering with your need to check out this problem. If without the use of FSSC, your crash detection is fine, then it is FSSC that is causing the problem somehow... or perhaps your version of SCASM used by FSSC is somehow not quite right.If you give Arno the sourcecode produced by FSSC, maybe he can find a problem.But the visual deformities you have mentioned, point to a hardware problem... not a SCASM coding problem.Dick

Share this post


Link to post
Share on other sites

Dick,I did as you suggested and compiled the raw files, took the aircraft within a few feet of the BIG house, look round from virtual cockpit or external view and the effect is like having the "pointer trail" for the mouse turned on in the control panel (as near to the effect as I can describe)Where next? David

Share this post


Link to post
Share on other sites

Hi David.I'm sure this is a problem with your hardware, probably the way it renders Directx7 or 8.Try changing the resolution of your videocard to different Fullscreen settings.. 16 bit instead of 32.. or different sizes... or bilinear filtering rather than trilinear. If it's the videocard ( or it's driver ), different settings will have different odd effects. DickP.S. What are your computer specs?

Share this post


Link to post
Share on other sites

Hi Dick,I was in the process of doing what you suggested with the settings and have just downloaded the latest drivers (13Mb+ ouch!), still the same problem.This is on a homebuilt Athlon XP1900+ with a geforce 2. I also have a laptop, 1.6 pentium 4 mobile with geforce 4 go graphics. I just transferred the files over to that machine and have exactly the same problem, I think that is too much of a coincidence and the problem is in the files somewhere. I also find it odd that this only happens when the crash detection code is introduced into the file.After looking closely at the graphic corruption it seems that the sky is being overdrawn when panning, does that make sense?David

Share this post


Link to post
Share on other sites

Hi David,Strange, I can't get it to work either.Also tried to make a simple test object with GMax. Put it into a library and added the crash detection code to the library. Same effects and the crash does not work.Dick (I hope you know, I can't remember) did we actually test it in the earlier thread? I didn't test it on my machine then, did everything work fine?Arno


Member Netherlands 2000 Scenery Team[link:home.wanadoo.nl/arno.gerretsen]Arno's FlightSim World for scenery design hints, tips and other tricks...

Share this post


Link to post
Share on other sites

Hi Arno and David.I put together a package that contains a large cube from Gmax. I hope the documentation ( html file ) is enough to explain just how I added the Crash code to the object.I can place this Library object and crash into it just fine.LargeCube.zipDick

Share this post


Link to post
Share on other sites

Hi Dick,Strange, that's the same I did (without the include, I added the crash code at the same place though). Only I had made the object a bit more complex and the crash code was thus also longer. Maybe that confused FS....But at least this one works :).Arno


Member Netherlands 2000 Scenery Team[link:home.wanadoo.nl/arno.gerretsen]Arno's FlightSim World for scenery design hints, tips and other tricks...

Share this post


Link to post
Share on other sites

Hi Arno.I'm glad we got something working. :)Hopefully, Dave gets it working as well. Then we could rule out his computer being at fault.I just updated the zip file to include a large cube placed just to the west. That was placed with fsregen's API through FSSC.. no problem. You can fly between the objects with a small airplane, and not crash... so Gmax's OctTree seems pretty tight to the 'skin'.I like the idea of using the 'include' code to add the crash detection, as it is more modular, and less 'invasive' to the Cube_0.asm code.It's really a shame the crash detection isn't part of the object in Gmax. I don't know if that's Gmax's fault , or MakeMDL.Dick

Share this post


Link to post
Share on other sites

Hi Dick & Arno,Dick, I placed your precompiled LargeCube.bgl and placed it in my scenery folder, placed LargeCube.api in my FSSC macro folder and removed all the other scenery from this project, to just leave the cube. Still no problem crashing, but take a cessna within a planes length of the cube and pan the view and the I have the same graphics corruption. Clutching at straws, I left the aircraft in position and thought I would try a different plane, but when the selection screen appears with the revolving aircraft, that screen also has the same corruption.I as mentioned in an earlier post, I have the same problem on my laptop. The only thing they have in common is one has a geforce 2 and the other a geforce 4. If you could confirm the experiment above, I can only assume that this is an nvidia graphics problem.David.

Share this post


Link to post
Share on other sites

>It's really a shame the crash detection isn't part of the >object in Gmax. I don't know if that's Gmax's fault , or >MakeMDL. MakeMDL of course, that's the exporter from GMax. GMAx doesn't know anything about crashing (apart from its own bugs of course :D).I agree that it would be more logical if MS had put the crash code into the _0.asm file, as it belongs to the object and not to the placement of it.Arno


Member Netherlands 2000 Scenery Team[link:home.wanadoo.nl/arno.gerretsen]Arno's FlightSim World for scenery design hints, tips and other tricks...

Share this post


Link to post
Share on other sites

Hi David.I can stop the Cessna about a plane's length away with pause, then switchto slew and rotate the heading... and I see visual artifacts ( trailing ), until I stop the rotation... then the view 'snaps' to a corrected view, with no trailing.I'm assuming your system doesn't 'snap' to the corrected view. That could be the videocard, drivers, or the version of Directx. ( probably a video card quirk ). Thankfully, it only happens on crashes(?)Dick

Share this post


Link to post
Share on other sites

Hi Dick,That is exactly the effect that I have been trying to describe, and the graphics on my system also return to normal after a second or two.The problem is, I am placing a large number of hedgerow macros, the airfield I am recreating has hedgerows at either end of the runway and close to the taxi and parking areas. So when you taxi the aircraft close to the hedgerows the effect is awful.I could omit the crash detection, but would much prefer to find a solution. It is not really practical to place them individually from gmax, but that would cure the problem.Thanks for your time, David

Share this post


Link to post
Share on other sites

Hi David.OKMy view 'snaps' much quicker than than your system.. but the artifacts are there... seem to be only in the sky space ( above the visual horizon ).I can see where this would be a problem when taxiing about.Now I'm wondering if our tricks with transform calls might work.I went to O'hare to see how their crash dectection was working... and found there is very little detection! But some objects do have it.Got me thinking. What if your Hedges had no detection, but you could place some detection slightly behind the hedges? SCASM has a variety of crash codes that might work.. from the SCASM docs:Crash( :Lab1 rad :Lab2 :Lab3 dens ) Test for crash detection.This command should be used before using the PerspectiveCall command.Do not use it in library objects.:Lab1 Points to the end of the following crash code. rad the objects ground radius :Lab2 Points to the RefPoint() instruction used with this object. This must be a normal refpoint with an scale factor. :Lab3 Points to the RotatedCall() used with this object. Set it to :[0] if not used. dens Note that it says "Do not use it in library objects." Well, you wouldn't put it in the library, but use it instead of the library crashing. And, as I said, you could place it behind the hedge slightly.. although that might not be needed if the crash routine is not part of the object! There might be no visual artifacts at all.I'll play with these commands a bit... and there should be a way to make an API of them.Dick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this