Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Why are sprites so slow ? Please help!

Author
Message
alterego
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location:
Posted: 20th Mar 2004 20:04
Here is a simple codeexample:

======================================================================
set display mode 800,600,32

set window size 800,600
set window position 1,1
set window layout 1,1,1
set window title "Ball"
set window on

sync rate 0 : sync on

ink rgb(255,255,255),0 : box 0,0,8,8
get image 1,0,0,8,8
ink 0,0 : box 0,0,10,10 : ink RGB(255,255,255),0
set sprite 1,1,1

richtung=1 : x=0 : y=0
sprite 1,0,0,1

do
y=y+richtung
if (y < 1) or (y > 589) then richtung=(richtung * -1)
sprite 1, x, y, 1
showfps()
sync
loop

function showfps()
ink 0,0 : box 500,80,799,100 : ink RGB(255,255,255),0
text 500,80,str$(screen fps())
endfunction 0
======================================================================

Here i only get 37 fps - but by disabling BACKSAVE it runs with over 700 fps.
Is this a bug, a feature or am i doing something wrong?

alterego
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 20th Mar 2004 20:49
If you want to get more speed, maybe try using 3D renders of 2D using plains
alterego
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location:
Posted: 20th Mar 2004 21:07
RE: A Man Named Matt

I only want to stay in 2D.
A year ago i finished working with DarkBasic, because of the lack of
fast 2D sprites. Now i bought DBPro, because it was stated, that now
sprites are speeded up. Try my little codeexample - this is slower then
DarkBasic. The Backsave routine seems to cause that miserable performance.

alterego
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 20th Mar 2004 21:15
Try this

Set Sprite 1,0,1


We need help! Email us! join@eternaldestinyonline.com
alterego
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location:
Posted: 20th Mar 2004 21:20
Re: Moderator

As i stated, by doing this i get an OK performance with over 700 fps.
But with not using the BACKSAVE function (set sprite 1,0!,1) it makes
nearly no sense using sprites as 2D Objects.
This is a rudimentary 2D sprite feature!

alterego
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 21st Mar 2004 13:37
2D sprites in DBpro are textured 3D plains - so I was told.
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 21st Mar 2004 13:46
take out the set sprite command completely, with your code i get about 4fps when i take out set sprite i get 680fps

In the beginning, the universe was created...
This made alot of people very angry and it has been widely regarded as a bad idea...
Visit http://redeye.dbspot.com
alterego
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location:
Posted: 21st Mar 2004 14:20
RE: Flashingblade
This is a partial explanation for that behaviour, but if 3D is that slow,
no one would be working with it.

RE: ReD_eYe
If i took out the set sprite command, i could not move my sprite.
By using sprite move commands the performance is as bad as set sprite.

alterego
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 21st Mar 2004 14:37
eh? you don't need the set sprite command to move the sprite...


that code does exactly what you've posted above but without set sprite, it runs at 60fps because thats what the sync rate is set at. if you run it with sync rate 0, i get well over 1000fps.
so no performance loss and its doing what you want.

In the beginning, the universe was created...
This made alot of people very angry and it has been widely regarded as a bad idea...
Visit http://redeye.dbspot.com
Gav_b_uk
20
Years of Service
User Offline
Joined: 18th Mar 2004
Location: Midlands, UK
Posted: 21st Mar 2004 15:43
I've just picked up DB for the first time and programmed a space game using 2d sprites....mine runs at a blistering speed if I dont use sync rate. As stated by Red_eye I did use sprite 1,x,y,image....didnt even release how to use the set sprite command.
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 21st Mar 2004 15:50
Backsave is too slow to be of much use, I think most people just clear the screen every loop.
alterego
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location:
Posted: 21st Mar 2004 19:42
RE: ReD_eYe
Sorry, but i was in a hurry and misinterpreted 'set sprite' with 'sprite'.
Now i tried your idea and got 590 FPS with a kind of backsave on.
There is a blue background in the window where no leftovers of the last
sprite position are seen.
What does this effect mean und how is that sprite defined if you do not
use the set sprite command.

alterego
Jadelion
21
Years of Service
User Offline
Joined: 14th Jan 2003
Location:
Posted: 21st Mar 2004 20:38
In DBPro, the default SPRITE command clears its background and has transparancy. (so that you can see through black) The blue background is a reslut of the SPRITE refreshing its background. this clears away the trail it would normaly make(it also has something to do with the fact that DBPro treats sprites more like 3d objects then DBC did). For more information on how to play with sprites check the 2d forum and the code base (there are lots of games using sprites that run great)

...that move was indeed...Bold.
alterego
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location:
Posted: 22nd Mar 2004 10:24
RE: Jadelion
Thank You very much for Your competent help.

alterego

Login to post a reply

Server time is: 2024-09-22 02:28:04
Your offset time is: 2024-09-22 02:28:04