Blitz3D or BlitzMax + Blitz3D SDK?

Miscellaneous Forums/General Discussion/Blitz3D or BlitzMax + Blitz3D SDK?

Hey guys,

I'm starting a new project soon which will require a lot of 3d elements. I've already shipped two BlitzMax products and am very comfortable with that environment. I've never tried the Blitz3D IDE or SDK.

My question is this, should I stick with my current license of BlitzMax and augment it with the Blitz3D SDK, or should I just buy a copy of Blitz3D?

Are there any major advantages/disadvantages with going with either path? How similar are the BlitzMax and Blitz3D IDE's? Is the syntax similar?

If you like BMax, stick with it, I own B3D and although it is still a good language, I could never go back to it. Lots of people seem to be doing well with 3D in BMax regardless of the engine they use.

If you program Max, then going to B3D will be a snip. The syntax is identical, although there are a few differences. The two main ones I can think of are that B3D has a delete command for types (no NULLing for garbage collector) and that type lists are internal, which is great if you only want 1 list for each type, but a pain otherwise.

As you're comfortable with Max and it's more versatile, I recommend you stick with it. I would also consider Leadwerks' engine as a competitor to B3D sdk. From what I have seen, it is just as easy to use.

Thanks for the quick responses guys, keep them coming!

Is using the Blitz3d SDK inside of Blitzmax as seamless as the product page seems to imply? Are there any example files out there for using BlitzMax with the new B3D SDK?

The most obvious disadvantages to using B3D that spring to mind are you're going to use Blide ( I'm just assuming you use Blide, it's an amazing IDE. ) You're going to lose pointers, interfacing with C easily, object orientation, slicing arrays. You're going to lose a lot of things which make coding easier, more fun and more manageable. And you're not going to gain much that I can see.

Besides, for me, this says it all

I've already shipped two BlitzMax products and am very comfortable with that environment.


If you program Max, then going to B3D will be a snip. The syntax is identical, although there are a few differences.

I don't think so; BlitzMax supports OOP, pointers, and many other features. Blitz3D basically has no OOP besides type support, minimal data types, no real variable or function pointers, nothing but total basics (not to mention Blitz3D code executes ~10 times slower than BlitzMax).

BlitzMax is a modern language - when you learn to use it properly, there's just about no limit to what you can do. If I had the choice between Blitz and BlitzMax as a language for my game development (or any kind of application development), I would choose BlitzMax instantly. It's just superior in almost every way.

Edit:
You're going to lose a lot of things which make coding easier, more fun and more manageable. And you're not going to gain much that I can see.

Well said :)

Oooof, no OOP in B3D? Blitzmax + B3D SDK it is!

Is there good documentation floating around for using Blitzmax with B3D?

I'm not sure if cross-platform (Mac/Linux) 3d development is important to you, but if it is, then Blitz3D SDK will not do, nor will Leadwerks engine. Just thought I'd mention it...

John J
Blitz3D code executes ~10 times slower than BlitzMax


10 times? 10x faster than Blitz3D? Proof?

Aren't you being a bit pumpous about BMAX and denigrating Blitz3D?

10 times? 10x faster than Blitz3D? Proof?

Certainly not in all areas, but I remember some tests in MaXML showing between 5-10 times performance boost over Blitz3D.

Aren't you being a bit pumpous about BMAX and denigrating Blitz3D?

Surely you agree that BlitzMax is many times faster than Blitz3D? Sometimes you just have to face the facts: BlitzMax is much faster than Blitz3D. You can't deny that Blitz3D's language and compiler is getting old, and it can't compete with BRL's latest.

I'm sorry if my numbers were off, but if you don't believe that BlitzMax is much faster than blitz, try it yourself. I have, and the difference is very impressive.

P.S. I'm referring to code execution speeds (CPU load), not GPU load.

Understood, I am taking you seriously, not just imagining that you're being biased in any way, hopefully. I'm currently preparing a performance test analysis using the demo version of BlitzMax 1.12 and Blitz3D 1.98.

With all the brouaha with Leadwerks's engine, BlitzMax, Cobra3D, ... I'm being really tossed left and right bewteen options and also expenses where I have to justify myself going a certain direction, as opposed to just closing my eyes and continue wy regular work.

I'm currently half satisifed with Blitz3D. Not in the sense that it's not giving me all of my 3D needs, in fact it's pretty good, when you have other 3rd party modules such as FastImage, or AShadow (both russian add-ons). But, I am starting to feel a little lonely in my belief that I can do something ultimately serious with the tools I'm using right now. Both the IDE and commandset in Blitz3D are not rock solid elements, and am constrantly finding issues that I have to circumvent.

For example, you can't copy a type content in Blitz3D. You can't declare a byte, or a short!!! The IDE cursor is incredibly bogus! Handling a 300KB source file in the IDE is like handling a 70KG Axe when you don't even weight that much yourself. And, don't even consider setting graphics options, such as Antialias, or Anisotropic filtering in Blitz3D! How about pixel perfect 2D graphics in a 3D graphics mode? Not the easiest and most straightforward way. Oh, the various problems concerning Alpha'd textures stacked each behind the other, or the vertex lighting problem, where vertexes are improperly lighted...

