B3D v BMAX

BlitzMax Forums/BlitzMax Beginners Area/B3D v BMAX

pc_tek(Posted 2011) [#1]
I had decided to scrap my old BB3D proggy and start fresh using BMAX, but I have stumbled onto a 'big' problem.

The B3D version of the game is in 800x600, whilst the new version is using 640x480 in BMAX.

Using FRAPS to look at FPS rates, I am very dissappointed to see a rather significant drop using BMAX...

B3D gives a rock-solid 60, BMAX gives me anything between 35 and 57.

What am I doing wrong? Same graphics files, same animations, even the same code (almost)...?


Hotshot2005(Posted 2011) [#2]
IF you show the code of BlitzMax then I am sure that are some BMAX Expert here will help your Goal! :)


ima747(Posted 2011) [#3]
Which driver are you using in BMAX? Perhaps your graphics card has good DX7 support and poor DX9 (I think the default for BMAX...). Just a thought. Also are you running in debug mode? Are you using pure bmax, or is it a 3D program and you're using MiniB3D?


pc_tek(Posted 2011) [#4]
Hotshot: the code is too extensive to show here.

ima: the default driver is used I presume because I have no reference to any other


Yasha(Posted 2011) [#5]
What are you doing with it?

i.e. 2D or 3D? If 2D, was the B3D version using native 2D or 2D-in-3D? Just drawing, or pixel-crunching? Is there a lot of text involved, or a lot of input polling? If 3D, what are you doing apart from the very basics of 3D rendering? etc.

Oh, and seconding ima747: make sure it's not in debug mode!

Also, isn't the default graphics mode OpenGL?

Last edited 2011


pc_tek(Posted 2011) [#6]
Yasha: It's a 2d-scrolling platform...nothing special. Debugmode is off.


col(Posted 2011) [#7]
Hiya,

Default order is in order of support of :-

Dx9 , Dx7 , OpenGL.

As Yasha and ima747 suggest, more specific information is needed.


col(Posted 2011) [#8]
You can output the current driver used by using

GetGraphicsDriver().ToString()

to return the driver name as a string.


xlsior(Posted 2011) [#9]
Two thoughts:

- Try setting the display drivers to DX7 to try to match B3D, and see if that makes any significant difference on your computer
- If you're using drawtext, try disabling those statements and see if if that has much effect on your framerate. Drawtext can be notoriously slow on some computers. If that's the problem, then switching to an imagefont may be the way to go.


pc_tek(Posted 2011) [#10]
After changing the drivers, variables don't work so good...

TTimer, TImage etc...


Jesse(Posted 2011) [#11]
there are many things that can slow the game down and with out looking at your code we are just shooting in the dark.
best thing you can do is profile it to find out where the issues are then post the specific issues here so we can help you.

I am also willing to look at your code if you don't mind sending it to me or at least your key files.


xlsior(Posted 2011) [#12]
After changing the drivers, variables don't work so good...

TTimer, TImage etc...


Are you using any framework/imports?

If so, it's possible that you are missing in import that may have happened 'behind the scenes' before through the default graphics driver.

Note that TImage is probably reserved by the system already, if you created your own variable by that name it could be conflicting.

Last edited 2011


SLotman(Posted 2011) [#13]
My experience here is just the opposite: usually bmax is faster than b3d - specially in 2D! (In 3D, with miniB3D sometimes b3d can be faster, sometimes miniB3D wins).

First of all: why your game in bmax is 640x480? a simple "graphics 800,600" and it will run at the same resolution as b3d :P

Second: how did you convert the code? Did you use the "automatic" converter in the IDE? That uses a lot of tricks, which ends up creating a lot of handles and other things to emulate B3D coding, which is bound to slow everything down.

Third: as said above, comment any "framework" command from the program, and try SetGraphicsDriver <driver>. Maybe your card doesn't support dx9 properly, so try dx7 and even opengl.

Fourth: You're not by any chance loading images in the main loop, are you? B3D would check the filename and completely skip the loading if the texture was already loaded in memory, while I suspect max will load it eveytime.

If all of that fails, you can still check the speed difference by doing a stress test - draw tons of images on screen at once. Show the FPS on screen and you can see which one is faster! =)


pc_tek(Posted 2011) [#14]
Slotman:

Code conversion was a line at a time, no converter was used.
No loading takes place during the main loop.
Changing the driver to DX7 knocks the program out so it won't even compile.

the command 'jugs:TImage=loadimage...' is spat out because of TImage!


SLotman(Posted 2011) [#15]
It should compile and run fine - changing the driver has nothing to do with it.

Are you sure you're not using the "Framework" command anywhere?
Are you using the latest version of blitzmax?

Try this code below:

SuperStrict

SetGraphicsDriver D3D7Max2DDriver()

Graphics 800,600,0

' change this to your bmax install path
Local bmxPath:String = "C:\Apps\Linguagens\BlitzMax"

If FileType(bmxPath+"\samples\breakout\media\B-Max.png")<>1 Then Notify "Error: file path is wrong!"; End

Local image:TImage=LoadImage(bmxPath +"\samples\breakout\media\B-Max.png")
If image=Null Then Notify "Error loading image!"; End

While Not KeyHit(KEY_ESCAPE)
   Cls
   DrawImage image, 0,0
   Flip
Wend


Don't forget to change the bmxPath to where you installed blitzmax. (Not in "Program Files..." I hope)

If that doesn't work - try reinstalling blitzmax, updating your drivers... or something :P~

Last edited 2011


pc_tek(Posted 2011) [#16]
I used the 'SetGraphicsDriver D3D7Max2DDriver()'

And all is well again...cheers all. Am now getting 71 fps!

Yippeeeeeeee!