Recent

Author Topic: Legacy D2007 project on Lazarus ?  (Read 3748 times)

Zath

  • Sr. Member
  • ****
  • Posts: 391
Legacy D2007 project on Lazarus ?
« on: January 29, 2016, 06:16:59 pm »
I have files of a 2D mmo style game where you move your character around a 2D landscape that scrolls as you move and have monsters to kill, items to buy etc.
The entire game is written in Delphi and I currently use D2007 to compile it.

The graphics comprise of thousands of bitmap images as tiles layered to make maps and any image you see in game. The images are stored in indexed library files read at startup and drawn as required if you enter a map etc.

There is lots of use of timers and DXDraw etc.

I realise there are some specialist components required that won't (probably) exist for Lazarus but, aside from those, is Lazarus up to the task of handling mass multiple calls to draw bitmap images for maps and other graphics on the fly and cope with a theoretical large number of concurrent players at the same map position ?
Buying XE10 Seattle is  beyond my means and D2007 is a bit long in the tooth.
I like Lazarus and its clean feel and layout so would like to attempt porting it across.
All that said, is it better to stick with a legacy prog like D2007 and remove the hassle of porting the files across.

I'm not sure if this is the right section so apolgies if not. I saw bitmap so I jumped !

Thanks for any guidance opinion or otherwise.

circular

  • Hero Member
  • *****
  • Posts: 4467
    • Personal webpage
Re: Legacy D2007 project on Lazarus ?
« Reply #1 on: January 29, 2016, 09:21:32 pm »
I would say that if you would like your code to be portable, so compiled on different platforms, and at the same time have a high FPS, the best option would be OpenGL.

There are various libraries that provide OpenGL support. This forum is about BGRABitmap library, that has some support for OpenGL in its latest version.

Here I made a demo based on it:
http://forum.lazarus.freepascal.org/index.php/topic,29038.msg184328.html#msg184328

There are also other libraries that provide support for OpenGL like ZenGL library.

Otherwise, the headers for DirectX have been ported as far as I can see, so in theory you could use them:
http://forum.lazarus.freepascal.org/index.php?topic=1213.0
Conscience is the debugger of the mind

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Legacy D2007 project on Lazarus ?
« Reply #2 on: January 29, 2016, 09:33:29 pm »
As Circular said you probably need OpenGL and yes it can be hard to use but not with BGRABitmap. It is very easy to use and if you dont want or need OpenGL (Taht its not make a difference to a simple bitmap with BGRA because it's structure anyway) use simple BGRABitmap,it is fast and full of useful things.
Just get it and test and if you got questions, ask here.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: Legacy D2007 project on Lazarus ?
« Reply #3 on: January 29, 2016, 10:15:37 pm »
If you draw via directdraw, it sounds that Lazarus won't be the bottleneck.

The bitmap type is more limited (no scanline[]), but there are workarounds for that.

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: Legacy D2007 project on Lazarus ?
« Reply #4 on: January 30, 2016, 01:51:11 am »
Thanks for the input.
Yes marcov, it does use directdraw.

Circular, I wanted to try your demo but it asks for BGrabbitmapPack4LCL_OpenGL.
I have searched for this and looked into the src of the lazpaint section which has many versions but not the required pack.
Can you point me in the right direction please ?

circular

  • Hero Member
  • *****
  • Posts: 4467
    • Personal webpage
Re: Legacy D2007 project on Lazarus ?
« Reply #5 on: January 30, 2016, 05:41:27 am »
Hello Zath,

Package BgraBitmapPack4LCL_OpenGL is in latest BGRABitmap archive (bgrabitmap8.7.zip).
https://sourceforge.net/projects/lazpaint/files/src/
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018