Lazarus

Programming => Graphics and Multimedia => Games => Topic started by: furious programming on April 03, 2019, 06:27:26 pm

Title: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 03, 2019, 06:27:26 pm
For some time I've been working on a simple 2D platform game called Deep Platformer.

In short, this project was initially a simple PoC, but over time it has grown. It is an attempt to create something meaningful without using special libraries to create games — only basic classes from LCL. Due to the fact that it is not a full-fledged game (because of accepted restrictions), I call it just a technological demonstration. The game does not require installation (it is completely portable) and does not save any data on the disk. I is completely free, sources are open, under the GPL3 license.

In the game, we move a small hero and cross the multilayered levels in search of fireflies to collect and looking for exit (simple requirements). The game consists of several worlds, each of them will contain several levels. In addition to the story itself, the game has an intro, menu, outro, staff screen and supports animations (intro, outro, in-level cutscenes etc.). The game also has a built-in cheat mode (that allows to test its functionality more easily and quickly) and many, many more.

More information about the game, gameplay, key mappings etc. can be found in the readme.txt file.


The game code is practically finished, however the content of the game is not ready yet. It was left to finish the levels and add the missing animations. That's what I'm doing right now. So please do not be surprised by the simplicity of the current levels — they will be much nicer, more complex and more interesting.

Code is object-oriented and written in such a way that most of it is not dependent on the platform. I would like very much to let the game be compiled on different platforms and work on them just as well as on Windows. I use Windows only, and I do not know other platforms enough to be able to properly port the code.

Currently, the game code is adapted for Windows and works properly on XP and higher. It also has patches for Unix systems on which the game starts and works, but the screen is not rendered correctly. Other problems may also exist, but I do not have such information.

That is why I am looking for people who would help me with the porting of the code. Of course, anyone who wants to, can download the source and test the game — on any platform, including Windows. I am interested in the following platforms:
So, I add to the attachments current game sources and binary files with game content (fonts, levels, animations, etc.). The project consists of 35 units, about 14,000 LoC. I know that it's a lot, so in the next post I will write about where is the code specific for platforms and where the code responsible for image processing is located, which on Linux is not working properly.

If you have any questions about the game or the source code, ask me boldly. I am here every day, so I will answer as much fast and as detailed as I can.

Everyone who requests it, I will add to the list above (for clarity). So far, there is no repository, so this thread must be enough. Of course, everyone who will help with this project will be placed in the staff screen.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Ñuño_Martínez on April 03, 2019, 06:55:27 pm
I can test it on Xubuntu 18.04 LTS 64bits.  8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 03, 2019, 07:21:24 pm
All images used in the game are 4-bit bitmaps, some additionally use RLE for compression. They were all prepared in the GIMP program. To store them in memory, the game uses the TBitmapBuffer class, which inherits from TBitmap, but does not extend it with additional functionalities.

The game uses back buffers in the form of TBitmapBuffer objects, on which the game frames are rendered. For rendering frames and bitmap processing, the TPainter class from the Platformer.Painter.pp unit is indirectly used.

Ultimately, the TCanvas.CopyRect method is used to copy parts of level layers, with the possibility of scaling and without antialiasing support; and TPainter.CopyBuffer to copy images without scaling (it is faster than TCanvas.Draw). All custom bitmap processing methods use ScanLine.

The TBitmapBuffer class is located in the Platformer.Types.pp module, as well as the record specifying a single pixel and their array (these types are used in conjunction with ScanLine).

So, that's all when it comes to bitmaps.


The game should look like the attached screenshot, maintain 60fps and the load should not be greater than several dozen percent. On my 11-year-old computer with Windows XP 32-bit, it maintains about 50% (with the default window size, which is 672x384 pixels), much much less on the better computer with Windows 7 64-bit (with Code2Quad).

The game works like NES, so a load of more than 100% will result in a decrease in FPS, and at the same time in the flow of the animation (it's intended).


@Ñuño_Martínez: go ahead. 8-)

For the built-in cheat mode to be active from the very beginning, the game should be run with the cheat on parameters pair that are currently in the .lpi file (or in the Run Parameters window if you prefer). Other parameters that can be used are described in the readme.txt file.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: mischi on April 03, 2019, 07:24:37 pm
macOS here.

How about a source code repository with git, subversion or similar with releases, bug tracker and so on?

MiSchi
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 03, 2019, 07:36:11 pm
@mischi: I will use the repository only for the publication of the finished game, because I really hate Git (I know, it is silly), and I do not intend to develop this game further. If someone wants to develop it, he will be able to make a fork and do whatever he wants.

I am used to discussions on the forums, so it would be more convenient for me to discuss everything here.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: sstvmaster on April 03, 2019, 07:39:35 pm
Thanks, cool.

My System:
- Windows 7 32bit
- Pentium Dual-Core T4500 @ 2.30GHz
- 4 GB DDR2
- GPU GM45
- Samsung EVO 850

- CPU usage 50%
- 60 FPS

Compiled with Laz 2.0.0
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 03, 2019, 07:43:32 pm
@sstvmaster: super.

The game always uses the full power of one CPU core, due to the long frame rendering time (from a few to over a dozen milliseconds). For this reason, I could not use Sleep and save the CPU power. Works almost identically like NES. 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Ñuño_Martínez on April 04, 2019, 11:19:11 am
Loading the project on Lazarus 1.8 on Xubuntu 18.04.2 LTS gives next error:
Quote
Stream=TGameForm: Raíz=:TGameForm
Error reading TGameForm.DoubleBuffered: Unknown property: "DoubleBuffered"
Posición del stream: 4096
Anyway it compiles with a collection of warnings (Platformer.Painter.pp(xx,xx) Warning: Symbol "ScanLine" is not portable) and hints (Platformer.Window.pp(xx,zz) Hint: Parameter "XXXX" not used).

When running the compiled game, it just raises an exception: Unknown Property: "DoubleBuffered".

(...) I really hate Git (I know, it is silly) (...)
No, it isn't.  I also don't like Git nor GitHub, I prefer SourceForge (the new owners improved a lot the platform).  I don't understand the way Git(Hub) organizes the stuff, and don't know how to create a web page, where are the downloads, the bug tracker...
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: dsiders on April 04, 2019, 11:33:31 am
(...) I really hate Git (I know, it is silly) (...)
No, it isn't.  I also don't like Git nor GitHub, I prefer SourceForge (the new owners improved a lot the platform).  I don't understand the way Git(Hub) organizes the stuff, and don't know how to create a web page, where are the downloads, the bug tracker...

Thank you. Finally, someone else said this out loud. I always feel like an Idiot when I try to figure out Git. Glad it's not just me...
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 04, 2019, 03:35:46 pm
Loading the project on Lazarus 1.8 on Xubuntu 18.04.2 LTS gives next error:
Quote
Stream=TGameForm: Raíz=:TGameForm
Error reading TGameForm.DoubleBuffered: Unknown property: "DoubleBuffered"
Posición del stream: 4096

I'm developing this game in Lazarus 2.0.0 (under Windows), where the DoubleBuffered property is published and stored in the .lfm file (because I changed its value few times during testing). Earlier, this property was public. If you want to compile this game in older IDE with older LCL, you need to remove this property from .lfm file.

Quote
Warning: Symbol "ScanLine" is not portable

ScanLine is declared with platform modifier, so the compiler always generates warnings about it. Can I avoid it?

Quote
Hint: Parameter "XXXX" not used

All hints about unused parameters belongs to the events of the GameForm window. I don't use the event parameters (because I don't need to use parameters like Sender), so ignore these hints.

Quote
When running the compiled game, it just raises an exception: Unknown Property: "DoubleBuffered".

Just remove this property from the Platformer.Window.lfm file and recompile the project:

Code: Pascal  [Select]
  1. object GameForm: TGameForm
  2.   Cursor = crSizeAll
  3.   Left = 168
  4.   Height = 384
  5.   Top = 171
  6.   Width = 672
  7.   BorderIcons = []
  8.   BorderStyle = bsNone
  9.   Caption = 'Deep Platformer'
  10.   Color = clBlack
  11.   DoubleBuffered = True // remove this line
  12.   FormStyle = fsStayOnTop
  13.   Icon.Data = {
  14.     ..


Thank you. Finally, someone else said this out loud.

I'm a single developer, I'm working alone, so I don't need this kind of software. In my case, using any of subversion system is just a waste of time and energy.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 04, 2019, 04:22:38 pm
One more thing — in addition to the game itself, the project also consists of a set of five tools in form of simple console applications, used to generate bitmaps and binary files:
These tools will also need to be tested on other platforms, but first we have to test the code of the game itself. Each generator also has a readme.txt file with a description of how to use it.

Until then, I will write a simple window application (simple manager) that will make it easier to use these generators (so that we can click few times instead of typing long parameters in the console).
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 04, 2019, 05:06:09 pm
That is why I am looking for people who would help me with the porting of the code. Of course, anyone who wants to, can download the source and test the game — on any platform, including Windows. I am interested in the following platforms:
I not sure i help. i try game raspbian pi and get error. Graphic no good is ok but error no ok ?

You game have debug i make on ? Or have add my ?
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 04, 2019, 06:05:51 pm
@Thausand: the game code is not for Raspberry, I don't know if it should be, because I don't use this hardware. I am interested in platforms used on PC — I mentioned which ones. But still I don't understand what you're writing about. Try using a translator (e.g. from Google), instead of trying to write yourself. 8)

I know that many would like to play with this project, but it is not small and obvious. Therefore, I would prefer code-related corrections to be suggested by experienced programmers.


Update: I updated the attachments in the first post, adding sources with no problems with DoubleBuffered (I removed this property from the form file). I think it will be a good idea to keep the latest version of the code in the first post, so that you do not have to search the entire thread.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 04, 2019, 08:33:06 pm
@Thausand: the game code is not for Raspberry, I don't know if it should be, because I don't use this hardware. I am interested in platforms used on PC — I mentioned which ones.

