Compilation 'Memory Violation Error', 100% CPU use

Blitz3D Forums/Blitz3D Beginners Area/Compilation 'Memory Violation Error', 100% CPU use

joerae(Posted 2004) [#1]
Hi Guys,

first post here, I've been using Blitz3D for about a month now, and I have a problem, and a question.

My game runs fine within Blitz 3D, but once I compile to an executable, and run it, sets the video mode (i.e. a window or full screen, depending on the options) and then stops with a 'Memory Access Violation' and exits.

This happens every time. I've tried resetting the computer, disabling firewall and antivirus, recompiling, everything, but I get a 'Memory Access Violation' and a swift exiting each time. Any ideas?

Also, I notice the 'castle' demo with Blitz3D uses 100% CPU power on an Athalon 2400+ / Radeon 9700. Is this normal? There don't seem to be any frame drops. My game currently uses about 40-60%, but will sometimes max out also. I currently have about 6 collission detection types. Is collision detection one of the most CPU intensive functions? Is there any general rules for making less CPU intensive programs.

Thanks in advance for the help.


Shambler(Posted 2004) [#2]
A common cause of MAV is using a float variable to store an entity in, search through your code for any '#' variables and make sure they aren't being used for entities.

100% usage is fine for a game, after all most people aren't doing anything else whilst playing it.
Some people may like to download stuff while playing a game, I believe adding a 'Delay 1' command to your main loop will allow their download program some cpu time.


Gabriel(Posted 2004) [#3]
If you only get a MAV when it's compiled your program is probably not finding the media files you're loading.


Ross C(Posted 2004) [#4]
Complie your .exe with debugmode on. See what kinda error u get :)


joerae(Posted 2004) [#5]
Thanks for the help. Compiling with debug mode doesn't give me any errors (that I can see). Would the error messages just 'pop up'.

I'll have a big look through for storing entities in floats. Just to make sure I know what you mean, this would be the type of error you're talking about right?

Type box
Field sprite#
End Type

b.box\sprite# = createcube()

Sybixsus, I take it I'll need to keep the same path structure for my files (i.e. my media files aren't included in the .exe)


joerae(Posted 2004) [#6]
OK, thanks for the help, I have it sorted now.

Thankfully I didn't have any float / entity mismatches.

Just the much stupider mistake of not saving the .exe to the same directory as the .bb file, so my art asset's pathing directory was shanked. (In my defense, I was used to Game Maker, which puts all of the assets together into a gigantic .exe file)

I did try searching for 'Memory Access Violation', but now I know it's called MAV will make it easier.

Thank you all very much for the help, and I'm stoked I've now succesfully compiled my first program ever!


Ross C(Posted 2004) [#7]
:D Well done ;)

Remember that all the .bb's are complied into the one .exe file. So you don't need to have them along with the rest of the files :)