DisplayTransparentSprite is taking too long to process

Advanced game related topics
ricardo_sdl
Enthusiast
Enthusiast
Posts: 109
Joined: Sat Sep 21, 2019 4:24 pm

DisplayTransparentSprite is taking too long to process

Post by ricardo_sdl »

Hi!
In this particular computer, here are the specifications:
Operating System
Windows 10 Pro 64-bit
CPU
Intel Core i5 3330 @ 3.00GHz
Ivy Bridge 22nm Technology
RAM
8,00GB Dual-Channel DDR3 @ 798MHz (11-11-11-28)
Motherboard
PEGATRON CORPORATION IPMH61P1 (SOCKET 1155)
Graphics
DELL E1911 (1440x900@64Hz)
Intel Adaptador de Vídeo Básico da Microsoft (Unknown)

PureBasic 5.71 LTS (Windows - x64)

I'm drawing a map that is 20x15 tiles, each tile is 16x16 pixels. The tiles are zoomed by a factor of 2 (making them 32x32 pixels), and the screen resolution is 640x480 pixels. Drawing the 300 tiles in the screen is taking on average 10 ms, which is making the movement sluggish. Here is a link with the source code for download:
https://drive.google.com/open?id=1B5u6M ... LxLOmJL7nr

You can move the sprite with the arrow keys. Why would DisplayTransparentSprite take so long to draw the tiles?
Thanks.
You can check my games at:
https://ricardo-sdl.itch.io/
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: DisplayTransparentSprite is taking too long to process

Post by Mijikai »

Are u sure u have the debugger disabled?
For me its faster than 1 ms !

My quick test:

Code: Select all

Procedure Draw()
  Protected clk.q
  TimeTaken = 0
  clk = ElapsedMilliseconds()
  For i.a = 0 To MapWidthInTiles - 1
    For j.a = 0 To MapHeightInTiles - 1
      DungeonMapSprites(i, j)\DrawSprite(@DungeonMapSprites(i, j))
      
    Next j
  Next i
  SetWindowTitle(0,Str(ElapsedMilliseconds() - clk))
  Heroine\DrawSprite(@Heroine)
  For i.a = 0 To 1
    For j.a = 0 To 1
      PaddlesSprites(i, j)\DrawSprite(@PaddlesSprites(i, j))
    Next j
  Next i
EndProcedure
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: DisplayTransparentSprite is taking too long to process

Post by Fred »

the integrated GFX card is probably very slow, as this is a very basic drawing operation and should be very very fast. Or may be a driver issue. You could try to switch to OpenGL subsystem to see if it does a difference
User avatar
Bisonte
Addict
Addict
Posts: 1226
Joined: Tue Oct 09, 2007 2:15 am

Re: DisplayTransparentSprite is taking too long to process

Post by Bisonte »

he has no driver installed... Normally it's Intel HD Graphics 2500.

Driver (Intel) : https://downloadcenter.intel.com/de/dow ... duct=65509 (Sorry ... german language)
PureBasic 6.04 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
ricardo_sdl
Enthusiast
Enthusiast
Posts: 109
Joined: Sat Sep 21, 2019 4:24 pm

Re: DisplayTransparentSprite is taking too long to process

Post by ricardo_sdl »

@Mijikai: Debugger or not debugger I got more or less the same result.

@Fred and @Bisonte: It could be some weak ass onboard graphic with no driver issue! I'll try to install the drivers and report back.

Thank you all for now!
You can check my games at:
https://ricardo-sdl.itch.io/
ricardo_sdl
Enthusiast
Enthusiast
Posts: 109
Joined: Sat Sep 21, 2019 4:24 pm

Re: DisplayTransparentSprite is taking too long to process

Post by ricardo_sdl »

It was a driver issue! I installed the video drivers as suggested and the rendering is fast now. From now on I might be able to suggest this if someone complains about the slowness. Thanks :D
You can check my games at:
https://ricardo-sdl.itch.io/
Post Reply