write you:

Currently, the game code is adapted for Windows and works properly on XP and higher. It also has patches for Unix systems on which the game starts and works, but the screen is not rendered correctly. Other problems may also exist, but I do not have such information.

That is why I am looking for people who would help me with the porting of the code. Of course, anyone who wants to, can download the source and test the game — on any platform, including Windows. I am interested in the following platforms:
  • Windows
  • Linux
  • FreeBSD
  • macOS/OSX
Raspberry pi = pc = linux

Only differ processor. i386, x86-64, ARM, PPC. all PC. PC = Personal Computer. Not alone windows or i386 :)

Quote
But still I don't understand what you're writing about.
write you: "Other problems may also exist".

Then i say what problem have i and give log and you not want know ? Is ok if not want know but i think error bad. memory error.

Quote
Try using a translator (e.g. from Google), instead of trying to write yourself. 8)
Bing write:
That's all nice and nice to use a translator, but I don't learn anything about it, and at least it doesn't make me better to write English teaching.


I write:
Use translator not help write better English and not learn ever

You bing crazy !!!!! I not want teach, i want learn better write :D

I know i bad english. I sorry for that. I learn new word any day. Friend help me and write here help me. Write computer and pascal i know many word. If, then, for, next, procedure, inheritance. all english. Translator many confused use Pascal and computer word.   :'(
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 04, 2019, 08:43:43 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)

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.

@Ñuño_Martínez: can you confirm or deny the existence of memory leaks under Xubuntu?
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: sstvmaster 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
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming 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)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand 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 ?
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming 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.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand 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.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming 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.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 05, 2019, 12:06:49 am
Ok, I have tested the project with the following options turned off:
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?
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand 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=
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming 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...
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand 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.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Ñuño_Martínez 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.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand 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
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming 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:
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.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand 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.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming 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.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: kupferstecher on April 05, 2019, 10:03:13 pm
Before, I had trouble with drawing to a bitmap-canvas in a custom control. Under Windows everything seemed to be fine, but actually my code drew outside the canvas (E.g. with LineTo it happens very easily). No warnings, errors or anything. Under Linux though I got troubles, some bitmaps were aliased like in the screenshot posted by Ñuño_Martínez, under Linux/QT I got a lot of error messages on the command line and even sporadic crashes. In this behalf Windows was more robust, but hid the errors.

No idea if its a similar issue here, but could be.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 05, 2019, 10:30:33 pm
Under Windows, the bitmap processing is fabulously simple, I have absolutely no problems with it. But I do not know about Unix, so I do not even know what may be a problem...

