Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro VS Irrlicht for tilemapping!

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Allegro VS Irrlicht for tilemapping!
Burnt One
Member #3,014
December 2002

Well it may seem bizzare to compare allegro with a 3d engine,but why not.

I drew 6 diffrent tiles alternating each draw,using video bitmaps with full acceleration, 15x15 grid of 32x32 tiles in a 16 bit color depth.

Irrlicht(opengl): 924 fps average
Irrlicht(directx8): 395 fps average
Allegro(dx full accel): 492 fps average

Well the ogl kicked allegros ass, id assume the directx did so bad because each tile had its own texture?

Considering the results and that the irrlicht version actually took less code i think im leaving allegro devolpment, 3d acceleration has just come along to far... the above code doesnt even take into account for trasparencys/coloring which would give opengl an even bigger leap.

Maybe one day there will be a GFX_OPENGL for allegro, but untill then peace all.

kazzmir
Member #1,786
December 2001
avatar

Quote:

Maybe one day there will be a GFX_OPENGL for allegro, but untill then peace all.

There is allegroGL somewhere. Dont have the link ATM

Chris Katko
Member #1,881
January 2002
avatar

Allegro uses what, DirectX 3? Never even heard of Irrlicht.

But, best of luck to you then.

[edit - sidenote]

Wouldn't programming OpenGL or DirectX directly be even faster then a helper library?

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Bob
Free Market Evangelist
September 2000
avatar

Here's a question: Are you using the same tile over and over again? What if you have a mix of tiles? If so, what's the mix?

Quote:

Considering the results and that the irrlicht version actually took less code i think im leaving allegro

Could you post said code?

Edit: Also, which video card was this tested on?

--
- Bob
[ -- All my signature links are 404 -- ]

Burnt One
Member #3,014
December 2002

Im not trying to dis allegro, i like allegro, for people with older graphics cards it would probly sway the other way, im usng radeon 9000(a few years old)

BOB: I said i used 6 diffrent tiles and alternated each blit..

ETWINOX: Yes im sure it would but i plain on using a few of its 3d features which would be alot to program...

Anywho heres the allegro version: (spaces removed)

1#include <allegro.h>
2volatile int fps,lastFPS;
3void too()
4{
5lastFPS = fps;
6fps=0;
7}
8END_OF_FUNCTION(too);
9BITMAP *images[6];
10int main()
11{
12fps=lastFPS=0;
13 allegro_init();
14 set_color_depth(16);
15 set_gfx_mode(GFX_AUTODETECT,640,480,0,0);
16 install_keyboard();
17 install_timer();
18 BITMAP *poo=load_bitmap("test.bmp",0);
19 for(int o=0;o<6;o++)
20 {
21 images[o] = create_video_bitmap(32,32);
22 }
23 draw_sprite(images[0],poo,0,0);
24 destroy_bitmap(poo);
25 poo = load_bitmap("test1.bmp",0);
26 draw_sprite(images[1],poo,0,0);
27 destroy_bitmap(poo);
28 poo = load_bitmap("test2.bmp",0);
29 draw_sprite(images[2],poo,0,0);
30 destroy_bitmap(poo);
31 poo = load_bitmap("test3.bmp",0);
32 draw_sprite(images[3],poo,0,0);
33 destroy_bitmap(poo);
34 poo = load_bitmap("test4.bmp",0);
35 draw_sprite(images[4],poo,0,0);
36 destroy_bitmap(poo);
37 poo = load_bitmap("test5.bmp",0);
38 draw_sprite(images[5],poo,0,0);
39 destroy_bitmap(poo);
40 install_int_ex(too,BPS_TO_TIMER(1));
41 poo=create_video_bitmap(640,480);
42 BITMAP *poo2=create_video_bitmap(640,480);
43 BITMAP *pa=poo;
44 int arf=0;
45 while(!key[KEY_ESC])
46 {
47 fps++;
48 lock_bitmap(pa);
49 clear_bitmap(pa);
50 for(int y=0;y<480;y+=32)
51 {
52 for(int x=0;x<480;x+=32)
53 {
54 arf++;
55 if(arf==6)arf=0;
56 draw_sprite(pa,images[arf],x,y);
57 }
58 }
59 textprintf(pa,font,490, 20, makecol(255,0,0),"FPS:%i", lastFPS);
60 release_bitmap(pa);
61 screen = pa;
62 if(pa == poo2)pa=poo;
63 else pa=poo2;
64 }
65 destroy_bitmap(poo2);
66 destroy_bitmap(poo);
67 for(int p=0;p<6;p++)
68 {
69 destroy_bitmap(images[p]);
70 }
71 return 0;
72}
73END_OF_MAIN();

And irrlicht(both just change DT_OPENGL to DT_DIRECTX8 or 9 if u have the extension:

1#include <irrlicht.h>
2using namespace irr;
3int main()
4{
5 IrrlichtDevice *device = createDevice(video::DT_OPENGL,core::dimension2d<s32>(640,480),false,true);
6 video::IVideoDriver* driver = device->getVideoDriver();
7 video::ITexture* images[6];
8 images[0] = driver->getTexture("test.bmp");
9 driver->makeColorKeyTexture(images[0],video::SColor(255,255,0,255));
10 images[1] = driver->getTexture("test1.bmp");
11 driver->makeColorKeyTexture(images[1],video::SColor(255,255,0,255));
12 images[2] = driver->getTexture("test2.bmp");
13 driver->makeColorKeyTexture(images[2],video::SColor(255,255,0,255));
14 images[3] = driver->getTexture("test3.bmp");
15 driver->makeColorKeyTexture(images[3],video::SColor(255,255,0,255));
16 images[4] = driver->getTexture("test4.bmp");
17 driver->makeColorKeyTexture(images[4],video::SColor(255,255,0,255));
18 images[5] = driver->getTexture("test5.bmp");
19 driver->makeColorKeyTexture(images[5],video::SColor(255,255,0,255));
20 gui::IGUIFont* font = device->getGUIEnvironment()->getBuildInFont();
21 int fps = driver->getFPS();
22
23 int lastFPS = -1;
24 wchar_t tmp[1024];
25 while(device->run() && driver)
26 {
27 int p=0;
28 driver->beginScene(true, true, video::SColor(0,122,65,171));
29 for(int y=0;y<480;y+=32)
30 {
31 for(int x=0;x<480;x+=32)
32 {
33 p++;
34 if(p==6)p=0;
35 driver->draw2DImage(images[p], core::position2d<s32>(x,y), core::rect<s32>(0,0,32,32), 0, video::SColor(255,255,255,255), true);
36 }
37 }
38 fps = driver->getFPS();
39 if (lastFPS != fps)
40 {
41 swprintf(tmp, 1024,L"fps:%i", fps);
42 lastFPS = fps;
43 }
44 font->draw(tmp, core::rect<s32>(490,10,520,50), video::SColor(255,255,255,255));
45 driver->endScene();
46 }
47 device->drop();
48 return 0;
49}

o ya incase ur intrested in testing heres Irrlicht

O i used draw sprite for simplicity mighta got a few more fps for allegro using blit.. but irrlicht is using masking to..

Bob
Free Market Evangelist
September 2000
avatar

Quote:

lock_bitmap(pa);

I'm not sure that you really want to do that :)

You're thinking of

Oh, and you can also put the video bitmap creation code into a function...

--
- Bob
[ -- All my signature links are 404 -- ]

Chris Katko
Member #1,881
January 2002
avatar

Is it just me or does the Irrlicht code look really nasty?

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Burnt One
Member #3,014
December 2002

BOB:
i switched to acquire_bitmap and got the same results..

and yes i could also put the irrlicht load into a function... i was just doing a sloppy test..

ETWINOX:
Im not going to defend the library im out, but the irrlicht version can do ALOT more with just changing one arguement or two,and i didnt use 'using namespace' which would remove things like core::

peace all.

Bob
Free Market Evangelist
September 2000
avatar

Here's a question: does draw2DImage() skip transparent pixels?

--
- Bob
[ -- All my signature links are 404 -- ]

nonnus29
Member #2,606
August 2002
avatar

Quote:

Maybe one day there will be a GFX_OPENGL for allegro, but untill then peace all.

This is what I was getting at awhile back, but I didn't think to call it a driver...

But regardless, that kind of speed is way overkill for any game 99% of allegro users would create (Sirocco and the XOP guy being the exceptions).

Bob
Free Market Evangelist
September 2000
avatar

Quote:

Maybe one day there will be a GFX_OPENGL for allegro

Ahem

--
- Bob
[ -- All my signature links are 404 -- ]

Korval
Member #1,538
September 2001
avatar

Quote:

Irrlicht(opengl): 924 fps average
Irrlicht(directx8): 395 fps average
Allegro(dx full accel): 492 fps average

Do these numbers surprise you in some way? Did you really expect that using a 2D path on a 3D graphics card would, for some reason, be faster than hardware 3D?

Actually, I'm surprised by D3D's performance. That's inexcusable, and it's, more than likely, Irrlicht's fault.

SpongeBob SquarePants
Member #2,126
March 2002

Quote:

Do these numbers surprise you in some way? Did you really expect that using a 2D path on a 3D graphics card would, for some reason, be faster than hardware 3D?

They suprise me, i would think a library designed to 2D would atleast be able to compete with one meant for 3D.

Quote:

Ahem

I think he meant set_gfx_mode(GFX_OPENGL,...). Allegro gl is a good thing but the allegrofied blitting routines aren't complete, and even if they were you would still be limited by allegros current API(strecthing/coloring/blending can't be handled in a single blit). And OpenGL by itself is very confusing and long winded.

