AGK - Getting worse over time?

Started by Qube, July 27, 2019, 02:44:05

Previous topic - Next topic

Dabz

I updated to that 2019.08.1 Classic AGK whatsits face, I cannot see any difference on anything me, to be fair though, I'm just farting about and not looking, but, I've had post-jollybob blues, and doing the update it has made me implement some collapsible tiles on my Dizzy thing, so there's a bonus really!  :D

Dabz

Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Rick Nasher

Hmm.. confusing.

Tried latest Studio: Now with vSync on getting a mere 28-30fps, without it, it runs at 280-360fps. Appears lot less stabilized, constantly varying.
_______________________________________
B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________

Qube

QuoteI updated to that 2019.08.1 Classic AGK whatsits face, I cannot see any difference on anything me, to be fair though, I'm just farting about and not looking
Well you're a bag of useless if you're not even watching :P

Quoteand doing the update it has made me implement some collapsible tiles on my Dizzy thing, so there's a bonus really!
OK, ya forgiven, keep at it ;D

QuoteHmm.. confusing.

Tried latest Studio: Now with vSync on getting a mere 28-30fps, without it, it runs at 280-360fps. Appears lot less stabilized, constantly varying.
AGK hates your PC :P - Have you tried the shiny new #renderer commands to see if the "fix all" Vulkan does something magic?
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Steve Elliott

#63
Quote
Tried latest Studio: Now with vSync on getting a mere 28-30fps, without it, it runs at 280-360fps. Appears lot less stabilized, constantly varying.

Hmm AGK/AGK Studio does seem to have become inconsistant across machines, which is a concern.  Rick said he'd speak to Paul about Qube's thread over there.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

plenatus

@Rick N.: what a machine do you have? I have more fps on my lowend laptop.

TomToad

This is interesting.  Looked back in the thread and saw  Rick Nasher's specs
QuoteHowever I now tested on my new laptop(i7-7700HQ@2.80GHz, 8GB, GTX1050, 512GB SSD, W10H V1903 x64)
Which is far better than mine.
QuoteWindows 10 Home 64 bit v1803
AMD A8-6410 2.0ghz with AMD Radeon R5 graphics
4 GB Ram
512 GB SSD
Yet, he is getting worse performance than I am.  Apparently worse than c0d3r9 as well.

taking a look at Qube's sample code, I noticed that he uses DrawSprite() and DrawText().  Using DrawSprite is like using DrawPixmap in BMax, very slow.  I rewrote Qube's example to eliminate DrawSprite() and now it runs twice as fast with 2019.6.11 (the only version I have installed on my laptop right now).  I also slowed down the update for FPS, so it is easier to read.
//
// FPS drop and juddering since AGK Classic 2018-07-12
//
// press 'S' to toggle vsync on / off to see speed drop after AGK Classic 2018-07-12
// press ESC to quit this exciting thing
//

SetErrorMode( 2 )
SetWindowSize( 1920, 1080, 1 )
SetVirtualResolution( 1920, 1080 )
SetDisplayAspect( 1920.0 / 1080.0 )
SetOrientationAllowed( 0, 0, 1, 1 )
SetRawMouseVisible( 0 )
SetRandomSeed ( GetUnixTime() )
SetVSync( 1 )
SetClearColor( 0, 0, 0 )
SetDefaultMinFilter( 0 )
SetDefaultMagFilter( 0 )
UseNewDefaultFonts( 1 )

Type tBall
x As Float
y As Float
speed As Float
size As Integer
EndType

Local ball As tBall
Local balls As tBall[]

Local tempImage, ballSprite, vSync, FPS

ballImage = LoadImage( "ball.png" )
vSync = 1

CreateText(1, " FPS : " )
SetTextPosition( 1, 0, 0 )
SetTextSize( 1, 30 )

For count = 1 To 200
ball.x = Random( 0, 1919 )
ball.y = Random( 0, 1079 )
ball.speed = Random( 1, 6 ) + ( Random( 1, 50 ) / 100.0 )
ball.size = Random( 32, 32 * 4 )

balls.insert( ball )
CreateSprite(count,ballImage)
SetSpriteSize(count,ball.size,ball.size)
Next

frametime as float
framesPerSecond as float
MaxFPS as float
Repeat
frametime = frametime + GetFrameTime()
If GetRawKeyPressed( 83 )
vSync = 1 - vSync

If vSync = 0
SetSyncRate( 5000, 0 )
SetVSync( 0 )
Else
SetVSync( vSync )
EndIf
EndIf

For count = 0 To balls.length
SetSpritePosition( count+1, balls[ count ].x, balls[ count].y )

Inc balls[ count ].x, balls[ count ].speed
If balls[ count ].x > 1920 Then balls[ count ].x = 1920 - balls[ count ].x - balls[ count ].size
Next
framesPerSecond = ScreenFPS()
if framesPerSecond > MaxFPS
MaxFPS = framesPerSecond
endif
if frametime >= 0.5
frametime = 0.0
SetTextString( 1, " FPS : " + str(MaxFPS ) )
MaxFPS = 0
endif
//DrawText( FPS )

sync()
Until GetRawKeyPressed( 27 )

This might also explain why Rick Nasher gets worse performance.  Possibly his drivers are not optimized for pushing images over the bus continuously.  @Rick, maybe give this version a try, see if performance improves.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Steve Elliott

#66
Runs about the same speed here (although sometimes 1800, rather than the 1700 before) however reading the FPS value is a lot easier than it was.  Either way the FPS varies by quite a margin, rather than a constant rate (sometimes around 1400 FPS).
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

plenatus

Its very mysterious.
On my laptop all three builds runs near the same speed(around 380fps, lower than i used qubes code) but all three have stuttering/flickering and tearing with vsync on.(with vsync off its to fast ;) =
On my Ryzen now both AGKC builds runs a little bit faster like before.Around 525fps.
The studio build the same like before.(vulkan)
But on my Ryzen no stuttering/flickering and tearing.

Now i test the new commands and try opengl on my ryzen.....
Okay thats crap....380-400fps! Remember, AGKC could to it with more then 500fps.
Opengl with ryzen is the same speed like on my lowend laptop.Aaand stuttering as well.

Its indeed a big opengl issue.

TomToad

For those of you who are getting incorrect sync rates (i.e. 60 fps on a 75hz monitor) or getting a lot of tearing with vSync on,  try making a couple of changes to Qube's code and see what happens.  First, after line 14, put SetSyncRate(0,0).  Put it after SetRandomSeed ( GetUnixTime() )
but before SetVSync( 1 )
Then, around line 55, remove the SetSyncRate(5000,0) line.
Now compile and run the code.  See if you get the proper  fps and if the tearing is eliminated.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Derron

@ c0d3r9
If you have BlitzMax NG installed, you could try my NG port to check if it is an AGK, OpenGL or DirectX issue.


bye
Ron

plenatus

@Derron: The problem of flickering/stuttering have many other engines/frameworks too, it seems its a combination of opengl/synchronization to display issue.
I donĀ“t know right.I saw that behaviour not only with AGK and on different machines.
Except DX, but i think dx uses(most in past) vsync as a standard and so some ugly things never happen.
The FPS issue is clearly a AGK Studio opengl problem.

@TomToad: Of course it makes not really a difference.Except you have a machine that can run faster then 5000fps
And for speed SetSyncrate(0,1) is better.
Btw. But right, the code is shorter and no need to set the syncrate twice.

Derron

#71
I am aware of the "stuttering". It was more about the "raw fps" for the very same "test game logic". BlitzMax' Max2D uses immediate rendering (though there is some bufferedGLmax batching stuff). Maybe AGK does something not every computer likes - some shader processing, a borked up cache (refilled everytime) or something similar.

For the ones interested in something more:
https://gpuopen.com/archive/gpu-perfstudio/
https://github.com/baldurk/renderdoc

or as suggested by a fellow forum member:
https://apitrace.github.io ("easy" but not for vulkan)


bye
Ron

Qube

QuoteUsing DrawSprite is like using DrawPixmap in BMax, very slow.
No it's not :P
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Steve Elliott

#73
That was my understanding too, I thought it was the same as only making particular sprites visible (drawn) rather than hiding lots of sprites.  If not then that's rather stupid.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Steve Elliott

#74
Quote
Its indeed a big opengl issue.

No it's not!  AGK has been running on Opengl from day one, but getting slower and slower - and more jittery.

Paul has responded to your thread Qube.  Maybe ask him about DrawSprite too.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb