Recent

Author Topic: Allegro.pas  (Read 33512 times)

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Allegro.pas
« on: May 10, 2016, 08:55:20 pm »
Allegro.pas is a wrapper that allows to use the Allegro Game Library with Pascal.

Allegro.pas 5.2.alpha released!  8)

Yep, about 3 years after 5.0.alpha, a new release of branch 5 (now TRUNK) was released today.  It has a lot of improvements, and should be slightly more stable than previous alpha.  But it is still an alpha.  :-[ Anyway, if you want to test it, download from here.

I'll use it in the comming TINS 2016, and I plan to use my entry as demonstration game for the library.

Note:  I'll do release announcementes in this thread from now, instead of create a new thread every version.
« Last Edit: May 12, 2016, 12:50:40 pm by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Allegro.pas 5.2.alpha-2
« Reply #1 on: June 26, 2016, 08:15:25 pm »
There are a lot of work to be done yet, but I did several big improvements so I've just uploaded a new release.

In short:  There are several bugfixing, including (but not limited to) the primitives add-on that didn't work in previous versions.  There are new functionality too, as 3D transformations and custom memory management.  Also I added new examples and updated some other that shows how to use basic and advanced stuff to supply the lack of documentation.

You can download it from here.

Any comment and suggestion will be welcome.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

johnsson

  • New Member
  • *
  • Posts: 22
  • Lazarus Rocks
Re: Allegro.pas
« Reply #2 on: June 26, 2016, 09:24:13 pm »
Excellent work.
Just a regular guy

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Allegro.pas
« Reply #3 on: June 27, 2016, 01:41:49 pm »
Thanks. :)

Now I'm wondering what would be a good demonstration game to be added.  :-\
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Allegro.pas
« Reply #4 on: June 27, 2016, 06:45:50 pm »
Thanks. :)

Now I'm wondering what would be a good demonstration game to be added.  :-\
Something achievable in a relatively short code. People tend to learn from examples these days, and I think providing a tutorial is also much harder than providing ready to run examples. The first 3 starter examples could be:
  • tic-tac-toe or 15 puzzle (2d, no animation, no collision detection)
  • arkanoid (2d, simple linear animation, simple collision detection by position checking)
  • simplified 1945 / raiden (2d, a bit complex animation, bounding square/circle/triangle collision detection)

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Allegro.pas
« Reply #5 on: June 29, 2016, 01:40:37 pm »
Something achievable in a relatively short code. People tend to learn from examples these days, and I think providing a tutorial is also much harder than providing ready to run examples. The first 3 starter examples could be:
  • tic-tac-toe or 15 puzzle (2d, no animation, no collision detection)
  • arkanoid (2d, simple linear animation, simple collision detection by position checking)
  • simplified 1945 / raiden (2d, a bit complex animation, bounding square/circle/triangle collision detection)
Not bad. I like it. Thanks.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Allegro.pas 4.4.5-1
« Reply #6 on: July 20, 2016, 01:43:35 pm »
Some days ago somebody found that unit alWin didn't compile.  Since I never used it, I didn't tested.

Anyway it is now fixed. I've also upgraded documentation adding a search engine.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Allegro.pas
« Reply #7 on: July 20, 2016, 04:01:15 pm »
I will suggest Tetris to replace Tic Tac Toe. I personally think Tic Tac Toe is boring, Tetris is challenging. But Tic Tac Toe as demo game has it own value, that is to demonstrate simple AI.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Allegro.pas
« Reply #8 on: July 21, 2016, 11:44:44 am »
Agree.  I think I'll do a Tetris-like delphi (I like Puyo-puyo :)) and a shooter.  One of them with 3D graphics even if they are 2D games.  That will show and teach a lot.
« Last Edit: July 21, 2016, 11:46:17 am by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Allegro.pas
« Reply #9 on: July 06, 2017, 11:16:48 am »
Oh my oh my!  More than one year since the last release (5.2.alpha2).

But that's not the worst part, no it isn't.  The worst part is that I did a ton of improvements.  Mostly documentation but also:
  • Low-level file access, quite useful to add new loaders and file formats to the library and essential to create fully integrated add-ons.
  • Shaders for both OpenGL and DirectX.
  • Configuration files.  It does the same than TIniFile but Allegro uses its own ini file support internally so it may be the best way to integrate add-ons and to define default configuration to different subsystems.
  • A collection of new examples (including the one that shows how to fake 8bpp graphics mode!) and some bugfixes, as well as better Microsoft Windows integration.
