Recent

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

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #60 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.

lucamar

  • Hero Member
  • *****
  • Posts: 2075
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #61 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.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

nouzi

  • Full Member
  • ***
  • Posts: 139
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #62 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

my english is  bad
Lazarus 2.0 free pascal 3.0.4
Lazarus trunk  free pascal trunk 
System : windows 7 64bit

lucamar

  • Hero Member
  • *****
  • Posts: 2075
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #63 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
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

nouzi

  • Full Member
  • ***
  • Posts: 139
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #64 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
my english is  bad
Lazarus 2.0 free pascal 3.0.4
Lazarus trunk  free pascal trunk 
System : windows 7 64bit

nouzi

  • Full Member
  • ***
  • Posts: 139
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #65 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

« Last Edit: April 11, 2019, 11:58:52 pm by nouzi »
my english is  bad
Lazarus 2.0 free pascal 3.0.4
Lazarus trunk  free pascal trunk 
System : windows 7 64bit

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #66 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 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.
« Last Edit: April 12, 2019, 12:53:24 am by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #67 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.

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #68 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.
« Last Edit: April 12, 2019, 06:35:29 pm by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #69 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  :-[
« Last Edit: April 12, 2019, 11:15:32 am by Thausand »

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #70 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.
« Last Edit: April 12, 2019, 06:36:08 pm by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

lucamar

  • Hero Member
  • *****
  • Posts: 2075
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #71 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 )
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #72 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 (from 20th second). If the framerate drops, then the game should work like on the recording, instead of running smoothly.
« Last Edit: April 12, 2019, 06:49:46 pm by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #73 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.

furious programming

  • Sr. Member
  • ****
  • Posts: 354
  • I click a little.
Re: Deep Platformer — looking for people for cross-platform testing
« Reply #74 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
« Last Edit: April 13, 2019, 12:20:04 am by furious programming »
Lazarus 2.0.4 with FPC 3.0.4, Windows XP (all 32-bit)