And the list goes on...

Anyhow, I'm having a hard time converting the type in this code example to BMAX(first time looking at using BMAX in fact):
http://www.blitzbasic.com/codearcs/codearcs.php?code=1998

But basically, I want to run this code on BMAX and see the results on my machine and compare them with the Blitz3D results. And that will give me an idea, I hope. Regardless of the performance of graphics, the core language needs to be fast. So this, is quite interesting to me.

Cheers.

Understood, I am taking you seriously, not just imagining that you're being biased in any way, hopefully.

Well, I used Blitz3D to create one of my best games, used BlitzMax mainly for a few simple non-serious apps, and now am using C++ mostly (some C# and C). I admit I haven't produced a full game in BlitzMax, but from what I saw it's a lot better than Blitz3D.

Not in the sense that it's not giving me all of my 3D needs, in fact it's pretty good, when you have other 3rd party modules such as FastImage, or AShadow (both russian add-ons). But, I am starting to feel a little lonely in my belief that I can do something ultimately serious with the tools I'm using right now.

Blitz3D can definitely be used to make a serious game, but it seems that the further you stretch Blitz3D's technology, the harder your programming becomes. Blitz3D as a language and engine is amazingly good (extremely good for simple games), but when you use "professional" tools for a "professional" job, your work gets a lot easier.

However, moving to BlitzMax with the same Blitz3D engine (using the Blitz3D SDK) isn't going to help much with your technical issues, and may even make your Userlibs inaccessible (although it opens up a huge new possibility through Modules), so that's definitely something to consider.

If I was in your place, I'd only move to BlitzMax if:
1. More code execution speed is needed
2. Modern programming language features would be helpful
3. All critical userlibs have suitable BlitzMax module replacements

The Leadwerks engine can theoretically just be recompiled on the other platforms (according to Josh) so I think it's a matter of time (down the road) before it runs on Macs as well as Linux.

Performance test with the BM Demo?
Sorry, 1.12 is that outdated that it does in now way reflect the current BM.
The core has been modified at least twice!

Yeah John, in my effort not to sound too BMX fanboy, I missed out some of its main strengths! My point is still valid that it is easy to program B3D if you know Max, but there is a lot you will miss. I have seen real world tests where Max is 3 or 4 times faster than B3D in number crunching.

I tested simple floating point number operation some time ago on a few compilers, and the speed order was like:

Visual C++ 2005 > Visual Basic 2005 > Visual C# 2005 >> BlitzMax > MinGW >> Delphi 7 > Blitz3D.

Blitz3D was like 2 times slower than BlitzMax, and BlitzMax was like 2 times slower than Visual C++.

Don't suppose you have that C++ and BMX code handy, Lumooja? I would be interested to see it.

Nomen, this is the code I used for testing:


Visual C++:
#include <stdio.h>
#include <windows.h>


static void floatTest() {
	for (int i = 0; i < 5; i++)	{
		int t1 = GetTickCount();
		for (int j = 0; j < 5; j++) {
			double c = 0.0f;
			while (c < 200000) c+=0.01f;
		}
		int t2 = GetTickCount();
		printf("%d\n",t2-t1);
	}
}


int main(void) {
	floatTest();
}



BlitzMax:
SuperStrict
Local x:Int
Local i:Int
Local t1:Int
Local t2:Int
Local c:Double
Local f:TStream
f = WriteFile("resu.txt")
For i = 0 To 4
	t1 = MilliSecs()
	For x = 1 To 5
		c = 0.0;
		While (c < 200000.0)
			c:+0.01
		Wend
	Next
	t2 = MilliSecs()
	WriteLine f,(t2 - t1)
Next
CloseFile (f)


That's not really a fair test of floating point operations. Your results are being swayed by file handling operation speeds. Whether that makes it faster or slower, comparitively, I don't know, but it's not a very accurate test of floating point operations.

The file handling doesn't matter at all, since it's outside of the time measuring loop. I tried also without writing to file, and got exactly the same timings, but since I run the final tests always from DOS, I needed to output the results to a text file. And I tried also with a Repeat...Until loop, and got also the same timings.

Thanks, Lummoja.

I was hoping to see some major blooper in your code, because my feeling was that Blitzmax could do better than half the speed of a good C++ compiler. I have to say, I can't see any such problem.

Could you try increasing the number of loops x (j in the C++) performs to 10,000? This would give a better average and minimise any effects caused by differences in the time taken for the timing functions to execute.

Cheers

The file handling doesn't matter at all, since it's outside of the time measuring loop.

Sorry, you're right. I shouldn't try to read code when I'm still bleary-eyed.

Nomen, I changed x to 100, and the result was that VC++ is still 2.52 times faster than BlitzMax:

VC++:
4437
4454
4437
4438
4453

BlitzMax:
11195
11192
11194
11196
11194

With x = 10000 it would take over 5 days to do one loop in VC++, and accordingly over 12 days in BlitzMax :)