Irrlicht however seems to be Linux and Windows only, that sucks, and also the d3d performance is not very impressive either.

Inphernic
Member #1,111
March 2001

I have an (Allegro+)OpenGL tile engine which runs at 1300fps average. ;)

Korval
Member #1,538
September 2001
avatar

Quote:

They suprise me, i would think a library designed to 2D would atleast be able to compete with one meant for 3D.

Why? Especially since 2D operations are only a special case of 3D.

Quote:

I think he meant set_gfx_mode(GFX_OPENGL,...).

Isn't that what AllegroGL gives you, for all intents and purposes?

Quote:

even if they were you would still be limited by allegros current API(strecthing/coloring/blending can't be handled in a single blit).

Unless, of course, you change OpenGL state behind AllegroGL's back.

Quote:

And OpenGL by itself is very confusing and long winded.

If you find OpenGL rendering for 2D confusing, you probably wouldn't really know what to do with the performance and power if you could use it.

SpongeBob SquarePants
Member #2,126
March 2002

Quote:

Quote:
--------------------------------------------------------------------------------
They suprise me, i would think a library designed to 2D would atleast be able to compete with one meant for 3D.
--------------------------------------------------------------------------------

Why? Especially since 2D operations are only a special case of 3D

If you can't fiquare out why by what i originaly posted then im not sure why im even replying to you I'm dumb!... see the part where it says "library designed to (do) 2d" ? then the next part about the other designed to do 3d? Well ud think the one designed to do 2d would do do it faster or atleast in some way better then the one meant for 3d. wouldnt ya? I dont care what kinda 'special case' it is

Quote:

Quote:
--------------------------------------------------------------------------------
I think he meant set_gfx_mode(GFX_OPENGL,...).
--------------------------------------------------------------------------------

Isn't that what AllegroGL gives you, for all intents and purposes?

No. GFX_OPENGL would mean you could use all the original allegro functions have them use openglas a driver. This would be better for several reasons,biggest being to stick with the api we know, second biggest being not everyone would want to use 3d.

Quote:

Quote:
--------------------------------------------------------------------------------
even if they were you would still be limited by allegros current API(strecthing/coloring/blending can't be handled in a single blit).
--------------------------------------------------------------------------------

Unless, of course, you change OpenGL state behind AllegroGL's back.

Ya that would be frigging great if only i knew opengl, but if that were the case why in hell would i use allegro,especially after seeing this?

Quote:

Quote:
--------------------------------------------------------------------------------
And OpenGL by itself is very confusing and long winded.
--------------------------------------------------------------------------------

If you find OpenGL rendering for 2D confusing, you probably wouldn't really know what to do with the performance and power if you could use it.

Gee maybe i would use alphablending at a speed that wouldnt completely cripple my frame rate, that would be dope.

Quote:

I have an (Allegro+)OpenGL tile engine which runs at 1300fps average.

What video card/color depth/tile size/draw area?

Inphernic
Member #1,111
March 2001

Quote:

Ya that would be frigging great if only i knew opengl, but if that were the case why in hell would i use allegro,especially after seeing this?

Just for your information, Allegro isn't about graphical output only.

Quote:

What video card/color depth/tile size/draw area?

Geforce 2 Ti (it has been a while since I last messed around with it), 16, 32x32, 640x480.

Bob
Free Market Evangelist
September 2000
avatar

Quote:

No. GFX_OPENGL would mean you could use all the original allegro functions have them use openglas a driver.

This is exactly what AllegroGL does! Sure, it only supports 90% of the calls or so (we're working on the other ones), but that's the intent.

Quote:

see the part where it says "library designed to (do) 2d" ? then the next part about the other designed to do 3d? Well ud think the one designed to do 2d would do do it faster or atleast in some way better then the one meant for 3d. wouldnt ya? I dont care what kinda 'special case' it is

But why? You're not giving any reasons. In fact, on some hardware, using a 3D API will allow for faster rendering than using a 2D API, even if both are basically doing 2D operations. What do you think IHV will optimize for?

Quote:

but if that were the case why in hell would i use allegro,especially after seeing this?

No one is forcing you to use Allegro. If you think you've found better, then by all means, go for it!

Quote:

Gee maybe i would use alphablending at a speed that wouldnt completely cripple my frame rate, that would be dope.

Yes, blending in Allegro is slow; that we all know. FBlend can help some, but in no way can it compete with dedicated hardware.

--
- Bob
[ -- All my signature links are 404 -- ]

amarillion
Member #940
January 2001
avatar

Burnt One: to be fair, you should do the same test with allegroGL.

Of course you may choose any graphics lib you like, but your reason seems to be: Irrlicht works with opengl and allegro doesn't - which isn't true.

nonnus29
Member #2,606
August 2002
avatar

Quote:

This is exactly what AllegroGL does! Sure, it only supports 90% of the calls or so (we're working on the other ones), but that's the intent.

I didn't know the intention was to do exactly that... sorry for being dense, but i've read alot of the allegro5 (non mailing list stuff) and I don't recall the allegrogl/OPENGL_GFX connection.

Allegro will be well positioned for the future if/when you guys can pull this off! (hmm, and can we assume the Allegrogl blitting functions well be the Allegro5 functions? edit meaning the prototypes)

Bob
Free Market Evangelist
September 2000
avatar

Quote:

(hmm, and can we assume the Allegrogl blitting functions well be the Allegro5 functions? edit meaning the prototypes)

Yes, it's very likely that it wil happen this way.

--
- Bob
[ -- All my signature links are 404 -- ]

Marcello
Member #1,860
January 2002
avatar

Try running those tests on a computer without a 3d graphics card... I'm sure the results will be different, possibly in allegro's favor?

Marcello

SpongeBob SquarePants
Member #2,126
March 2002

Marcello, Burnt already said that.

nonnus29
Member #2,606
August 2002
avatar

Quote:

Yes, it's very likely that it wil happen this way.

That is really awesome; you guys will need a kick-ass 2d demo to show that off; like shooter with a bazillion sprites and blending and lighting all kinds of cool stuff - Somebody tell Sirroco to switch to allegrogl!

fiammy
Member #1,019
February 2001
avatar

Just a question. Is AllegroGL still actively developed? I can't see much updates on the site, except that the page has been altered recently. However, it's still the 0.1.4 version on the site.

 1   2 


Go to: