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.

2D All the way! / Why does my everything look slow?

Author
Message
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 09:07
Ok, at the beginning of my code i have:
"set display mode 800, 600, 32"
now it seems that everything is a little bit slower...
i've looked at other programs this mode and they seem fine. Y is mine doing that?

http://esotericbasic.dbspot.com
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 09:08
hahaha, i just realized what i put for the title. sry about the bad grammer

http://esotericbasic.dbspot.com
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th May 2004 18:11
You must have a slow computer if 800*600 is slow.

EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 21:29 Edited at: 29th May 2004 21:30
actually, my computer is very fast! i have 1 gb of ram, and a 2.6 processor duel threading, and 800 mb bus speed. =)

http://esotericbasic.dbspot.com
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 29th May 2004 22:09
but what spec is the video card?, if you say "intel extreme graphics" I will just laugh a lot at the gullibility of man and explain your folly, then again it could be your code thats at fault, but I suspect you have a puny video card, if you have a decentish video card then you might have the sync rate set too low, set this in your game loop

text 50,50,str$(screen fps())

and see what framerate you are getting, it could just be subjectivly that you see a slowdown, there may not actualy be a slowdown at all.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 22:16 Edited at: 29th May 2004 22:19
i really don't remember what my video card is but i know it has 128 megs on it

it says my fps is 13! wtf is going on!

http://esotericbasic.dbspot.com
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 22:22
ok, now i just did something and it brought it to 18-19 fps

i had (sin(X) * 40) as an equation and all i did was put int infront of it
int(sin(X) * 40

http://esotericbasic.dbspot.com
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 29th May 2004 22:49
integers are way faster than floats to work with, especialy in repetitive routines that use those values a lot, thats just normal code optimisation, did you use sync on and sync rate at the start of your code? if you used the DB default automagical sync then your code will run at glacial pace (default autosyncing is very slow), always start code with

sync on: sync rate 0

then place a sync at the bottom of the main loop, you can alter the zero to a different value if the code is going to fast (40-50fps is usualy a good speed), cheers.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 22:52
i put the sync rate at 0, then at 30 and it's still at 18...

http://esotericbasic.dbspot.com
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 22:55 Edited at: 29th May 2004 22:56
here's my code, is there anything i can do to make it faster?



http://esotericbasic.dbspot.com
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 22:58
I'm thinking it's becuase i use alot of functions, i noticed sometimes that when i use functions, the code goes slower then if i were to use subroutines

http://esotericbasic.dbspot.com
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 23:18
ok, now i just put the screen back to the original size (640x480) and it's still the same size... is it the coding then?

http://esotericbasic.dbspot.com
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th May 2004 23:18
It's nothing to do with functions - functions are *not* slow.

The reason this code is slow is because of all the font size changes in your loop. Instead of doing this, why not pre-draw the text, grab it all in an image, then display as needed?

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 29th May 2004 23:38
that would work, but how would i make it look right. Because the background is scrolling and then i take the image from that, wouldn't it look weird? do you know what i mean?

and how would i take the image of that, i never used that b4?

http://esotericbasic.dbspot.com
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 30th May 2004 00:10
i was reading through the "get image" command and it says it gets the image from the current bitmap. i'm not using a bitmap, the background is also an image, not a bitmap.

http://esotericbasic.dbspot.com
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 30th May 2004 16:41
bitmap 0 is the current(default) screen, just copy images from bitmap 0 and all should be well , you can make other bitmaps to use as scratchpads or stores for larger images to work with, for example you could write all your test to bitmap 1 and then copy it over to bitmap 0 (the screen) as you need it, or assign it to a sprite or anything else you would find usefull.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 30th May 2004 21:04
wow, great! thanks, everything is running between 35-40 fps now.

What's lock pixels? how can i use that with the menu to make it go even faster? (also for other things i'll need it for in the future)

http://esotericbasic.dbspot.com
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 30th May 2004 22:12 Edited at: 30th May 2004 22:14
and another thing...



So instead i can just do




How come when ever i do that (i'm trying to save code lines so i just save the bitmap then i can load it later), the image comes out all stretched too much on both axis

http://esotericbasic.dbspot.com
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 30th May 2004 23:46
hey

just add another 1 onto the load image command

for example

load image "some_image.bmp", image_number, 1

so yours would be: load image "bitmaps/menu_Item.bmp", 3, 1

in DBP images are mimmaped automatically so you have to asign another flag of one to turn this feature off

hope i helped
EvilKnuckles 666
22
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 31st May 2004 00:26
i put that extra 1 there, but nothing changed, it still saved the image too much stretched on both axis..

http://esotericbasic.dbspot.com
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 31st May 2004 18:38
hmmm

not sure about this but i think their is bug within DBP's save image command - i think i've heard this somewhere???

anyway try this:
instead of saving as an image make a memblock from the image then save the memblock to a file then when you need the image load file with the memblock in and make the image from the memblock

another easier way is display the image on screen you want to keep, hit the print screen button on the keyboard, goto an art appliction (ie mspaint) and paste the image from the clipboard into the art package and save it from there

try these out, i think one of these solutions should solve your problem

anyways post back to see if it does solve it

pizzaman
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 2nd Jun 2004 11:36 Edited at: 2nd Jun 2004 11:37
Evilknucles 666,

(IanM I didn't see your response at first)

The INK command is a "cpu cycle eater". Believe it or not it's faster to have your fonts loaded as images. I don't believe that the INK or TEXT commands are able to take advantage of your Video Card acelleration.

As a test first just remove all of your INK commands in the main loop. What's your FPS now?

It will increase tri-fold if you do away with the text commands as well. Either write your own Blit(text) routine and/or extract all of letters, for each font, and color as images.

Optionally, less of a headache:
If you can, paste the "Words" as either sprites or images you should see an increase.


Login to post a reply

Server time is: 2026-06-09 13:56:08
Your offset time is: 2026-06-09 13:56:08