Recent

Author Topic: Deep Platformer — looking for people for cross-platform testing  (Read 9335 times)

sstvmaster

  • Full Member
  • ***
  • Posts: 125
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #15 on: April 04, 2019, 08:43:52 pm »
@furious programming

look at BGRABitmap, there Scanline should work for Win, Linux and Mac?

http://wiki.lazarus.freepascal.org/Fast_direct_pixel_access
Lazarus 2.0.4 x32
Lazarus 2.1.0 Trunk x32
OS Win 7 32bit

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #16 on: April 04, 2019, 08:49:20 pm »
Standard TBitmap.ScanLine is not Windows-specific, so it should work on different platforms. Am I right?

The declaration of the TFastBitmapPixelComponents looks like this:

Code: Pascal  [Select]
  1. TFastBitmapPixelComponents = packed record
  2.   Blue: Byte;
  3.   Green: Byte;
  4.   Red: Byte;
  5.   Alpha: Byte;
  6. end;

I am using my own record type to represent the single pixel:

Code: Pascal  [Select]
  1. type
  2.   TBitmapPixel = record
  3.     B, G, R {$IFNDEF WINDOWS}, A {$ENDIF}: UInt8;
  4.   end;

Is the same with this difference, that under Windows the Alpha channel is not used. Under Windows this channel must not exists in the record, and the record must occupy exactly 3 bytes (and so it is), because I use the following array type to iterate over pixels:

Code: Pascal  [Select]
  1. type
  2.   PBitmapLine = ^TBitmapLine;
  3.   TBitmapLine = array [UInt16] of TBitmapPixel;

Earlier, I used the packed keyword for both record and array, but under Windows and with the default data align settings, there is no difference, so I decided to remove these keywords.

ScanLine usage example:

Code: Pascal  [Select]
  1. procedure TPainter.DimBuffer(ABuffer: TBitmapBuffer; ADimLevel: UInt8);
  2. var
  3.   Line: PBitmapLine;
  4.   LineIndex, PixelIndex: Integer;
  5. begin
  6.   ABuffer.BeginUpdate();
  7.   ADimLevel := 255 - ADimLevel;
  8.  
  9.   for LineIndex := 0 to ABuffer.Height - 1 do
  10.   begin
  11.     Line := ABuffer.ScanLine[LineIndex];
  12.  
  13.     for PixelIndex := 0 to ABuffer.Width - 1 do
  14.       with Line^[PixelIndex] do
  15.       begin
  16.         B := B * ADimLevel shr 8;
  17.         G := G * ADimLevel shr 8;
  18.         R := R * ADimLevel shr 8;
  19.       end;
  20.   end;
  21.  
  22.   ABuffer.EndUpdate();
  23. end;

Under different versions of Windows, the game works perfectly. Under Linux there is a problem with ScanLine and I do not know how to fix it, that's why I created this thread and I am asking for help. 8)
« Last Edit: April 04, 2019, 11:37:42 pm by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #17 on: April 04, 2019, 09:21:06 pm »
Only differ processor. i386, x86-64, ARM, PPC. all PC. PC = Personal Computer. Not alone windows or i386 :)

I did not mean such personal computers, but ok — if you want to test, go ahead. 8)
I bad english. You make me more complicate when say Raspberry/Linux not peecee  :P

Quote
Quote
Is ok if not want know but i think error bad. memory error.
Yep, memory leaks are a problem, but there are no leaks under Windows. All objects are properly released when they are no longer needed. I do not know why this is happening, I do not know Raspberry Pi, so I can only advise you to check the game under the debugger and find out where the problem is.
I not know if problem game or problem Lazarus/FPC.

I ask before if game have debug option for compile. I see not special care debug so i make me write.

Error write:
Quote
Marked memory at $75638640 invalid
Wrong signature $B209FCFE instead of 891743FD
  $00052508
  $000525CC
  $00195644
  $001955B8
  $000406F0
  $00196840
  $00198CD4
  $000406F0
  $003D4704 line 1012 of Platformer.Renderers.pp
  $003D7118 line 1518 of Platformer.Renderers.pp
  $003D72EC line 1546 of Platformer.Renderers.pp
  $003CADC8 line 641 of Platformer.Scenes.pp
  $003CA3C8 line 470 of Platformer.Scenes.pp
  $00076DD8 line 397 of Platformer.Game.pp
  $0007811C line 614 of Platformer.Game.pp
  $00075EF0 [TGtk2WidgetSet.Destroy] WARNING: There are 3 unreleased DCs, a detailed dump follows:
[TGtk2WidgetSet.Destroy]  DCs:   7571F3E0 7571F060 7571F220
[TGtk2WidgetSet.Destroy] WARNING: There are 10 unreleased GDIObjects, a detailed dump follows:
[TGtk2WidgetSeline 80 of Platformer.Window.pp
  $00060578
  $0005F6AC
Heap dump by heaptrc unit
Heap dump ok if object not free. You not free object if exception. That ok. Not write exception handler can be if write good code.

Error write "Marked memory at $75638640 invalid". That bad. I read  thread https://forum.lazarus.freepascal.org/index.php/topic,16917.msg92681.html#msg9268 and write:

Quote
t seems you are using heaptrc. That is the error you get when doing a freemem with a pointer that was not obtained with getmem.

Perhaps one of the functions used in line 122 is not thread safe. For debugging purposes, put the whole block inside the critical section.

and
Quote
Yes I'm using HeapTrace from the compiler option. I removed that option and that exception disappeared.

now important:
Quote
Yes the exception has disappeared. But the error is still there.

Heaptrace simply increases the chance of catching the error. Without it you will have random other crashes.

Wrong signature $AAAAAAAA instead of 02202B3D

Most likely means that you accessed (written to ) memory that you already freed before.

Such memory will eventually be used for other objects, and then writing random data into it, will mean disaster.

This can be caused by missing thread synchronization. but it can also be happen without threads.

And unfortunately, it is one of the hardest to debug issues that there are....

read more thread if want.

I try look if error is game or error is Freepascal or Lazarus. If work Windows then think error is Freepascal or Lazarus ?

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #18 on: April 04, 2019, 09:47:53 pm »
I ask before if game have debug option for compile. I see not special care debug so i make me write.

I do not know what kind of debug you expect.

The sources that I've added to the attachments have a debug build mode set, which includes uses the HeapTrc unit to get information about whether memory leaks exist or not after closing the game. And there are no leaks under Windows (see attachment).

If you want, you can use Release build mode or go to the Project Options window and uncheck the -gh option.

Quote
read more thread if want.

This thread will not help me at all, because the problems described in it do not apply to my code. In my game, all objects are properly released. The problems exists somewhere else.

I have been using the HeapTrc unit since the very beginning, so if at any moment I would forget to release something, I would find out about it right away and fix it. I never had a problem with cleaning up the memory, especially in single-threaded applications (that this game is).

Quote
If work Windows then think error is Freepascal or Lazarus ?

I do not know — I have only various Windows systems for testing, and under Windows all is perfect.
« Last Edit: April 04, 2019, 10:08:18 pm by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #19 on: April 04, 2019, 10:06:10 pm »
This thread will not help me at all, because the problems described in it do not apply to my code. In my game, all objects are properly released. The problems exists somewhere else.

I have been using the HeapTrc unit since the very beginning, so if at any moment I would forget to release s
I think you not see. If exception then objects not release in code game. Code game not have exception handling.

Quote
I do not know — I have only various Windows systems for testing, and under Windows all is perfect.
Link thread write can run perfect and no error. but error hide so you not see. That was why thread and read what mean "marked memory"-error.

I fix error marked memory. change type pixel 3 packed UInt8. That make new error. Graphic not fit width window game. 1/4 window game to right clear.

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #20 on: April 04, 2019, 10:17:37 pm »
Code game not have exception handling.

Mostly, yes. The game must work, not throw exceptions. In the event of any exception (for example, if any file is missing), it must be terminated.

But I am testing the game in the debug build mode and I run it using IDE under debugger, so if any exception exists, I will find out about it because a window with an error will be displayed. But under Windows everything works as it should, no error window appears, so no exceptions are raised.

Quote
I fix error marked memory. change type pixel 3 packed UInt8.

Do not do this — only Windows uses 3-byte wide pixels. Unixes uses four channels.

Quote
That make new error. Graphic not fit width window game. 1/4 window game to right clear.

Yes, I know that. That's why I need help.
« Last Edit: April 04, 2019, 10:28:50 pm by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #21 on: April 05, 2019, 12:06:49 am »
Ok, I have tested the project with the following options turned off:
  • -gh — use HeapTrc unit (check for mem-leaks),
  • -gt — trash variables.
and all is good under Windows.

Maybe the 4-bit bitmap files (with RLE compression) are not fully supported under Unixes or the bitmap pixel components occupy more than one byte per channel?
« Last Edit: April 05, 2019, 12:08:42 am by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #22 on: April 05, 2019, 02:40:58 am »
Maybe the 4-bit bitmap files (with RLE compression) are not fully supported under Unixes or the bitmap pixel components occupy more than one byte per channel?

Buffers.Master:
Code: [Select]
pixelformat=6

Bitmap.Description
Format=ricfRGBA
HasPalette->False
HasMask->False
Depth=24
Width=224
Height=128
BitOrder=riboBitsInOrder
ByteOrder=riboLSBFirst
LineOrder=riloTopToBottom
LineEnd=rileDWordBoundary
BitsPerPixel=32
BytesPerLine->896
RedPrec=8 RedShift=16
GreenPrec=8 GreenShift=8
BluePrec=8 BlueShift=0
AlphaPrec=0 AlphaShift=0

~~~mask~~~
MaskBitsPerPixel=1
MaskShift=0
MaskLineEnd=rileByteBoundary
MaskBitOrder=riboBitsInOrder
MaskBytesPerLine->28

~~~palette~~~
PaletteColorCount=0
PaletteBitsPerIndex=0
PaletteShift=0
PaletteLineEnd=rileTight
PaletteBitOrder=riboBitsInOrder
PaletteByteOrder=riboLSBFirst
PaletteBytesPerLine->0
you right = 32 bit pixel  :)