I created a new thread — Proper way to use TBitmap.ScanLine on Unixes (http://forum.lazarus.freepascal.org/index.php/topic,44938.0.html) — and attached the test application. It will be easier to check the operation of several hundred lines of code than several thousand lines.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Ñuño_Martínez on April 06, 2019, 11:36:51 am
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 doubt it.  But I agree that's a problem with pixel format (both size and order).

Anyway, this is a good example of why to use game frameworks (http://wiki.freepascal.org/Game_framework) and game engines (http://wiki.freepascal.org/Game_Engine) instead of trying to do it with plain LCL.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 06, 2019, 03:10:52 pm
Anyway, this is a good example of why to use game frameworks (http://wiki.freepascal.org/Game_framework) and game engines (http://wiki.freepascal.org/Game_Engine) instead of trying to do it with plain LCL.

No, this is a good example of how to create a more complicated game without using anything to create standard games. No hardware acceleration, no engines and frameworks/API's, no additional libraries — only LCL. It's nothing but a challenge, proof of concept.

If I wanted to create a normal game, I certainly would not use LCL for this, but it was not. I wanted to check how much can be done without a specialized frameworks/engines. And much can be done, but it is needed to know how.

I have achieved 100% success, I implemented everything I wanted, the game works exactly as I wished. Under Windows, because originally only on this platform I cared (but on Linux, you can run this Windows compilation of this game via wine and it will work properly too).

But unfortunately, I came up with the idea to add support for Unix, without having any experience in creating software for this platform. That's why I asked for tests and help in improving the code so that it could be compiled on other platforms than Windows.


So, since we have already explained the reason for creating this project, let's get back to the nature of the problem, that is, to incorrectly rendering bitmaps.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 06, 2019, 03:17:49 pm
let's get back to the nature of the problem, that is, to incorrectly rendering bitmaps.

It should be possible to do it; I built some multi-platform image editing software (ported from an earlier Delphi one) that works rather well and IIRC it uses Scanline for quite a few things. Unfortunately I don't have the sources at hand :'(

OK, back to testing :)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 06, 2019, 04:08:30 pm
Yep, in my windowed application project (other than this game — screenshot with constrols preview (https://static.4programmers.net/uploads/attachment/5a/5aabfe796945f.png)) I also use ScanLine for bitmaps and PNG graphics to render different elements of visual components. Only that this application is not intended for Unixes, so I did not have the opportunity to learn about these problems.


Ok, back to the game. 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 09, 2019, 01:37:08 am
Ok, I have improved the project code.

First of all, I added a patch to the TBitmapBuffer class, which "converts" the 24-bit bitmaps loaded from files to 32-bit. Thanks to this, only 32-bit ones are used on Unixes, what is correct (on Windows nothing changed).

Secondly, I implemented my own method that copies the given area of the level layer to the frame buffer, working almost identically to TCanvas.CopyRect. This meant that the slave buffer was no longer needed, so it was completely removed. Now the game uses only one back buffer to render the frame.

Changing the rendering process of level layers has made the game run faster. Previously in my hardware, rendering the level with other elements (hero, fireflies and counters) took about 50% of the time allocated to one frame, and now it takes about 41%.

I have introduced a few cosmetic changes that do not affect the game's performance.

I checked the game carefully under the debugger — it does not throw any exceptions, and also does not have any memory leaks. Everything is in the right order (at least on Windows). 8)


So, I added current sources of the game to attachments. The project should be able to compile and run on Unixes, and there should be no problems with image rendering anymore. I am asking for its testing (on any platforms) and for feedback. Thank you very much for your help so far.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 09, 2019, 01:53:25 am
I like this game, tested on Windows 10,

here you can use my music if you want
https://soundcloud.com/leandrodiazoe

I think 'Musica 8' fits the game
https://soundcloud.com/leandrodiazoe/musica-8

Or ask @circular he has good tunes on youtube and sound cloud as well.
https://www.youtube.com/channel/UCqke7kPVGPMiuJzYoOknNBA
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 09, 2019, 05:01:19 pm
When I made the decision to develop this proof of concept from a simple parallax test to a simple game, I was also thinking about music and sounds. Due to the fact that it was supposed to be (and is) an NES-style game, I thought about creating music and sounds using the FamiTracker (http://famitracker.com/) editor.

However, the main assumption of this project is to create an interesting, more advanced game without the use of dedicated libraries or even any other packages than the LCL package. And here comes the problem, because without the use of additional libraries, it is not possible to play more than one sound at the same time. Under Windows, I can use PlaySound function to play the sound, there are probably functions for the same purpose on other platforms. But it is not possible to play two at the same time, so I would have to choose — either music or SFX. That's why I decided that the sounds in the game will not be at all.

In addition, the project was to be finished a long time ago, more than 6 months ago. But instead of completing the basic version and publishing it, I kept adding new elements to the game. Therefore, I will not add new functionalities anymore and I will focus on completing this project. The only thing left is to adapt the current code to the Unixes (generally, for other platforms than Windows), create the final levels and several animations.

I really want to finish this project and get on with the next one waiting… 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 09, 2019, 07:26:15 pm
No problem. As any videogame player knows the background music can be any, just play it from the browser when you're playing the game.

So you had the game finished? So in fact you're the winner of the game contest, if my math is right... 6 months ago...

Is a good game you coded, This foreground-background I've seen in Sonic Mania I think has a part of a level like that. And in another sonic fan game had that too.

Please the next one use a library so it can run fullscreen, or even in android device  :)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 10, 2019, 01:20:17 am
So you had the game finished?

No, because I still do not know if the game works properly after compilation on other platforms. I have provided the latest sources (with improved rendering) in this post (https://forum.lazarus.freepascal.org/index.php/topic,44908.msg316803.html#msg316803), but no one has yet provided information about whether everything works on Unixes or whether there are any problems yet. At the moment I am only sure that the game works properly on different Windows systems (XP, 7, 10).

Therefore, I am asking everyone who wants to help me to get the source and give feedback.

For the publication of this game, I had to adapt the code to the Unix and finish the final levels (because now the game has only a few short levels for test). I would like to do it well, taking care of every detail, so that this game would give a little joy.

Quote
So in fact you're the winner of the game contest, if my math is right... 6 months ago...

Although I wrote about this project in this post (https://forum.lazarus.freepascal.org/index.php/topic,39495.msg293070.html#msg293070), I did not publish the source code, because the work continued and at that time it could not even be compiled. So, in theory, I did not take part in this competition at all. 8)

Quote
Is a good game you coded, This foreground-background I've seen in Sonic Mania I think has a part of a level like that. And in another sonic fan game had that too.

To test this appearance of levels and the ability to change the layer during the game, I was inspired by the Limbo game. Only that this game has layers in the gray scale, and I added some colors to my game.

Quote
Please the next one use a library so it can run fullscreen, or even in android device  :)

The game supports full-screen mode and multi-screen environment. To enlarge or reduce the size of the window, just press few times the non-numeric + or - key. You can also move the window between the screens with the mouse (left button), if the window is smaller than the screen.

The game has a lot of features, which is why I described all of them in the readme.txt file, which I recommend to read.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 10, 2019, 02:06:14 am
Ok just wanted to be sure that you can be the winner of the contest. Of course if not finished can't be.

About the layers I don't know Limbo game, but I know that in a level of sonic mania there is that effect, but not as part of the normal gameplay, like a bonus stuff in a level to go back and then come back to front.

Cool that the window can be enlarged, for sure I will test it again to enjoy it better.

For me you win, making this game one of the few platforms (or the only one) made with FPC. If there are more platformers like this one made with FPC I sure want to play them as well.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Handoko on April 10, 2019, 06:58:07 am
I have provided the latest sources (with improved rendering) in this post (https://forum.lazarus.freepascal.org/index.php/topic,44908.msg316803.html#msg316803), but no one has yet provided information about whether everything works on Unixes or whether there are any problems yet. At the moment I am only sure that the game works properly on different Windows systems (XP, 7, 10).

I've just downloaded and tested. So far everything seems to work correctly on Ubuntu 18.10 64-bit Lazarus 1.8.4 GTK2.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 10, 2019, 10:34:46 am
Here are the "results" on a Pentium 4 3Ghz 512Mb ATI Radeon 7000 with Ubuntu 12.04.

I couldn't pass the "deep abbyss" :-[
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 10, 2019, 02:32:40 pm
Maybe i not understand ?

First game "meadow" ? not show any floor for can bump or fall ? Then is not easy game  :-\
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 10, 2019, 06:19:00 pm
Finally good news... :D

I've just downloaded and tested. So far everything seems to work correctly on Ubuntu 18.10 64-bit Lazarus 1.8.4 GTK2.

Thank you @Handoko. I'm wondering why the load is almost 60%, 20% higher than on my rather old hardware. Did you increased the size of the window, and then reduced it? Because this causes the load to increase and after reducing the window to its previous size, the load is greater than before resizing.

It is not dependent on the game code, because this effect occurs in Lazarus 2.0.0, but does not occur if I compile the game in Lazarus 1.8.4. So something had to change in LCL, that the same code works differently in two different versions of the IDE.

If you did not increase the size of the window before taking a screen shot, the higher load on Linux is simply specific to this system when it comes to the current project code. But the most important thing is that the game works properly, which makes me very happy.

For clarity, I develop the game and test it on a Lenovo Thinkpad T60 with the following parameters:
And the in-level load is about 41%.


Here are the "results" on a Pentium 4 3Ghz 512Mb ATI Radeon 7000 with Ubuntu 12.04.

Another older hardware! The better, because the game will definitely run smoothly on a powerful computer, but it is never certain about older ones. I care about all computers, including old and weak ones. Thank you for the test.

But can you reveal how big the load is during plaing on the level (or in the menu)? Just run the game with cheat on parameters pair and look at the counter placed in the lower left corner. It should be smaller than 100% for the game to run smoothly.

Quote
I couldn't pass the "deep abbyss" :-[

Don't give up — just try few times more. If you can not jump over, the game will tell you what to do. 8)


First game "meadow" ? not show any floor for can bump or fall ? Then is not easy game  :-\

Can you describe the problem more accurately and show the screenshots?

The first level in the deep meadow world, just after showing up on the screen, should look like in the attached screenshot. As you can see, there are platforms in it.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 10, 2019, 06:55:04 pm
@lucamar: I have a question for you (to others too).

The game in full-screen mode should hide the cursor, but in windowed mode, the cursor should be visible and have the form suitable for crSizeAll enum. However, on the screenshots you have given, the cursor is a normal arrow, which is incorrect. Is the cursor really an arrow in windowed mode?

Look at the screenshot from the attachment — this is what it looks like in my case (under Windows) and I would prefer it to look like on other platforms.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Handoko on April 10, 2019, 07:06:13 pm
I didn't change anything, the window size was the default. I saw the default compilation was in Debug mode. If I try to change it to Release mode, there will be a bit increasing of the performance.

On Debug mode, I mostly got 60% - 95% load when playing. On Release mode, I mostly got 50% - 80%.

My computer is Core2 Quad Q6600 DDR2 4 GB RAM Nvidia GeForce 210 Ubuntu 18.10 64-bit Lazarus 1.8.4.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 10, 2019, 07:08:58 pm
Can you describe the problem more accurately and show the screenshots?

The first level in the deep meadow world, just after showing up on the screen, should look like in the attached screenshot. As you can see, there are platforms in it.
For me look like attach

Game instruction help any good work (can show picture attach if want)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 10, 2019, 07:20:31 pm
@lucamar: I have a question for you (to others too).

The game in full-screen mode should hide the cursor, but in windowed mode, the cursor should be visible and have the form suitable for crSizeAll enum. However, on the screenshots you have given, the cursor is a normal arrow, which is incorrect. Is the cursor really an arrow in windowed mode?

Look at the screenshot from the attachment — this is what it looks like in my case (under Windows) and I would prefer it to look like on other platforms.
Screen grab program raspbian set option "hide cursor" if grab. If window game active then cursor = "crSizeAll". Click outside for grab then not game active = cursor change "normal"

I not know how work windows  :-[

add:

Because fun game i attach wimp  ;D

you make good game furious programming  8-)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 10, 2019, 08:04:23 pm
But can you reveal how big the load is during plaing on the level (or in the menu)? Just run the game with cheat on parameters pair and look at the counter placed in the lower left corner. It should be smaller than 100% for the game to run smoothly.

The game (ok, the tutorial) runs smooth but, 100%? Nah, try rather anywhere from 250% to 500% with fps ranging from around 30 (in the text parts) to 12..18 in the "try yourself" parts (see attached image). But let me repeat: it runs quite smooth, in a really endearing "old-style" kind of way.

@lucamar: I have a question for you (to others too).

[...] on the screenshots you have given, the cursor is a normal arrow, which is incorrect. Is the cursor really an arrow in windowed mode?

It's not an arrow (I guess that's something the screen-grabber does by itself) but it isn't like your pic either: in my system it shows a "hand" cursor.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Handoko on April 10, 2019, 08:13:18 pm
On Debug mode, I almost never reached 100% load. But I wonder why on Release mode, I sometimes got 105% and 120%. But on average Release mode has lower loading compare to Debug mode.

Although the load sometimes seems scary, but I didn't experience any slowdown.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 10, 2019, 09:07:52 pm
This is unbelievable... Why is this game working so slowly on Linux...?

On my 12-year-old laptop it works twice as fast as on a modern computer with Linux and a quad-core processor. I checked how the game works on newer hardware — Samsung RV720 with 3GB RAM, Windows 7. And the load is much smaller, reaching 24% at the default window size and 55% at full screen (see attachments). Project compiled in Lazarus 2.0.0 64-bit as a native 64-bit executable works with the same speed. On Windows (on my old laptop with XP), the release version works 5% faster than the debug version (because handling exceptions are disabled and better optimizations are used).

Rather, it's not a hardware problem, but a native code generetaed for Linux. And it should not be much slower, because bitmap processing looks exactly the same on this system as on Windows (alpha channel is not used, it is completely skipped).

I have no idea why there are such large differences in performance between these platforms... Perhaps the problem is not the bitmap processing, but the calculation in the timer class? Maybe the timer does not work properly?

I have an idea how to measure the real FPS count.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 10, 2019, 09:49:45 pm
Ok, we need to check if the timer is working properly. Please, download the project sources from the attachment. The code is the same as before, but I commented out the code responsible for waiting for the calculated amount of time between frames:

Code: Pascal  [Select]
  1. procedure TClock.WaitForNMI();
  2. //var
  3. //  NextFrameCounts, CurrentCounts: Int64;
  4. begin
  5.   //NextFrameCounts := FFrameCountsBegin + FCountsPerFrame;
  6.   //
  7.   //repeat
  8.   //  CurrentCounts := GetHardwareCounterValue();
  9.   //until CurrentCounts >= NextFrameCounts;
  10. end;

Now the game will perform as many frames as possible, and because the game works on the same principle as NES, will work much too fast (this is intended).

On my old laptop, the CPU can perform about 145 frames per second during in-level gameplay. On the better laptop, Core2Quad CPU can perform about 244 frames per second. Please, make the same test and provide a screenshot with first blue level (as in my screenshots).
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 10, 2019, 10:22:55 pm
Here you have it. The same ancient box :)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: nouzi on April 11, 2019, 09:38:17 am
win 7 64 bit
cpu i7-3770 3.40 GHz
ram 8g
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 11, 2019, 05:18:05 pm
@lucamar: damn it… So the timer works properly and it looks like for some reason bitmap processing on Linux takes much longer than on Windows. Ie. the reasons can be two (or more) — either the bitmap processing takes too long, or it takes a long time to render the final frame bitmap on the window canvas (this is done using TCanvas.StretchDraw, so it would not be my fault).

If you want, download the soruces from the attachment, compile and run. The window will be always black, because rendering frame buffer on the window canvas is disabled. The code responsible for doing the delay between frames is also disabled, so the game should perform as much frames as CPU can do. The console window will be shown on the screen (except the game window itself), in which the current framerate will be printed in every second. Just check the values printed in the console and let me know what is the framerate.

One important thing — do not deactivate game window, because if you do this, the game will disable the logic resposible for drawing the frame, so the framerate will jump 10 times. Just run the game, spread the windows so that the console will be visible and click on the game window to activate it. Wait a few seconds for the framerate to stabilize. Then you can check the values in the console.

On my old computer, the framerate is about 167-170 (look at the screenshot in the attachment).


@nouzi: thank you for test. But what about frame load? Just run the game with the following parameters pair:

Code: Pascal  [Select]
  1. > platformer.exe cheat on

and check the load counter value in the lower left corner during menu or in-level gameplay.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 11, 2019, 07:16:18 pm
I don't think the "problem"  is that it is Linux but that this machine is (relatively) slow. I'll try to test with one of the other (more modern) machines to see what's what :)

Meanwhile, here is the result of the frame tester:

ETA: So... I made another test: Booted this same machine in Windows XP, compiled and run; results on the second image. It looks like it might be a Linux vs. Windows affair.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 11, 2019, 08:21:39 pm
I don't think the "problem"  is that it is Linux […]

No, I did not write that the problem is Linux, and the native code, generated by the compiler for this system. Something is terribly slow and I have no idea what… The very logic of the game (without the bitmap processing code) does not constitute any overhead, almost 100% of the used CPU power is used to generate frames (processing bitmaps).

Quote
[…] but that this machine is (relatively) slow.

It's fast enough for the game to work without any problems with a fixed 60fps (no matter which scene), all the more in the form of a small window (with the default size). This problem is not harware related for sure.

Quote
Meanwhile, here is the result of the frame tester:

Yep, this is the proof that the bitmap processing code works terribly slow. But I don't know why.

And since that is how it looks, I will probably stop the porting the code. Honestly, I'm just wasting the time instead of focusing on content creation. In the end, the game can be easily run on Linux with Wine (and will work correctly, it was tested some time ago).
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 11, 2019, 09:10:10 pm
And since that is how it looks, I will probably stop the porting the code. Honestly, I'm just wasting the time instead of focusing on content creation.

No, please.Keep porting even if it'll be slow in Linux. After all it's not slow enough as to be unplayable and, frankly, if you hadn't told us I wouldn't have noticed at all. I would love to have this game/tech-demo available for Linux. Pretty please ... :-*

As for the problem, I would really love to see the results of the framerate-tester on other computers. Come on, linux-people, test a little! It's just 5 minutes tops.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 11, 2019, 10:16:58 pm
As for the problem, I would really love to see the results of the framerate-tester on other computers. Come on, linux-people, test a little! It's just 5 minutes tops.
I make my test.

Stretchdraw memory bitmap 300x150 32bpp to 672x384 32bpp make high 42 fps.

That no good ... 75% cpu do nothing  :)

I think is no speed accelerate gtk and why not can make fast.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 11, 2019, 10:37:14 pm
I think is no speed accelerate gtk and why not can make fast.

Ah! That may be it: Since updating to 12.04 I have had problems with X not finding the proper server for my card (ATI Radeon 7000 IGP) so it may be using a generic one. Also, I'm on a GNOME fallback session instead of the default Unity one, which may affect it too. I'll try on a clean(er) machine.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: nouzi on April 11, 2019, 10:59:44 pm
this test with laptop
cpu i7 2620M 2.7 GHhz
ram 8g
os win 7 64 bit
gpu Intel(R) HD Graphics 3000

Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 11, 2019, 11:05:55 pm
this test with laptop
cpu i7 2620M 2.7 GHhz
ram 8g
os win 7 64 bit
gpu Intel(R) HD Graphics 3000

You know, one would expect a more pronounced difference between that machine and my ancient Pentium 4 3GHz, but it's just about 1.5 times faster ... curioseur and curioseur
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: nouzi on April 11, 2019, 11:25:20 pm
this test with laptop
cpu i7 2620M 2.7 GHhz
ram 8g
os win 7 64 bit
gpu Intel(R) HD Graphics 3000

You know, one would expect a more pronounced difference between that machine and my ancient Pentium 4 3GHz, but it's just about 1.5 times faster ... curioseur and curioseur
Actually the problem is in my machine
 Hank is a total slow
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: nouzi on April 11, 2019, 11:56:11 pm
other test
this test with laptop
cpu i7 2620M 2.7 GHhz
ram 8g
os win 7 64 bit
gpu Intel(R) HD Graphics 3000

Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 12, 2019, 12:45:21 am
No, please.Keep porting even if it'll be slow in Linux.

In fact, the project code is finished, both for Windows and for Unixes. However, the game is far too slow on Linux and I have to do something about it. It's just that I do not know what... I checked everything and still do not know where is the bottleneck...

The logic of the game is irrelevant, because virtually all of the consumed CPU power is related to bitmap processing. Therefore, frame generation has been optimized thanks to the back buffer and bitmap content modification using ScanLine. I can not write a more efficient code to do this, keeping the code object-oriented and simple to understand.

Quote
After all it's not slow enough as to be unplayable and, frankly, if you hadn't told us I wouldn't have noticed at all.

You can visually check the smoothness of the game on your computer and compare it with the correct speed. In this post (https://forum.lazarus.freepascal.org/index.php/topic,43177.msg309922.html#msg309922) I've provided links to recordings of the gameplay. The three middle links contain recordings of in-level gameplay. Just check if you want.

Previously, I had also implemented postprocessing, which concerned the rendering of a scanlines, like in old CRT TV (see attachments), but I resigned from it for several reasons. Once, the scanlines looked good only in the window with default size, and secondly, it significantly affected performance. So I removed completely the postprocessing code.

Quote
I would love to have this game/tech-demo available for Linux. Pretty please ... :-*

I can leave the Linux-specific code in the project, but if the native Linux compilation is going to work so slowly, then playing it will not give a fun... As an alternative, everyone can download the Windows build and use the Wine.

Quote
As for the problem, I would really love to see the results of the framerate-tester on other computers.

Me too, especially on Linuxes and macOS. :D


Stretchdraw memory bitmap 300x150 32bpp to 672x384 32bpp make high 42 fps.

That no good ... 75% cpu do nothing  :)

I do not understand this. Can you write more clearly what's going on, please?

Quote
I think is no speed accelerate gtk and why not can make fast.

The game does not use hardware acceleration anyway. The game is single-threaded, so any CPU is suitable. However, even on old computers it should run smoothly with 60fps (like on my 12-year-old grandpa), because it does not need a very powerful processor.

The game should work on a computer with 1GHz single-core CPU, when it comes to the default window size.


other test
this test with laptop
cpu i7 2620M 2.7 GHhz
ram 8g
os win 7 64 bit
gpu Intel(R) HD Graphics 3000

This is a proper speed on this machine — few thousand frames per second. You can try run the version with rendering the frame on window canvas, but without doing delays between frames. The framerate should be about 2000 on the mentioned laptop.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 12, 2019, 01:21:49 am
Stretchdraw memory bitmap 300x150 32bpp to 672x384 32bpp make high 42 fps.

That no good ... 75% cpu do nothing  :)

I do not understand this. Can you write more clearly what's going on, please?
25% time cpu is use StretchDraw. 75% time cpu do nothing (quad-core)

I think X have make graphics draw separate thread but no do.

Quote
Quote
I think is no speed accelerate gtk and why not can make fast.
The game does not use hardware acceleration anyway.
I think you forget many windows gdi/gdi+ is hardware accelerate use driver. Then you game not say is accelerate. Windows and hardware say is accelerate or no  :)

Game can program opengl or program direct-x self then is accelerate when graphic hardware have driver support windows. If no then windows use software render and slow.

That why not compare linux <> windows because not same.  Were find window computer not hardware accelerate ?

Quote
The game is single-threaded, so any CPU is suitable. However, even on old computers it should run smoothly with 60fps (like on my 12-year-old grandpa), because it does not need a very powerful processor.

The game should work on a computer with 1GHz single-core CPU, when it comes to the default window size.
My program test show 1/3 time use by Lazarus and 2/3 (some time more) use X-org. I think that is tell  ;)

