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! / bitmap size

Author
Message
glint
22
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 28th Apr 2004 06:33
I have developed a way to have a side-scrolling game that reconstructs itself constantly from a tilesheet(s). This requires bitmap 0 (the screen), which is 800x600, an intermediate bitmap (1000x800), and a tilesheet or two (600x500).

Will this many large bitmaps slow my program down drastically? If so, is there an alternative to large bitmaps?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2004 11:19
No they won't slow your program down much. But there is an alternative that is faster. You can texture plains with the bitmap images, and move the camera. Your way is fine though, so if you don't want to change it then keep it how it is.

glint
22
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 29th Apr 2004 07:50
Texturing plains sounds good. Is there a way to paste images straight from a bitmap onto a plain, though?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Apr 2004 11:30
Pseudo code......

Load Image "Bitmap.bmp",ImageNo

Make Plain.........same size as image.

Texture plain with image.

glint
22
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 30th Apr 2004 06:38
I tried using the scrolling engine just with the bitmaps. Basically I took the tilesheet (bitmap#1), used the array, and pasted 100X100 pieces across the 1000X800 bitmap (bitmap #2). I then created a loop where the keys increased an x and y value. In the end of the loop these values were used in a statement that pasted an 800X600 portion of the #2 bitmap to the screen. I had already set the resolution of the screen to be 800X600.

My problem is that the scrolling this produced was very slow. It went at about eight frames per second. This happened when I set sync rate to 10, 30, 45, 60, and 120.

Do you know what's going on?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2004 11:15 Edited at: 30th Apr 2004 11:17
Are you pasting tiles during the loop? Don't know without the code. Maybe you just need to increment X by 2 or 3 instead of 1.

the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 30th Apr 2004 19:01
Get rid of the second bitmap and just paste the individual tiles directly to the screen.

i won't see you in the pit
glint
22
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 1st May 2004 09:39
Here's my code.

(beginning of code)

sync on
sync rate 60
hide mouse
load bitmap "c:\documents and settings\dp\desktop\greg\blob.bmp", 1
create bitmap 2, 1000, 800
xiny=0
yiny=0
dim world(8,6)
for a=0 to 9
for b=0 to 7
world(a,b)=rnd(2)
z=(world(a,b)/5)
copy bitmap 1, 100*(world(a,b)-5*z), 100*z, 100*(world(a,b)-5*z)+100, 100*z+100, 2, 100*a, 100*b, 100*a+100, 100*b+100
next b
next a
do
if leftkey()=1 then inc xiny, 5
copy bitmap 2, xiny, yiny, xiny+900, yiny+700, 0, 0, 0, 800, 600
sync
loop

(end of code)

Please try it to see if you get a working result. "Blob.bmp" should be bitmap that is split into 100X100 tiles and is 500 pixels wide (the tilesheet could be any size, but the code here is set for a 500-wide one).

I've noticed that this code only works if I set the screen res to 800X600. The scrolling created is always very slow, no matter what sync rate is set to, and sometimes the tiles do not even appear. These are only some of the many strange things that happen to me when I try to use this code. If anyone knows what I'm doing wrong, please help.

Note : the variable z is just a way to make the bitmap pasting procedure last operational. If you substitute it into the copy bitmap statement, it makes sense.

To the_winch : Pasting tiles was part of my original plan, but the formula for pasting tiles is much more computational. When I use an intermediate 1000X800 bitmap, which is screensize with 100 pixel borders, I only have to go through the tile-pasting sequence every 100 steps. I'm assuming this ends up being faster. I'm not sure, because it hasn't worked yet.
The Holy One
22
Years of Service
User Offline
Joined: 12th Jan 2004
Location: Sweden
Posted: 1st May 2004 10:15 Edited at: 1st May 2004 11:03
dim world(8,6)
for a=0 to 9
for b=0 to 7

You dim an Array 0 to 8, 0 to 7 but you try to enter values into an array of 0 to 9, 0 to 7.

this can't be right can it?



Fixed it see if you can see what's different.
glint
22
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 2nd May 2004 07:21
True, that is an error, but when it is remedied it does not fix the problem. The scrolling continues to be horribly slow.
The Holy One
22
Years of Service
User Offline
Joined: 12th Jan 2004
Location: Sweden
Posted: 2nd May 2004 07:26 Edited at: 2nd May 2004 07:27
I fixed that too take a look at the code

Login to post a reply

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