Add:

Sprites:
Code: [Select]
Sprite "sprites/hero/regular/normal.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=14 Height=16 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->44 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
Sprite "sprites/hero/regular/wink.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=14 Height=16 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->44 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
Sprite "sprites/hero/regular/blind.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=14 Height=16 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->44 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=

Sprite "sprites/hero/special/normal.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=14 Height=16 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->44 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
Sprite "sprites/hero/special/wink.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=14 Height=16 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->44 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
Sprite "sprites/hero/special/blind.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=14 Height=16 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->44 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=

Sprite "sprites/firefly/regular/normal.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=8 Height=8 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->24 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
Sprite "sprites/firefly/regular/flash.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=8 Height=8 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->24 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
Sprite "sprites/firefly/regular/bulb.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=8 Height=8 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->24 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=

Sprite "sprites/firefly/special/normal.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=10 Height=10 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->32 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
Sprite "sprites/firefly/special/flash.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=10 Height=10 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->32 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
Sprite "sprites/firefly/special/bulb.sprite"
Sprite.Description  Format=ricfRGBA HasPalette->False HasMask->False Depth=24 Width=10 Height=10 BitOrder=riboBitsInOrder ByteOrder=riboLSBFirst LineOrder=riloTopToBottom LineEnd=rileDWordBoundary BitsPerPixel=24 BytesPerLine->32 RedPrec=8 RedShift=16 GreenPrec=8 GreenShift=8 BluePrec=8 BlueShift=0 AlphaPrec=0 AlphaShift=0 ~~~mask~~~ MaskBitsPerPixel=1 MaskShift=0 MaskLineEnd=rileWordBoundary MaskBitOrder=riboBitsInOrder MaskBytesPerLine->2 ~~~palette~~~ PaletteColorCount=0 PaletteBitsPerIndex=0 PaletteShift=0 PaletteLineEnd=rileTight PaletteBitOrder=riboBitsInOrder PaletteByteOrder=riboLSBFirst PaletteBytesPerLine->0=
« Last Edit: April 05, 2019, 03:15:10 am by Thausand »

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #23 on: April 05, 2019, 03:50:35 am »
@Thausand: thank you for confirmation.

