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! / Scrolling on a 2d board game

Author
Message
qwe
20
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 11th Sep 2003 19:52
My 2d game requires a map much larger than the screen area. Is there a way where I can have, basicly, a seperate screen within the main screen? As in, I could paste an image into this screen, but the pixels would be something like 5000 by 3000, but you would view it in the normal resolution, able to scroll around in it. The screen would take up a certain area of the main screen.
thx
TheAbomb12
20
Years of Service
User Offline
Joined: 14th Aug 2003
Location: Amist the blue skies...
Posted: 12th Sep 2003 01:09
are you talking about a mini-map?

Those who Fight with swords get killed by those who don't
JoelJ
20
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 12th Sep 2003 05:06
he means he has a way big map that cant all be displayed on the screen, so he wants it to show a small window so you can scroll around the map

<(^_^<
qwe
20
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 12th Sep 2003 18:43
maybe i should just do this in 3d... no one seems to have much knowledge on 2d board games
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 12th Sep 2003 20:56
You just use copy bitmap using x/y coordinates to copy from the big screen to the small screen. So you have 2 seperate screens.

Pincho.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Sep 2003 23:21
I don't know how much use this will be for you ...

Usually when you have massive scrolling backgrounds they are usually divided into tiles. Each tile is drawn using 1 or more images.

This way, you can reduce the amount of memory used by having identical areas drawn using the same tiles.

Here is a 'map' made from 3 random images and with a centred sprite that points in the direction of travel
qwe
20
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 13th Sep 2003 03:03
I am using DBClassic. I think you are using Pro, IanM, because when I try to run a lot of commands give errors.

Pincho how do i have two screens?
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Sep 2003 04:52
So change it

It should be fairly easy to change to Classic.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 13th Sep 2003 17:09 Edited at: 13th Sep 2003 17:11
Load Bitmap "Background.bmp",1

copy bitmap 1,X,Y,0,X,Y

Pincho.
Mentor
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 13th Sep 2003 18:34 Edited at: 13th Sep 2003 18:35
load bitmap "demonica.bmp",1
xpos=0
ypos=0
do
copy bitmap 1,0+xpos,0+ypos,200+xpos,200+ypos,0,100,100,300,300
if upkey() and ypos>0 then dec ypos
if downkey() and ypos<2800 then inc ypos
if leftkey() and xpos>0 then dec xpos
if rightkey() and xpos<2800 then inc xpos
sync
loop

Mentor.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Sep 2003 01:42
The 'big bitmap' technique ( ) isn't really a great way to do this though. For example, my laptop is limited to bitmap sizes up to 2048x2048. Other cards are similarly limited.
Reaperman
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Kent, England
Posted: 15th Sep 2003 04:30
Hello

I noticed this post and strangely enough I had just done a simple tutorial on the same thing.

As far as I can see, Darkbasic resizes the screen to whatever the picture is, so using load bitmap would not work.
However, another way is to have the background as a large sprite and scroll it about in connection with what key is pressed.

The following example will work with a BMP file tested up to 3500,3500, and will probably work with bigger ones too.

http://www12.brinkster.com/darkbasicode/examples/mapscroll.ZIP

If you want to see this in action, then please download this example and read the rem commands in the program.

I hope that this gives you another way to do what you want.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 15th Sep 2003 12:49
Quote: "As far as I can see, Darkbasic resizes the screen to whatever the picture is, so using load bitmap would not work.
"


The bitmap is being loaded to a screen in memory, not the front screen, so we want DB to change the size of the screen to the huge screen size. Screen 0 will still be small, or at least it should be, I haven't actually checked this.

IanM is right, I wouldn't use a huge screen like this. I would break it into small pieces.

Pincho.
Reaperman
20
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Kent, England
Posted: 15th Sep 2003 17:01
@ Pincho:

"IanM is right, I wouldn't use a huge screen like this. I would break it into small pieces."

Yes, I do agree with you, but my example was to give Chris a way to do what he wanted to do by scrolling a big picture around in one bit, and not using a copy/paste routine.
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 15th Sep 2003 17:42
If it's a board game, I strongly suggest cutting the board into squares and using individual images on plains. For example, if I was making Monopoly, I'd make a big plain for the middle, then make smaller plains for the squares around the board. Once I had these setup like the real monopoly board I'd texture the squares with the relevant images and texture the middle piece with a bigger image. It probably sounds daft to go with 3D, but I recommend it, even if your only gonna show the board as 2D, it's still a good way to do this without slowing the PC to a crawl. If you had DBPro I'd be suggesting the same thing, or using sprites with manually set UV's, but in DBC, 3D is the only decent 2D you can get. Remember the nice effects you could add with ghosted objects too, like highlight glows or sparks, or fireworks etc etc etc.

Probably better in 3D anyhow, go for the players eye view style camera, maybe little cut scenes too - it's not a big deal (in fact it'd work just like a 2D engine except you'd have to position a camera and point it at the board.


Van-B

My cats breath smells of cat food.
qwe
20
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 15th Sep 2003 18:48
Yeah I've been reading up on 3d and I'm going to go 3d.
By the way, the board is made up of hexagons, not squares.

Reaperman, I cannot download the file in the link in your message. It says I need to access it from within the domain, but I can't find it on the site. I went to the code section but there is no section for DarkBASIC.

I think it would be easier to do in 3d anyway, as using the camera to "scroll" is very simple. If I get stuck on the 3d beta I will make it will be another post.

Login to post a reply

Server time is: 2024-05-05 09:47:52
Your offset time is: 2024-05-05 09:47:52