PureBasic Forum
http://forums.purebasic.com/english/

Grabbing sprites
http://forums.purebasic.com/english/viewtopic.php?f=16&t=70811
Page 1 of 1

Author:  dger [ Sun Jun 03, 2018 3:19 pm ]
Post subject:  Grabbing sprites

Hello to all,
I noticed that grabbing many sprites (about 300), even if used only a part, the screen refresh slows down. How is it possible?

I have a medium power computer (core i7, HD4000) so I do not understand how it is possible ...

I used sprite as tile to draw the screen, is this approach correct?

Many thank's.

Author:  Fig [ Sun Jun 03, 2018 3:28 pm ]
Post subject:  Re: Grabbing sprites

It has nothing to do with your hardware, grabbing 300 sprites is probably the wrong way to go.

If you use these grabbings to create tiles, you probably should do it before the main loop of your game.
But it's hard to say without any code to know for sure what you are doing wrong...

Author:  dger [ Mon Jun 04, 2018 5:03 pm ]
Post subject:  Re: Grabbing sprites

Fig wrote:
It has nothing to do with your hardware, grabbing 300 sprites is probably the wrong way to go.

If you use these grabbings to create tiles, you probably should do it before the main loop of your game.
But it's hard to say without any code to know for sure what you are doing wrong...


Hello,
thank you very much for your reply.
Actually the grab is done outside the main loop, which is why I'm a bit confused.

My game is 3000 lines so it is a bit difficult to extract a piece of code to show the problem, but I will try asap ...

Author:  IceSoft [ Tue Jun 05, 2018 7:23 am ]
Post subject:  Re: Grabbing sprites

Small hint:
Don't call this" outside procedure" in the game loop ;-)

Author:  dger [ Sun Jun 10, 2018 9:09 am ]
Post subject:  Re: Grabbing sprites

IceSoft wrote:
Small hint:
Don't call this" outside procedure" in the game loop ;-)


No, I do not call that procedure from within the main loop, it's one of the first things I've checked.

However, I write a very basic example of my loop, grabbing 1000000 (one million) sprite and I have a rock solid 60fps. So, I'm doing something really wrong, that I can not find.

I think I have to start from scratch.

Author:  Fig [ Sun Jun 10, 2018 5:41 pm ]
Post subject:  Re: Grabbing sprites

At less you can conclude: grabbing sprites outside main loop is not the issue you are looking for...

Author:  dger [ Sun Jun 10, 2018 7:53 pm ]
Post subject:  Re: Grabbing sprites

Fig wrote:
At less you can conclude: grabbing sprites outside main loop is not the issue you are looking for...


The strange things is that more sprite I grab more slower is the refresh, then is somethings sprite related. Main loop is 500 lines, so I I have to work a lot to figure out the bug...... :)

Thanks guys

Author:  bfernhout [ Mon Jul 09, 2018 8:44 pm ]
Post subject:  Re: Grabbing sprites

Hey.

I think that your problem is not the program or the way you program. I think its more the memory you have. How big is it. If you have e.g. 4 GB With a 64 bits system. Then you program wil slow down at a point of amounts of sprite you use.

I have a example from Jamie who made 39000 cubes in a 3D world. And let it rotate. Building the cubes takes on his system like 25 seconds. and then every rotation move takes 1 sec. On my system the startup time takes 5 sec and the rotation of the cubes take a good 60 FPS. But his sytem is win 10 64 bits but 8 gb. My system is win 10 64 bits I.7 and 32 GB Actual using 28 GB the rest is in reserve????.

Anyway A second idea can be how big are the sprites. The bigger the sprite the more internal memery you need. Unles you make child sprites than the amount of memory is less.

An idea is, try turn of some parts of the program. And try to find the time the loop takes. Exclude differend parts en see what happend with the cycle time. A large main loop must not make the differend. Maybe there is a piece of the program that do something that takes up to many time.


Bart.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/