So, what is the problem if it is not the size of the pixel? Damn...
« Last Edit: April 05, 2019, 04:45:17 am by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #24 on: April 05, 2019, 07:30:55 am »
@Thausand: thank you for confirmation.
you no thank me. i more confirmation.

Quote
So, what is the problem if it is not the size of the pixel? Damn...
I have test:
Code: Pascal  [Select]
  1. unit main;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     procedure FormCreate(Sender: TObject);
  16.     procedure FormDestroy(Sender: TObject);
  17.     procedure FormPaint(Sender: TObject);
  18.   private
  19.     procedure LoadPlace(aPlace: String);
  20.   public
  21.     view : TBitmap;
  22.   end;
  23.  
  24. var
  25.   Form1: TForm1;
  26.  
  27. implementation
  28.  
  29. {$R *.lfm}
  30.  
  31. uses
  32.   FileUtil;
  33.  
  34. { TForm1 }
  35.  
  36.  
  37. procedure TForm1.FormCreate(Sender: TObject);
  38. begin
  39.   view := TBitmap.Create;
  40.   view.SetSize(300, 150);
  41.   LoadPlace('$HOME/projects/deep/');  // need change you computer if test
  42. end;
  43.  
  44. procedure TForm1.FormDestroy(Sender: TObject);
  45. begin
  46.   view.Free;
  47. end;
  48.  
  49. procedure TForm1.FormPaint(Sender: TObject);
  50. begin
  51.   Self.Canvas.StretchDraw(Self.ClientRect, view);
  52. end;
  53.  
  54. procedure TForm1.LoadPlace(aPlace: String);
  55. var
  56.   list: TStringList;
  57.   item: string;
  58.   sprite: TBitmap;
  59.   drawrect: TRect;
  60.   n: integer = 0;
  61. begin
  62.   drawrect:= TRect.Create(5,5,6,6);
  63.   list:= TStringList.Create;
  64.   FindAllFiles(List, aPlace, '*.sprite');
  65.  
  66.   for item in list do
  67.   begin
  68.     inc(n);
  69.     sprite:= TBitmap.Create;
  70.     sprite.LoadFromFile(item);
  71.     view.Canvas.Draw(drawrect.Right, drawrect.Top, sprite);
  72.  
  73.     drawrect.Right:= drawrect.Right + sprite.Width + 2 ;
  74.     if sprite.Height > drawrect.Height then drawrect.Height := sprite.Height + 2;
  75.  
  76.     sprite.Free;
  77.   end;
  78.  
  79.   list.Free;
  80.   Self.Text:= Format('LoadPlace %d *.sprite', [n]);
  81. end;
  82.  
  83. end.
  84.  
In simple is same method in use game ?

i see picture attach. RLE can see work. I think error not bitmap.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 917
    • Burdjia
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #25 on: April 05, 2019, 11:06:05 am »
@Ñuño_Martínez: can you confirm or deny the existence of memory leaks under Xubuntu?
It loads without errors.  It compiles (same hints and warnings).

When running, it starts with glitched graphics (see attached screenshot) then freezes after the "presents" text disappears.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #26 on: April 05, 2019, 11:17:53 am »
When running, it starts with glitched graphics (see attached screenshot) then freezes after the "presents" text disappears.
I same error. If compile heaptrace and start terminal then maybe see error