I raspberry and not can change and have wait driver support. Other linux can work same good windows.

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 CountFrame(Data: PtrInt);
  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, DateUtils;
  33.  
  34. { TForm1 }
  35.  
  36. procedure TForm1.FormCreate(Sender: TObject);
  37. begin
  38.   Self.ClientWidth:=672;
  39.   Self.ClientHeight:=384;
  40.  
  41.   view := TBitmap.Create;
  42.   view.SetSize(300,150);
  43.   view.Canvas.AntialiasingMode:=amOff;
  44.   view.Canvas.TextOut(100,75,'Test test tesT');
  45.  
  46.   Application.QueueAsyncCall(@Self.CountFrame,0);
  47. end;
  48.  
  49. procedure TForm1.FormDestroy(Sender: TObject);
  50. begin
  51.   view.Free;
  52. end;
  53.  
  54. procedure TForm1.FormPaint(Sender: TObject);
  55. begin
  56.   Self.Canvas.StretchDraw(Self.ClientRect, view);
  57. end;
  58.  
  59. procedure TForm1.CountFrame(Data: PtrInt);
  60. const
  61.   TestSecs= 60;
  62. var
  63.   TimeStart: TDateTime;
  64.   FrameCount: Int64;
  65.   ElapseSecs: Int64;
  66. begin
  67.   FrameCount:=0;
  68.  
  69.   Self.Text:=Format('Test wait %d secs', [TestSecs]);
  70.  
  71.   ElapseSecs:=0;
  72.   TimeStart:=Time;
  73.  
  74.   while ElapseSecs<TestSecs do
  75.   begin
  76.     Self.Update;  //    Self.Canvas.StretchDraw(Self.ClientRect, view);
  77.     inc(FrameCount);
  78.     ElapseSecs:=SecondsBetween(TimeStart,Time);
  79.   end;
  80.  
  81.   Self.Text:=Format('%d frames in %d secs (%d fps)', [FrameCount,ElapseSecs,Round(FrameCount/ElapseSecs)]);
  82. end;
  83. end.
  84.  

Many problem is no see meadow floor and bumps. That maybe arm problem. I sorry and i try and not find fix.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 12, 2019, 02:24:06 am
25% time cpu is use StretchDraw. 75% time cpu do nothing (quad-core)

No no no — the game uses only one CPU core, because is single-threaded and the game process always eats all power of the one CPU core. If you have quad-core, then the overall usage of the CPU power will be about 25%. I have a dual-core CPU, so the overall usage is about 50%. On a single-core CPU will be about 100%.

That's why the game has it's own counter (lower left corner, when cheat mode is enabled) which shows how much of 16.7ms (in percentage) is used to process bitmaps. When the load is equal 100%, then the bitmap processing for one frame takes exactly 16.7ms. If the percentage is smaller, then generating the frame takes less than 16.7ms. The fewer the better.

Quote
I think X have make graphics draw separate thread but no do.

Bitmaps processing should not be automatically separated, because this game is standard windowed application.

Quote
I think you forget many windows gdi/gdi+ is hardware accelerate use driver.

I should rather say that the game does not use a specific hardware acceleration, provided for example thanks to OpenGL or DirectX. 8)

Quote
If no then windows use software render and slow.

Yep.

Quote
My program test show 1/3 time use by Lazarus and 2/3 (some time more) use X-org. I think that is tell  ;)

And what I need to do with it? I do not even know how Linux works.

Quote
Many problem is no see meadow floor and bumps.

This is a huge problem — level layers are not rendered properly on Rasbian. In this case, the more I do not know why this is happening.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 12, 2019, 11:07:39 am
No no no — the game uses only one CPU core, because is single-threaded and the game process always eats all power of the one CPU core. If you have quad-core, then the overall usage of the CPU power will be about 25%. I have a dual-core CPU, so the overall usage is about 50%. On a single-core CPU will be about 100%.
Yes. I understand and i know. Game program source not make thread  :)

Quote
That's why the game has it's own counter (lower left corner, when cheat mode is enabled) which shows how much of 16.7ms (in percentage) is used to process bitmaps. When the load is equal 100%, then the bitmap processing for one frame takes exactly 16.7ms. If the percentage is smaller, then generating the frame takes less than 16.7ms. The fewer the better.
Yes. Thanksy for write.

If help i write load raspbian is ~350%/380% and (some time) top ~500%

Quote
Bitmaps processing should not be separated, because this game is standard windowed application.
I make sure i tell to write about OS/widget/driver not you game. For game not separate then is no good.

Quote
I should rather say that the game does not use a specific hardware acceleration, provided for example thanks to OpenGL or DirectX. 8)
Ok. Then you right. I think maybe you forget (you ask why differ) so i write why can so many speed differ :)

Quote
Quote
My program test show 1/3 time use by Lazarus and 2/3 (some time more) use X-org. I think that is tell  ;)
And what I need to do with it? I do not even know how Linux works.
You not need do any thing. Is not error you and is not error game. Make simple: "it is".

I not want write is you error. If i make think you that then i sorry  :-[

There can many mistake any were. Can be Lazarus, can be widget (gtk2), can be render widget engine, can be graphic driver. And maybe can no work accelerate any way.

User lucamar write it no important speed. If not say then not notice. I agree write lucamar.

For you programming it matter because know you and have small time left in game do some thing else (example render music or math graphic fx like explode).

I think game is good. It have friend hero and look dynamic. You write good story. Game have good intro, good tutorial. Graphic is good. The game engine is look clean and easy (like write before it maybe difficult understand because inheritance/abstract).

I sad i not can play level good and make more experience.

If point game is make technical demo then i think you have make point already. Every thing else learn from this i think is for experience you extra.


Quote
Quote
Many problem is no see meadow floor and bumps.
This is a huge problem — level layers are not rendered properly on Rasbian. In this case, the more I do not know why this is happening.
Many time arm problem is when optimize so i turn off. Other problem arm is alignment. Arm have differ fpu and some time give error when use precision math. It can be any thing so that make difficult find error good  :'(

No waste time for find. I think better you make point of game. Can always see later and try find error.

No matter what do, i thanksy you for make good game (engine) and try me write better english   8-)

add:

before post i forget attach and now i forget also  :-[
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 12, 2019, 02:21:21 pm
Yes. I understand and i know. Game program source not make thread  :)

Exactly, I tried to made a game which works like the games for NES hardware — no threading, no timers and so on. And the additional condition — no graphics libraries.

Quote
If help i write load raspbian is ~350%/380% and (some time) top ~500%

A high load occurs when the background is level (on menu and during in-level gameplay). And the highest load occurs when the layer changes, because then four layers are rendered (all scaled) instead of three (two scaled and one not). This applies to in-level gameplay, when the gate to change layer is used (layer change animation takes 15 frames, or 250ms) and in staff screen (during the whole scene).

Quote
I not want write is you error. If i make think you that then i sorry  :-[

Do not apologize, if I made a mistake somewhere, I should know about it. 8)

Quote
There can many mistake any were. Can be Lazarus, can be widget (gtk2), can be render widget engine, can be graphic driver. And maybe can no work accelerate any way.

Graphic card driver not for sure — either widgetset or sofware renderer. Do not know exactly. But if I have to use the TBitmap class, then I can not do anything about it.

Quote
User lucamar write it no important speed. If not say then not notice. I agree write lucamar.

You guys are crazy... speed is not important? Who like to play with lags...? :D

Quote
I think game is good. It have friend hero and look dynamic. You write good story.

Story is not finished yet. The game has only few test levels, the final set of levels will be bigger, more interesting. And the levels themselves will be much nicer and more complicated than the test ones. The final version of the game should have several dozen levels.

Quote
No waste time for find. I think better you make point of game. Can always see later and try find error.

Ok, for now, I will focus on creating content.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 12, 2019, 03:50:41 pm
You guys are crazy... speed is not important? Who like to play with lags...? :D

That's the thing: there are no lags. At least not with the code you posted. One never knows what will happen when you add more varied graphics, music/effects, etc. As it is now, it's eminently playable. And funny, and tha's said by someone who doesn't like games (actually I just play Tyrian 2K and a Zaxxon remake from time to time  ;D )
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 12, 2019, 04:14:36 pm
@Thausand: I tested the project that you provide in the previous post (under debugger). Just look at the attachment and compare how this program work in your computer and how on mine. It's ridiculous...

BTW: the back buffer used by game has a size of 224x128 pixels, so it is smaller than this one used in your tester.

Edit: this tester is not good, because on Windows Self.Update does not forces window to repaint. Thats why I got the ridiculously big framerate. If I change the code of the CountFrame and add the following lines:

Code: Pascal  [Select]
  1. procedure TForm1.CountFrame(Data: PtrInt);
  2. const
  3.   TestSecs= 60;
  4. var
  5.   TimeStart: TDateTime;
  6.   FrameCount: Int64 = 0;
  7.   ElapseSecs: Int64 = 0;
  8. begin
  9.   Self.Text := Format('Test wait %d secs', [TestSecs]);
  10.   TimeStart := Time();
  11.  
  12.   while ElapseSecs < TestSecs do
  13.   begin
  14.     Self.Invalidate();
  15.     Application.ProcessMessages();
  16.  
  17.     Inc(FrameCount);
  18.     ElapseSecs := SecondsBetween(TimeStart, Time);
  19.   end;
  20.  
  21.   Self.Text := Format('%d frames in %d secs (%d fps)', [FrameCount, ElapseSecs, Round(FrameCount / ElapseSecs)]);
  22. end;

then I got a more actual result — 25520 frames in 60 secs (425 fps) (see 3rd attachment). Even under debugger (if I run the project in IDE) and without strong optimizations.


That's the thing: there are no lags. At least not with the code you posted.

But how? I do not understand...

If the load value is more than 100%, then the framerate decreases below 60 and the game must work slowly. This can be checked manually — just run the game with cheat mode enabled and press/hold the Page Down key to decrease framerate. Then the game will work in a slow motion — it must be so because it was written in such a way.

I recorded the slow motion feature in this video — Deep Platformer – jumping test.webm (https://4programmers.net/Forum/Download/22139) (from 20th second). If the framerate drops, then the game should work like on the recording, instead of running smoothly.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 12, 2019, 08:46:06 pm
Edit: this tester is not good, because on Windows Self.Update does not forces window to repaint. Thats why I got the ridiculously big framerate. If I change the code of the CountFrame and add the following lines:
Yes i know. That why write:
Code: Pascal  [Select]
  1.     Self.Update;  //    Self.Canvas.StretchDraw(Self.ClientRect, view);
  2.  
for windows i think better write:
Code: Pascal  [Select]
  1.   {$IFDEF WINDOWS}
  2.   Self.Canvas.StretchDraw(Self.ClientRect, view);
  3.   {$ELSE}
  4.   Self.Update;   // is have overhead LCL (re)paint
  5.   {$ENDIF}
  6.  

Application.processmessages() make more overhead windows. I not know that good to make work windows or have also write Self.Paint/Self.Repaint.

It tell gtk2 <> win32 widget work LCL. Many differ.

Quote
I recorded the slow motion feature in this video — Deep Platformer – jumping test.webm (from 20th second). If the framerate drops, then the game should work like on the recording, instead of running smoothly.
Yes game for me similar (little more fast) like video. That no lag if not know. Is just play more slow.

You know anime example pokemon ? You know many fps use that ? That make top 12 fps and ~8 fps normal. Then look anime 144 hz television/monitor and not forget usage F/G-sync. Lucamar and me say no speed important and we crazy people ?  :P

Game can fix slow then make more speed when calc hero move (make frame skip hero move). If too many speed calc then have no good fps then see lag. Or can use double/triple buffer. I know not work for you game example lazarus but have snes i think it work same other game console.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 13, 2019, 12:07:31 am
Yes i know. That why write:
Code: Pascal  [Select]
  1.     Self.Update;  //    Self.Canvas.StretchDraw(Self.ClientRect, view);
  2.  
for windows i think better write:
Code: Pascal  [Select]
  1.   {$IFDEF WINDOWS}
  2.   Self.Canvas.StretchDraw(Self.ClientRect, view);
  3.   {$ELSE}
  4.   Self.Update;   // is have overhead LCL (re)paint
  5.   {$ENDIF}
  6.  

This does not help, because canvas is updated, but window surface on the screen not. If I used Invalidate or other method, then nothing happen — still huge, imposible framerate.

That's why I used ProcessMessages in your tester to process message queue and repaint the window on the screen (and thanks to this, the framerate is actual). The game work in the same way, just look at this code:

Code: Pascal  [Select]
  1. // Platformer.Scenes.pp, line 386
  2.  
  3. procedure TScene.UpdateWindowInterface();
  4. begin
  5.   GameForm.Invalidate();
  6.   Application.ProcessMessages();
  7. end;

If I comment out the ProcessMessages call, then the window will not even show on the screen (will be invisible, but the game will work and it will not respond to the input, because the message queue will be blocked). And if I once force the window to show on the screen, then the window will be visible, but it's surface will be all black (despite the fact that the game works all the time, renders the frames and repaints the window canvas).

So, on Windows the ProcessMessages is just mandatory.

Quote
Yes game for me similar (little more fast) like video. That no lag if not know. Is just play more slow.

And this is not good, because if the game work in slow motion, then it is so easy to play. And this game must not be easy, like in the old good times. 8)