Thanks. Not wanting to labour a point, but I want to get to the bottom of this, and I'm still hoping Blitz doesn't perform this badly on a simple loop!

Is there any way to get an assembly file output from C++? Also, have you got debug turned off in Blitz?

Here is the disassembly, and I didn't have Debug enabled in BlitzMax:
--- f:\user\all\floatspeedtest\floatspeedtest.cpp ------------------------------
#include <stdio.h>
#include <windows.h>


static void floatTest() {
00401000  push        ebx  
	for (int i = 0; i < 5; i++)	{
00401001  mov         ebx,dword ptr [__imp__printf (40209Ch)] 
00401007  push        ebp  
00401008  push        esi  
00401009  push        edi  
0040100A  mov         edi,dword ptr [__imp__GetTickCount@0 (402000h)] 
00401010  mov         ebp,5 
		int t1 = GetTickCount();
00401015  call        edi  
00401017  fldz             
00401019  fld         qword ptr [__real@3f847ae140000000 (4020F8h)] 
0040101F  mov         esi,eax 
00401021  fld         qword ptr [__real@41086a0000000000 (4020F0h)] 
00401027  mov         ecx,64h 
		for (int x = 0; x < 100; x++) {
			double c = 0.0f;
0040102C  fld         st(2) 
			while (c < 200000) c+=0.01f;
0040102E  fadd        st,st(2) 
00401030  fcom        st(1) 
00401032  fnstsw      ax   
00401034  test        ah,5 
00401037  jnp         floatTest+2Eh (40102Eh) 
00401039  sub         ecx,1 
0040103C  fstp        st(0) 
0040103E  jne         floatTest+2Ch (40102Ch) 
00401040  fstp        st(1) 
00401042  fstp        st(0) 
00401044  fstp        st(0) 
		}
		int t2 = GetTickCount();
00401046  call        edi  
		printf("%d\n",t2-t1);
00401048  sub         eax,esi 
0040104A  push        eax  
0040104B  push        offset string "%d\n" (4020ECh) 
00401050  call        ebx  
00401052  add         esp,8 
00401055  sub         ebp,1 
00401058  jne         floatTest+15h (401015h) 
0040105A  pop         edi  
0040105B  pop         esi  
0040105C  pop         ebp  
0040105D  pop         ebx  
	}
}
0040105E  ret              
--- No source file -------------------------------------------------------------
0040105F  int         3    
--- f:\user\all\floatspeedtest\floatspeedtest.cpp ------------------------------


int main(void) {
	floatTest();
00401060  call        floatTest (401000h) 
}
00401065  xor         eax,eax 
00401067  ret


Hey thanks very much! I will get round to comparing this with the Blitz stuff at some stage.....

Is there a way to disassemble BlitzMax code also?

The blitzmax compiler produces assembly which is passed to FASM (an independently produced assembler, and a damn fine one) to produce the output exe. Take a look in your .bmx directory. I think they are the ones ending in .s.

Well, the BlitzMax example is dealing with write operations in files, while the CPP is not. that's not a good comparison!!!

I provide the corrected code:

CPP:
#include <stdio.h>
#include <windows.h>


static void floatTest() {
	for (int i = 0; i < 5; i++)	{
		int t1 = GetTickCount();
		for (int j = 0; j < 5; j++) {
			double c = 0.0f;
			while (c < 200000) c+=0.01f;
		}
		int t2 = GetTickCount();
		printf("%d\n",t2-t1);
	}
}


int main(void) {
	floatTest();
}


blitzMax:
SuperStrict
Local x:Int
Local i:Int
Local t1:Int
Local t2:Int
Local c:Double
Local f:TStream
For i = 0 To 4
	t1 = MilliSecs()
	For x = 1 To 5
		c = 0.0;
		While (c < 200000.0)
			c:+0.01
		Wend
	Next
	Print (MilliSecs() - t1)
Next


Blitz3D:
Local x
Local i
Local t1
Local t2
Local c#
For i = 0 To 4
	t1 = MilliSecs()
	For x = 1 To 5
		c = 0.0;
		While (c < 200000.0)
			c = C +0.01
		Wend
	Next
	Print (MilliSecs() - t1)
Next



BlitzMax (debug off):
353
351
374
360
355

C++ (no debuger present)
234
235
234
234
219

Blitz3D (debug off)
1407
1429
1512
1489
1696

The numbers make the diference obvious. Taking into account than C++ is unmanaged, I think BlitzMax is awesome fast, spetially compared to its parent Blitz3D

Ziggy, I copied your BlitzMax code and get exactly the same timings as with my WriteFile version (note that x = 1 to 100):
11196
11212
11211
11203
11199
But it seems that your BlitzMax runs faster than mine, or then your VC++ compiler runs slower (did you have Release build, and not Debug?)

Debug was off in all tests

Intel vs. AMD, by any chance?