Quote
Marked memory at $75638640 invalid
Wrong signature $B209FCFE instead of 891743FD
... and many more error not release memory.

Thanks you for write get same error

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #27 on: April 05, 2019, 04:56:48 pm »
It loads without errors.  It compiles (same hints and warnings).

Hints and warnings will remain because they can not be avoided. I just hid them myself.

Quote
When running, it starts with glitched graphics (see attached screenshot) then freezes after the "presents" text disappears.

Yes, I know this problem. Earlier, we tried to fix it with @Handoko, but it failed — either the frame was too narrow (when the pixel was 24-bit wide) or the game was hanging on just after the intro (when the pixel was 32-bit wide).

Maybe 28-bit wide pixel will work. 8)

I have test:
[…]
In simple is same method in use game ?

Yes and no.

The hero is painted using TCanvas.StretchDraw, because his body lengthens during falling and the sprite must be painted with stretch.

The level layers (except for the nearest black one) are painted using TCanvas.CopyRect, because only the fragment visible on the screen must be copied and stretch (scaling) must be supported.

All other graphics, such as firefly sprites, text characters, pictures in animations, etc., are painted using the TPainter.CopyBuffer method. This method works similarly to TCanvas.Draw, i.e. it simply copies one bitmap to another without scaling, except that it omits pixels in the color of clFuchsia. And it also supports copying only the part of the image that fits in the target bitmap (it does not try to modify the data outside the target bitmap area).

All level layers are rendered in a few steps, using the secondary buffer:
  • defining the area visible on the screen,
  • copying the fragment of the layer to the Buffers.Slave bitmap with or without scaling,
  • painting the Buffers.Slave bitmap for a given color (only pixels in color other than clFuchsia)
  • painting a layer from a Buffers.Slave bitmap on a Buffers.Master bitmap (omitting clFuchsia pixels).
ScanLine is always used when rendering level layers, more specifically when copying the Buffers.Slave bitmap on the Buffers.Master bitmap and when copying (without scaling and re-painting) the nearest layer (black one) on the Buffers.Master bitmap. So it must work correctly.


I will prepare a simple window application to test ScanLine and bitmaps that are used by the game, so that you can test copying images without having to debug the game. I will let you know when it will be ready.
« Last Edit: April 05, 2019, 05:16:53 pm by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #28 on: April 05, 2019, 09:04:35 pm »
Many thanks for many explain furious programming. I not know you game engine and now learn (but go slow  :-[ )

I not have many time create test now. I not all understand you wrote in post and now see in source what some mean so i better understand.

Game engine not difficult programming but difficult have many structure and inheritance :)

Quote
Maybe 28-bit wide pixel will work. 8)
;D

Quote
I will prepare a simple window application to test ScanLine and bitmaps that are used by the game, so that you can test copying images without having to debug the game. I will let you know when it will be ready.
If write then i test for you and report. If take time maybe i have write test self before.

Crash strange. Debugger not catch so i test simple text write and see were is game engine run.

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #29 on: April 05, 2019, 09:54:56 pm »
@Thausand: thank you for the tests, I am grateful for help.

Game engine not difficult programming but difficult have many structure and inheritance :)

This game does not have a typical engine. It simply calls different methods in a specific order, all of which are related to its proper operation are found in the Platformer.Scenes.pp module.

But due to the fact that this game is a standard, single-threaded window application, it is very easy to debug. You can easily use breakpoints and follow step by step instructions.

However, it contains a lot of classes (using inheritance, especially classes for scenes) that can not be understood in 15 minutes. That is probably why few people want to test this project (it's just too big). However, if someone does not understand something, please ask me, I will answer every question in as much detail as I can.

Quote
If write then i test for you and report. If take time maybe i have write test self before.

You do not have to, I've just finished the test window application. I've transferred only the code responsible for rendering to it, so it's not much and it will be much easier to debug it.
« Last Edit: April 05, 2019, 10:00:06 pm by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)