Quote
If too many speed calc then have no good fps then see lag.

The game logic, ie reading input, handling hero moves, detecting collisions and so on, takes just nothing. Almost all used CPU power (I did not measure, but 99.9% for sure) is used for bitmap processing.

Edit: I made a test, comment out the methods responsible for rendering frame and updating window. I got 21900fps. But when I comment out only the method responsible for repainting the window (rendering frame code is enabled) then the framerate is about 220fps. As you can see, the logic of the game is only 0.5% of the power consumed, 99.5% is for bitmap processing.

Fun fact.

Quote
Or can use double/triple buffer.

I am using internal bitmap to render frames, so the game is double buffered. And the game form (window) has DoubleBuffered property set to True. But it is still not enough for Linux. :D
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 13, 2019, 12:57:39 am
This does not help, because canvas is updated, but window surface on the screen not. If I used Invalidate or other method, then nothing happen – still huge, imposible
framerate.

That's why I used ProcessMessages in your tester to process message queue and repaint the window on the screen (and thanks to this, the framerate is actual). The game work in the same way, just look at this code:
Quote
So, on Windows the ProcessMessages is just mandatory.
Thanks explain. I not know windows need ProcessMessages for show picture.

But... that not why i write test program. I write test program to see only how many time take StretchDraw. If show on screen or not is no important.

If show picture or no then gtk is show picture overhead ~3 fps. If no picture then make ~42 fps and if is picture make ~38 fps. Overhead draw picture ~42 - ~38 = ~4 fps. I make many test and many time overhead calculate 3 fps. But maybe better write is 4 fps overhead :)

My test program not many precise use time and also use slow calculate. But i think is good test to see were is speed problem.

Can make more precise then use high precision timer but can also calculate overhead call function time, inc(framecount) and SecondsBetween and subtract overhead. I write important know that if other program run OS, play mouse or move window can make more bad precision. That why Application.Processmessages no good for calculation.

Yes , i agree is ridiculous slow gtk  :(


Quote
I am using internal bitmap to render frames, so the game is double buffered. And the game form (window) has DoubleBuffered property set to True. But it is still not enough for Linux. :D
Double buffer can work if try fix lag. Double buffer not fix slow. Double buffer then make game more slow  :)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 13, 2019, 02:53:32 am
Double buffer can work if try fix lag. Double buffer not fix slow. Double buffer then make game more slow  :)

No on Windows. 8)

If I disable the built-in double buffering for application:

Code: Pascal  [Select]
  1. Application.DoubleBuffered := adbFalse;

or for the window:

Code: Pascal  [Select]
  1. GameForm.DoubleBuffered := False;

then the window surface will be painted  incorrectly, and the game itself will work 5% slower than with extra buffering.

On my computer the glitch looks like the horizontal black bar (high at around 25% of the window height) moves slowly from top to bottom of the window, and so on and on. It looks very much like in this recording (https://youtu.be/l3hodEQVVLE?t=14), except that the window does not blink — only the black bar moves on the screen.

This glitch is related to the screen. On the laptop screen, such a bar moves slowly from top to the bottom of the window surface. But if I drag the window to the secondary screen (external monitor), then this bar does not move, but it is still visible.

So, I have to use built-in double buffering, at least for Windows systems. If you want, just disable double buffering and test the performance on Linux. I'm curious what will happen.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 13, 2019, 12:30:12 pm
No on Windows. 8)

Quote
If I disable the built-in double buffering for application:
Lazarus write hint "Application.DoubleBuffered not portable" ....

Quote
then the window surface will be painted  incorrectly, and the game itself works 5% slower the with extra buffering.
Yes because draw is fast windows. If draw slow then 5% add slow is more slow :)

If example slow draw make 5 frame any 100 frame show then 5% x 5 frame > 2 frame any 100 frame (5% x 2 frame)

Quote
On my computer the glitch looks like the horizontal black bar (high at around 25% of the window height) moves slowly from top to bottom of the window, and so on and on. It looks very much like in this recording, except that the window does not blink — only the black bar moves on the screen.

This glitch is related to the screen. On the laptop screen, such a bar moves slowly from top to the bottom of the window surface. But if I drag the window to the secondary screen (external monitor), then this bar does not move, but it is still visible.
I not see black bar linux but that because slow. Windows fast and is problem draw more fast video monitor.

If fast draw then can fix use double buffer or can maybe use timer and sync video monitor (if 60 hz video then draw picture screen no more 60 fps).

Bar is make because draw is not sync monitor. Lazarus no can do sync bitmap draw. Maybe widget backend can do sync draw but you see bar then i not think that sync draw.

Blink window youtube video look is timeing error. That can when draw "out of sync".

Game console game many use vertical blank sync draw (VBI). If not draw when sync monitor then can draw if user look picture same time and make black bar or/and "tear".

Quote
If you want, just disable double buffering and test the performance on Linux. I'm curious what will happen.
No thing change. All number and graphic look same :(
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 15, 2019, 09:40:26 am
Lazarus write hint "Application.DoubleBuffered not portable" ....

On Windows such a hint not exists, so it can be Unix-specific. This does not matter — I will not try to speed up the rendering code for Unixes, because I have no knowledge about this platform. Maybe I will back to this issue in the future.


In the meantime, I've made some more corrections in the project code. They do not refer to the code responsible for rendering — just small beauties, some syntactic sugar, some better organization of classes.

For the most part, because I modified the speedrun code a little bit. Previously, the gameplay time was displayed in the outro only after perfect completion of the game. I changed this and the speedrun has a slightly different logic — additional content in this mode is always unlocked and the time of the game is always shown in the outro.

I also completely removed the custom debugger symbols. Instead of them, it is possible to exclude handling of given scenes from the command line level. Thanks to this, we do not have to recompile the code every time, if we want to test the game without the given scenes (for example, without intro, menu or movies). The include file with instructions to check these directives was no longer needed, so I also removed it from the project.

The rest of the code remained unchanged, so the game will look the same as before these modifications. After all, I add current sources to attachments if someone would like to read the code.

Ok, back to content creation. 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Handoko on April 15, 2019, 12:43:39 pm
Downloaded and tested. It compiled and run without any issue on Ubuntu.

Thank you for sharing the source code.
There are many interesting things can be learn from the code. :)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 15, 2019, 01:29:33 pm
There are many interesting things can be learn from the code. :)

I hope so. :D


I forgot about updating the staff screen list... It is now updated, see attachment. Who else is willing to test the source code and to join the list of testers? The game has not yet been tested on FreeBSD, macOS and other Linux distributions. Do not worry, space in the staff screen is a lot. 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 15, 2019, 01:40:59 pm
Sorry i tell is name write error furious programming. Maybe i write wrong some were ?

Is name "Raspbian" can read here https://www.raspberrypi.org/downloads/raspbian/
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 15, 2019, 01:47:39 pm
Wow, I made a typo... fixed.

