Recent

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

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #75 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  :)

furious programming

  • Hero Member
  • *****
  • Posts: 853
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #76 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, 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.
« Last Edit: April 13, 2019, 08:28:05 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #77 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 :(

furious programming

  • Hero Member
  • *****
  • Posts: 853
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #78 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)
« Last Edit: April 15, 2019, 10:42:10 am by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #79 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. :)

furious programming

  • Hero Member
  • *****
  • Posts: 853
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #80 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)
« Last Edit: April 15, 2019, 01:55:40 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #81 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/

furious programming

  • Hero Member
  • *****
  • Posts: 853
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #82 on: April 15, 2019, 01:47:39 pm »
Wow, I made a typo... fixed.

Edit: I replaced the attachment in the previous post. Thanks!
« Last Edit: April 15, 2019, 01:55:08 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #83 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 !

furious programming

  • Hero Member
  • *****
  • Posts: 853
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #84 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.
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #85 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
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #86 on: April 16, 2019, 01:59:36 am »
I get this on MacOS, fpc and lazarus trunk.

furious programming

  • Hero Member
  • *****
  • Posts: 853
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #87 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.
« Last Edit: April 16, 2019, 03:21:20 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

furious programming

  • Hero Member
  • *****
  • Posts: 853
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #88 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.
« Last Edit: April 18, 2019, 11:35:22 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #89 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.

 

TinyPortal © 2005-2018