If you're wondering why I didn't release 5.2.alpha3 yet the answer is simple:  I forgot it.  Last year I had a lot of personal and laboral issues that affected my memory.  Really.  I'll release it this evening or tomorrow.  I'll not do it now because I'm busy (I really am ::) ) and because I've found a flaw in the SVN tree I must fix too (There isn't 5.2.alpha in the RELEASE directory!).
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Allegro.pas 5.2.a3
« Reply #10 on: July 06, 2017, 09:35:43 pm »
Ok: I just uploaded the new 5.2.a3 release.  Please enjoy.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

timofonic

  • Newbie
  • Posts: 4
Re: Allegro.pas
« Reply #11 on: July 18, 2017, 03:15:17 am »
Just a question:

Why using Allegro instead of SDL2? What are the reasons behind it?

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Allegro.pas
« Reply #12 on: July 18, 2017, 07:31:52 am »
Hello timofonic,
Welcome to the forum.

If you google the web you will find no winner, none of them has its own killer feature. Both of them are good libraries for game creation, and finding tutorials are very easy.

I've just started to learn Allegro some months ago. I found Allegro is very easy to start with. SDL API documentation is good, but Allegro is better. Allegro API pages offer more info, including see also and examples.

You can compare load bitmap documentation of SDL:
http://wiki.libsdl.org/SDL_LoadBMP?highlight=%28\bCategorySurface\b%29

With this:
https://www.allegro.cc/manual/5/al_load_bitmap

Furious Paladin is my first test project using Allegro:
http://forum.lazarus.freepascal.org/index.php/topic,35313.msg252085.html#msg252085

It had some minor issues, my problem not allegro's problem. It didn't run on same speed on different machines, solved easily. Later I found on Windows it didn't detect shift keys the same way on Linux. I modified the code to use ctrl keys instead of shift keys.

The demo was created using 500 x 300 pixels resolution. It is not good for large screen users. As recommended by some users here, I tried to make it better supports on large screen. I never thought it was so easy to make it double size if it detects running on large screen. Just added the code below then the program will display double sized without changing anything of the code.

Code: Pascal  [Select][+][-]
  1. const
  2.   ScreenWidth  = 500;
  3.   ScreenHeight = 300;
  4.  
  5. var
  6.   Display:     ALLEGRO_DISPLAYptr;
  7.   MonitorInfo: ALLEGRO_MONITOR_INFO;
  8.   Transform:   ALLEGRO_TRANSFORM;
  9.  
  10.   // Prepare display
  11.   al_get_monitor_info(0, MonitorInfo);
  12.   if (MonitorInfo.x2 > 1060) and (MonitorInfo.y2 > 610) then begin
  13.     Display := al_create_display(ScreenWidth*2, ScreenHeight*2);
  14.     al_identity_transform(Transform);
  15.     al_rotate_transform(Transform, 0);
  16.     al_scale_transform(Transform, 2, 2);
  17.     al_use_transform(Transform);
  18.   end
  19.   else
  20.     al_create_display(ScreenWidth, ScreenHeight);

I have not tried SDL, I cannot say Allegro is better. But I can say Allegro is really easy to start with.
« Last Edit: July 18, 2017, 09:58:55 am by Handoko »

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Allegro.pas
« Reply #13 on: July 18, 2017, 10:03:56 am »
I think the main reasons to use Allegro instead of SDL are personal preferences.

Both libraries have support for (most) modern platforms.  Allegro is less popular than SDL, so there are less examples, tutorials and games (the awesome Factorio was made using Allegro) but me and others are working hard to change this.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Allegro.pas 5.2.b.0 released
« Reply #14 on: April 23, 2018, 08:54:10 pm »
[This is a copy of what I wrote for the news section of SourceForge.  I'm a bit lazy today.]

Almost a year after the last release I've published version 5.2.b.0.

This version doesn't fix a lot of bugs nor adds new functionality, but it is an important milestone (hence the change from alpha to beta) as to recover Delphi compatibility.

May be you know, Allegro.pas was Delphi compatible from the beginning.  It was quite complex because Allegro API needed to share variables with DLL, and Delphi wasn't capable of this.  To make it possible, I used an extra DLL file that returned the pointers to such variables.  That made things quite complex to maintain and hard to use so I decided to remove Delphi compatibility being the latest compatible version the 4.2.2 but I always promised the back to Delphi with version 5 as the new API is more easy to port.

Now Delphi compatibility has back.  Unfortunatelly I wasn't able to make it 100% compatible yet and a few examples don't work but they will.  Also it was tested with Delphi 10 Tokio Starter Edition only.  I've try to keep track of older versions (thanks to Gregor A. Cieslak for his help) but it may fail.  Please let me know.

Visit the Files section to download and test this new version.  I've updated the on-line documentation that you can download from the Files section too.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018