Edit: I replaced the attachment in the previous post. Thanks!
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 15, 2019, 02:02:05 pm
Wow, I made a typo... fixed.
Is not problem make typo error. I make many error when i write english  :-[

If credit show error then every one play game will see. Friend learn me new expression say "catch with pants down" (is not same but give same feel) :P

i thank you !
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 16, 2019, 12:42:00 am
The game works on Linux Mint — the test was carried out.

I need to add a comments to the sources, because I will not create documentation for this code.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 16, 2019, 01:41:52 am
I need to add a comments to the sources, because I will not create documentation for this code.

Well commented code vs. external documentation: two sides of the same coin ;D

BTW, tested and works on: Ubuntu 12.04..16.04, Kubuntu 14.04, Lubuntu 12.04..14.04, Windows XP SP3, Windows 7 Starter-something-or-other.

There were some problems on Windows 2K but it may be a misconfiguration of the video (Windows always had rendering problems on that box)

And I have to install an OpenBSD soon so I may be able to try in it if I manage to install a working Lazarus (first time: I'm crossing my fingers and touching wood).

Oh, an I tried to build on a DOS machine but nothing doing :D
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 16, 2019, 01:59:36 am
I get this on MacOS, fpc and lazarus trunk.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 16, 2019, 02:14:08 am
@lucamar: thanks for testing but, how should I enter this in the staff screen? You're spoiling my job... I need to come up with the tester information format again for this scene. :D

By the way, I did not think about Win2K support at all, but it would be nice if this system will be also supported.


@Lainz: thanks too. On Unix-like systems, I can use nanosleep instead of eating CPU power to do the delay between frames (Windows does not have such a function). I think so, but I will check it only tomorrow. This function will be even better and this is a good moment to do this.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 18, 2019, 11:33:41 pm
Ok, the new version of the project is prepared — sources in the attachment, help yourselves.

I modified the clock class code so that the game on Unix systems would stop working while waiting for the next frame. The function FPNanoSleep is responsible for this. On Windows, the game will still eat all the available power of one CPU core to do the delay between frames, because it does not have a similar function. Thanks to the new solution, the project should compile and work at least on Windows, Linux, FreeBSD, Solaris and macOS. Unless I have to port something else apart from the clock (though I doubt it). Tests are needed.


I will describe what the new solution is. First of all, we need the units there are few of them:

Code: Pascal  [Select]
  1. uses
  2.   {$IFDEF WINDOWS}
  3.   Windows,
  4.   {$ELSE}
  5.   BaseUnix, Unix,
  6.   {$ENDIF}
  7.   SysUtils;

Specifying the number of "ticks" performed by the CPU in one second looks the same as before. On Windows, the value is retrieved using QueryPerformanceFrequency, and on other systems it is a fixed billion-nanosecond value:

Code: Pascal  [Select]
  1. function TClock.GetHardwareCounterFrequency(): Int64;
  2. begin
  3.   {$IFDEF WINDOWS}
  4.   Result := 0;
  5.   QueryPerformanceFrequency(Result);
  6.   {$ELSE}
  7.   Result := 1000000000;
  8.   {$ENDIF}
  9. end;

The current value of the hardware clock is read on Windows using QueryPerformanceCounter, and on other systems using FPGetTimeOfDay and converted to the total number of nanoseconds:

Code: Pascal  [Select]
  1. function TClock.GetHardwareCounterValue(): Int64;
  2. {$IFDEF UNIX}
  3. var
  4.   Counter: TTimeVal;
  5. {$ENDIF}
  6. begin
  7.   {$IFDEF WINDOWS}
  8.   Result := 0;
  9.   QueryPerformanceCounter(Result);
  10.   {$ELSE}
  11.   FPGetTimeOfDay(@Counter, nil);
  12.   Result := Int64(Counter.tv_sec) * 1000000000 + Int64(Counter.tv_usec) * 1000;
  13.   {$ENDIF}
  14. end;

The last thing is a method whose task is to stop the program from working and waiting for the next frame. On Windows nothing has changed, and on other platforms the FPNanoSleep function is used:

Code: Pascal  [Select]
  1. procedure TClock.WaitForNMI();
  2. var
  3.   {$IFDEF WINDOWS}
  4.   NextFrameCounts, CurrentCounts: Int64;
  5.   {$ELSE}
  6.   SleepTime: Int64;
  7.   RequestedTime, RemainingTime: TTimeSpec;
  8.   {$ENDIF}
  9. begin
  10.   {$IFDEF WINDOWS}
  11.   NextFrameCounts := FFrameCountsBegin + FCountsPerFrame;
  12.  
  13.   repeat
  14.     CurrentCounts := GetHardwareCounterValue();
  15.   until CurrentCounts >= NextFrameCounts;
  16.   {$ELSE}
  17.   SleepTime := FFrameCountsBegin + FCountsPerFrame - FFrameCountsEnd;
  18.  
  19.   if SleepTime > 0 then
  20.   begin
  21.     RemainingTime.tv_sec := SleepTime div 1000000000;
  22.     RemainingTime.tv_nsec := SleepTime mod 1000000000;
  23.  
  24.     repeat
  25.       RequestedTime := RemainingTime;
  26.  
  27.       if FPNanoSleep(@RequestedTime, @RemainingTime) = 0 then Exit;
  28.       if FPGetErrNo() <> ESysEINTR then Exit;
  29.     until False;
  30.   end;
  31.   {$ENDIF}
  32. end;

So, probably this is the final version of the clock class code. And as before, if you have the time and willingness, test it and let me know how the game works. Just make a screenshot with in-level gameplay (so that the load counter is visible) and write if there are any problems.

Thank you all for the help.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 19, 2019, 01:26:49 am
Exception> unable to open fonts\white.font

The problem is that in macOS there is generated a bundle, thats like a zipped folder with the executable inside and a resources folder where the font must be copied.

Unfortunately I don't know how to fix this since I do only few programming on Mac currently, I do mostly Windows.

I tried copying the font with no success.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 19, 2019, 03:07:11 am
If you can and want, test it on any other non-Windows system (Linux, FreeBSD, Solaris e.t.c.).
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 19, 2019, 03:31:47 am
If you can and want, test it on any other non-Windows system (Linux, FreeBSD, Solaris e.t.c.).

I will try tomorrow on Linux.

But I just remember how I fixed the path problem for a bgracontrols project, I did like this

Code: Pascal  [Select]
  1. BCImageButton6.BitmapFile := Application.Location + BCImageButton6.BitmapFile;

You need to add the Application.Location, or anything that does the same the directory of the executable file. A full path is needed.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 19, 2019, 02:58:57 pm
Damn...

Currently, all paths are relative and hardcoded, in the form of constants in the Platformer.Constants.pp unit. I could add Application.Location anywhere where paths are used, but I will have to do it with {$IFDEF DARWIN} directives, so it will be quite unreadable.

It will be better to map the file tree to a class tree, so that I can conveniently read these paths. Thanks to this, I can only once and in one place determine prefix for paths (ie Application.Location for macOS or empty string for other systems) and add it to the result of the getter.

Time for the Platformer.Files.pp unit...


By the way — when I choose the MacOS operating system as target, then the code inside the {$IFDEF DARWIN} is disabled (will be skipped during compilation). It is enabled only if I choose Darwin as target OS.

So, what is the correct directive to detect macOS?
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 19, 2019, 03:24:59 pm
No need to add Application.Location to macos only. It will work for all OS since it's cross platform.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 19, 2019, 03:50:19 pm
By the way — when I choose the MacOS operating system as target, then the code inside the {$IFDEF DARWIN} is disabled (will be skipped during compilation). It is enabled only if I choose Darwin as target OS.

So, what is the correct directive to detect macOS?

IIRC, the MACOS define was for MacOS 1..9, and DARWIN is for MacOS X and beyond (and iOS?). Let's see if I can find where I saw that ... Ah, yes, in the wiki: Target MacOS (http://wiki.freepascal.org/Target_MacOS)

ETA: More helpful - Platform defines (http://wiki.freepascal.org/Platform_defines)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 19, 2019, 07:06:52 pm
No need to add Application.Location to macos only. It will work for all OS since it's cross platform.

I checked it — that's right, it is cross-platform. It's just a simple wrapper for ExtractFilePath, but it is short and easy to use. So I use it for all platforms and systems, without compiler directives.


IIRC, the MACOS define was for MacOS 1..9, and DARWIN is for MacOS X and beyond (and iOS?).

[…]

ETA: More helpful - Platform defines (http://wiki.freepascal.org/Platform_defines)

Yes, I saw this article, but I was not sure.

This article states that the MACOS symbol is for classic systems, and the DARWIN symbol is for Mac OS X and iOS. The project code is intended for desktop version of the OS X systems and at the same time not for iOS. So I think that I should use the DARWIN symbol.

if it goes well I will not have to use other symbols than MSWINDOWS and UNIX. 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 21, 2019, 08:55:19 pm
Ok, I improved the sources.

I have created a new unit — Platformer.Files.pp — in which is located the class preparing the paths.

First set of methods is used to convert a given path to native, always absolute, using native directory separators. These methods have protection against the multiple addition of the prefix in the form of an executable file path.

The second set of methods is used to check whether a file with a given path is on the disk. First, they prepare the path using the above methods, and then check the existence of the file with the standard FileExists function.

This class is used in all of my own classes having the LoadFromFile method and in other places where relative paths from constants are used. So, generally, everytime when the path to the file must be used, the TFiles.MakePath method is used. It is universal and convenient, because we can use both relative and absolute path, and in the result, always we will get the correct absolute path equipped with the native directory separator.


The improved sources are in the attachment. First new feature is the new mechanism for preparing the paths, and the second is the new clock mechanism, which should work on any of Unix-like systems. In addition better than this for Windows, because of using the FPNanoSleep to make delays between frames.

So, if you want to test, go ahead. You can test current sources on any operating system (Windows, Linux, BSD, Solaris and macOS) but, I care most about tests on non-Windows systems. In particular on macOS, because it has not yet been able to compile and run on this system (and now it is probably possible).

Feedback is welcome. 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 22, 2019, 03:21:30 am
Hi, tested on Mac OS

Doesn't works with the default build mode, no window is shown.

Configured to 32 bit also doesn't works. Configured to 64 bit and the same, no window is shown.

I have no debugger installed or configured so I can't say why it doesn't show up.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 22, 2019, 02:20:20 pm
Doesn't works with the default build mode, no window is shown.

Configured to 32 bit also doesn't works. Configured to 64 bit and the same, no window is shown.

Hmm... I had a similar problem earlier on Linux — the game started and worked, but the window did not show up on the screen (it was invisible). All because the game is single-threaded, so it is needed to force the window to show on the screen before the game main loop will be started. And this was done thanks to the custom message handler, which worked on Windows, but not on other platforms. It looked like this:

Code: Pascal  [Select]
  1. uses
  2.   LMessages, LCLIntf, Forms, Classes;
  3.  
  4. const
  5.   LM_AFTERSHOW = LM_USER + 1;
  6.  
  7. type
  8.   TMainForm = class(TForm)
  9.     procedure FormShow(ASender: TObject);
  10.   protected
  11.     procedure LMAfterShow(var AMessage: TLMessage); message LM_AFTERSHOW;
  12.   end;
  13.  
  14. {..}
  15.  
  16. procedure TMainForm.FormShow(ASender: TObject);
  17. begin
  18.   PostMessage(Self.Handle, LM_AFTERSHOW, 0, 0);
  19. end;
  20.  
  21. procedure TMainForm.LMAfterShow(var AMessage: TLMessage);
  22. begin
  23.   // here the game main loop starts
  24. end;

This solution work only on Windows. The test application is in the attachment — you can try.

I changed this code and use cross-platform function to force the window to show, inside the OnShow event handler. Thanks to this, messages are not used and the game can show the window on Linuxes too. Example:

Code: Pascal  [Select]
  1. uses
  2.   LCLIntf, LCLType, Forms, Classes;
  3.  
  4. type
  5.   TMainForm = class(TForm)
  6.     procedure FormShow(ASender: TObject);
  7.   end;
  8.  
  9. {..}
  10.  
  11. procedure TMainForm.FormShow(ASender: TObject);
  12. begin
  13.   ShowWindow(Self.Handle, SW_SHOWNORMAL);
  14.   // here the game main loop starts
  15. end;

See the second attachment. And this solution is currently implemented in the game project:

Code: Pascal  [Select]
  1. // Platformer.Window.pp, line 77
  2.  
  3. procedure TGameForm.FormShow(ASender: TObject);
  4. begin
  5.   ShowWindow(Handle, SW_SHOWNORMAL);
  6.   Game.Start();  // here the game main loop starts
  7. end;

But I do not know why this work on any systems, but on macOS not.

It is a pity that the TForm class does not have an event performed after actually showing the window on the screen (eg OnAfterShow) — I would not have to do all this stuff...


If this project must work on this system, we need to figure out how to force the window to show on the screen inside the OnShow event handler, before the Game.Start method call.

If someone wants to try to solve this problem on macOS, just download the showwindow test.zip and try to change it so that the message box appears above the program window, not alone. The correct result can be found on the screenshot in the attachment.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 22, 2019, 02:35:20 pm
It is a pity that the TForm class does not have an event performed after actually showing the window on the screen (eg OnAfterShow) — I would not have to do all this stuff...
I already make show you  :D

If not event then make own 'fake'. can use asynccall or application.onidle. Onidle have make boolean and only call once. If forget boolean then call many time  :)

Other can do postmessage make own when onshow.

May be is many more solution....
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 22, 2019, 02:41:38 pm
May be is many more solution....

All I need is one, that works on macOS.  ;D
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 22, 2019, 02:50:58 pm
All I need is one, that works on macOS.  ;D
hehe  :)

All example write have lazarus api. If no work then api error and make report bug  O:-)

Can make easy test example things i write, and may be someone macOS make test for you ?  I think many safe is application.onidle ?

add:

here find qeueasynccall example https://forum.lazarus.freepascal.org/index.php/topic,44908.msg317303.html#msg317303

any can test macos. If framecount write then work  :)

Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 22, 2019, 03:12:56 pm
here find qeueasynccall example https://forum.lazarus.freepascal.org/index.php/topic,44908.msg317303.html#msg317303

I know how to use QueueAsyncCall, but I do not know if it can solve the problem on macOS. 8)


Ok, I prepared the test of the QueueAsyncCall — sources in the attachment. If it will work on macOS (and other non-Windows systems) and show the message box over the main form, then I will implement it in the game project. Just test it and tell me if it work or not.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Thausand on April 22, 2019, 10:35:03 pm
I know how to use QueueAsyncCall, but I do not know if it can solve the problem on macOS. 8)
Ok then wait macos and test see ...

Test i know work raspbian and make complete i post attach.

I make sure write raspbian have problem first level play meadow and have no path/bump that can walk see. I still no found problem. Is complicate when intro level work ok no problem  %)


Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 23, 2019, 12:12:08 am
So, the test on the macOS will be a moment of truth. 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 23, 2019, 01:37:39 am
Working in macOS
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 23, 2019, 05:57:05 pm
@Lainz: super! 8)

I implemented this solution in the game project — now it should work on all mentioned platforms and systems (on macOS should at least show the window on the screen). I attached improved version of the source code in the attachment, so you can test it on any system.


So, there are two things to test — frames rendering on macOS (should work at least the same as on the Linux, slow but properly, without any glitches) and the timing on any Unix-like systems (should maintain fixed 60fps if the load counter is below 100%, if not, the lower value of the framerate).

Built-in cheat mode is enabled by default, so the load and framerate counters will be visible from the very beginning. If you want, take a screenshot of in-level gameplay (in game menu or in the level) and provide it in the post. Feedback is welcome.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 23, 2019, 09:34:42 pm
MacOS 32 bit it loads but keyboard is not supported (see console errors). Bad graphics like yellow instead of gray and no transparency of pink color.

MacOS 64 bit, it just exit the app.

Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 23, 2019, 09:35:17 pm
Yellowish  :o
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 23, 2019, 10:50:58 pm
A bit OT and a little stupid (maybe) but, can you edit the title of the thread? Each time I save the page the file ends up with an invisible something in front of the name (before the D in "Deep").

To be clear: It's the topic name I mean, not the zip downloads.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 23, 2019, 10:59:12 pm
MacOS 32 bit it loads but keyboard is not supported (see console errors).

If the widgetset does not support the GetKeyState then I can not adapt the code for the macOS. The problem with colors is not serious — just bad order of the color components, probably RGBA will be correct. If you want, just go to the Platformer.Types.pp unit to the line 37 and change the order of TBitmapPixel record fields (try to find correct order of four components).


@lucamar: I do not know what you mean — there is no "strange something" before the Deep word in the title (at least I do not see this). But I edited the first post of this topic so maybe it is just gone.

BTW: can you test the game on Linux or other non-Windows system? 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lainz on April 23, 2019, 11:40:55 pm
I tested on Ubuntu 64 with VirtualBox and works fine.

Maybe due to keyboard layout I can't set the zoom, but the game runs ok.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: lucamar on April 23, 2019, 11:43:00 pm
BTW: can you test the game on Linux or other non-Windows system? 8)

I'm quite swamped now with not one but two medium sized apps for OpenBSD (which means I'm learning *BSD on the run :) ) but I may be able to dedicate some time to this on the weekend. Or if I find myself free for a few hours. Or relaxing after the Nth try to install Lazarus in OpenBSD :)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on April 24, 2019, 12:48:27 am
Ok, thank you guys. Until now, I will let go of macOS, due to the lack of GetKeyState implementation. 8)

So, in that case, if someone wants to help and join a group of testers, then the latest sources are in this post (https://forum.lazarus.freepascal.org/index.php/topic,44908.msg318665.html#msg318665). So I am asking for game tests on Windows, Linux, BSD and Solaris. Should work properly on any of this systems.

If this is the case, then the work related to the source code is considered completed.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on May 01, 2019, 11:56:57 pm
Small update — I added something cute. 8)

Until now, the gates were not visible until the hero entered them — label for the purpose of the gate was displayed. The gates were to be finally decorated with platform details, but it would be difficult to find them anyway.

So I added a jumping arrow over each of them, thanks to this, it is always known where they are. If the gate is on the floor, the arrow is visible above it. If it is on the ceiling, the arrow is below. And if the gate is in the air, two arrows are visible — one above and one below. Video:

- Deep Platformer — gate markers.webm (https://4programmers.net/Forum/Download/23294)

If someone would like to play with a new feature, the latest sources are in the attachment. Screenshot for preview as well. Feedback is welcome, as always.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: RAW on May 09, 2019, 12:22:22 am
Nice minimalistic style! Thanks for the source ...  :)
// funny fps rate ... if I set the window to full screen, then the fps is going down ... ?

// LOAD usually between 35% and 47%, mostly 39-40%

LAZARUS 2.0.2 FPC 3.0.4 // RELEASE x64

WINDOWS 7 SP1 x64
NOTEBOOK Asus G73SW-TZ150V
CPU COREi7-2630QM 4x2.0 GHz
GPU NVIDIA GTX 460 @ 1920x1080
RAM 16 GB @1333
SSD 250 MB/s
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on May 09, 2019, 01:34:18 am
Nice minimalistic style! Thanks for the source ...  :)

Thanks for the test and you're welcome — sources of such a project should be free and open. 8)

Quote
// funny fps rate ... if I set the window to full screen, then the fps is going down ... ?

I see that you tested a special version, with printing the framerate on the console window. That's right, the larger the window is, the longer it takes to render the frame on its canvas — it is natural.

The game is working in this way, but only this special version for test the performance. Regular version maintain (by default) 60fps all the time — it's latets sources are in the attachment two posts above.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on May 13, 2019, 06:11:24 pm
Another update — I changed the timer code.


Earlier on Windows, the game consumed all available power of one processor core. Currently, the clock class uses the Sleep procedure to wait between frames, which saves power. And this clock mode is now the default mode on this platform.

However, using the Sleep procedure makes framerate easier to destabilize and thus reduce the smoothness of the animations. Therefore, the clock has an additional mode that does not use the Sleep procedure — as before, it eats all the core power. The advantage is that the framerate is very stable.

Both clock modes were tested on three laptops, with WinXP 32-bit, Win7 64-bit and with Win10 64-bit — everywhere worked excellent. So, it was a good improvement.

The clock mode can be defined using the run parameters. A light clock is set up like this:

Code: Pascal  [Select]
  1. > platformer.exe clock light

and the precise clock like this:

Code: Pascal  [Select]
  1. > platformer.exe clock precise

On Unixes, the clock parameter is not used, so even if passed, it is ignored. On these systems, the game always uses high precision measurements and saves the CPU power, thanks to FPNanoSleep procedure.

The second function that saves the processor's power is a new way of making delays between frames when the game is stopped (using the F2 key or after deactivating the window). Currently, the Sleep(100) is used, so the CPU load in such a situation does not exceed 2%. And this behavior applies to all platforms.


Fresh sources in the attachment — fell free to test. 8)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: Handoko on May 13, 2019, 06:34:27 pm
Tested on Lazarus 2.0.2 64-bit GTK2 on Ubuntu 19.04.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on May 14, 2019, 12:04:42 am
Thank you @Handoko for tests — looks very good. 8)

Probably the new clock code was the last source code improvement. Only the content remains.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on May 28, 2019, 11:51:09 pm
I have new version of the game to test. 8)

I added animated hints with information about used cheat mode options and additional meter, which shows the data size on the heap. And the third feature is the new animation, which is displayed after pressing the F4 button. This animation imitates turning off the TV — it looks cute.

Here is the short video, that shows the new features: Deep Platformer — new features.webm (https://4programmers.net/Forum/Download/23631)

Fresh source code in the attachment. Feel free to test and comment.
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: nouzi on May 29, 2019, 09:08:02 am
yes is work   O:-)
Title: Re: Deep Platformer — looking for people for cross-platform testing
Post by: furious programming on May 29, 2019, 03:21:19 pm
Super, thanks for test. 8)

I'll write some more code. All because currently the game outro is a regular, simple movie. Ultimately, I want this scene to look a bit nicer. A background in the form of a level (probably scrolled) with a visible hero and fireflies, and subtitles appearing at the bottom of the screen.


I have to stop adding small features and focus on creating content. If this continues, I will never finish this game…