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 / Chessboard

Author
Message
Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 10th Jan 2004 21:59
i am trying to make a board game based on a board that is a little like a chessboard. but am not sure which is the best way to make it. would it b better to use the box commands or to use a matrix to draw the board. any help, suggestions or ideas plz. it does need a 2d feel to it, if i use a matrix can this b used to make a 2d board or will it only hav a 3d perspective?
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 10th Jan 2004 22:08
i would make a model in milkshape or something.....make it flat like a plain to give it that 2d feel.....

hope i helped,
Bishop

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 10th Jan 2004 22:10 Edited at: 10th Jan 2004 22:10
Well, this is one way to draw a chessboard in 2D:



Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 11th Jan 2004 00:02
a matrix with black and white textures would work as well for the 3d touch


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 11th Jan 2004 00:26
thx for help and advice.

can any1 suggest any others programs like milkshape or maybe some links of sites so i can research some programs.

ty again in advance.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 11th Jan 2004 03:29
just build it in DarkBasic

like this

Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 11th Jan 2004 13:11
ty again for the help here. i have altered the code alittle, perhaps some1 could take a look. but the main problem is that i dont understand exactley what is happening here lol. this is only my 2nd day with the progam so dont b 2 hard on me lol. i'd like to go through it step by step if i could, and then maybe some1 could help me out on the parts i dont understand.

sync on
sync rate 0 :- k, i get this, sync on make the prgram responsible for screen refreshing and sync rate 0 sets it to the fastest refresh rate.

make matrix 1,150,150,10,10

first question here is about the width and height.does the width and height relate to anything like pixels or screen size, i mean here i used the values of 150, but does that refer to a size of 150 pixels or is it not related at all?

position matrix 1,-75,-50,0 ....no questions here

ink rgb(0,0,0),1
box 0,0,64,64
ink rgb(255,255,255),1
box 0,0,32,32
ink rgb(255,255,255),1
box 33,33,64,64

oki, i c how the rgb command and values work, but am confused at why there r x3 drawing box commands, and why 1 is 0,0,64,64 and then the others seem to draw half those values.

get image 1,0,0,64,64
.....................not sure what this does.

prepare matrix texture 1,1,1,1
..............................again not sure here.

update matrix 1 k, this updates all changes made to matrix 1.

position camera 0,100,-50
point camera 0,0,0 .......k, again np probs here.

do
sync
loop
......dont understand this part. "do" defines a loop but what is the loop, i mean which line(s) of the code is being looped here?

again any help is much appreciated.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 11th Jan 2004 14:23
width and height are in "units", in 3D I normaly use the rule of thumb 1 unit=1 meter, actualy they could be any scale you like, if you put the camera realy close/low then a box of size 1 looks huge, likewise move the camera back and up enough and increase the camera range and a box of 10000 units looks small, it`s just personal taste for the most part.

the boxes are just drawn over one another to provide a border and concentric effect for the tiles, try drawing it on graph paper and you see what is happening, the 64 creeps in since many graphics cards and DB are happier with textures that are multiples of 2 (eg 2,4,8,16,32,64,128), and smaller sizes use less memory

the get image command makes an image you can use as a texture later on to colour the matrix, it "gets" the image from the bitmap that the boxes where drawn on.

prepare matrix texture..prepares the image we grabbed off the bitmap so that the matrix knows how to use it as texture, makes it from bitmap one, for matrix one, with the image sliced into 1x1 tiles.

all the do/loop does is sync...eg:

do
sync<<<<<<<<just so we can see the screen
loop

all it does is show the screen until the program ends when we press esc, otherwise you would fall back into the editor and most likley not see anything had even happened, hope that some help, cheers.

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 11th Jan 2004 16:01
hmm,k, let me c if i understand this now lol. what this code is doing is drawing 1 large box then drawing 2 smaller 1's inside it to give the effect of creating 4 boxes, then grabbing an image of them then using that image to paste onto the other matrices ?
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 11th Jan 2004 16:54
yup! spot on! (it realy is that easy)

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 11th Jan 2004 17:19
hehe, so this is the next problem i have.

the code:-

for zt=1 to 20
for xt=1 to 20

tx = rnd(3)+1
prepare matrix texture 1,tx,xt,zt

next xt
next zt

i'm trying to randomly texture the matrix using 4 different images. but each time i get the same image being used on all he tiles. i suppose i need the randomize command in here but am unsure how to implement it, or what the seed value should be.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 11th Jan 2004 17:53 Edited at: 11th Jan 2004 17:54
thats because you used the wrong command, prepare matrix texture chops up an image into several equal sized smaller images, look at the help for it (position cursor over the command and press f1), what you need to do is to split up the image once with

prepare matrix texture 1,1,2,2

just the once...outside the loop, and then use the

set matrix tile 1,xt,zt,rnd(3)+1

inside the loop, that should texture the tiles differently, only use randomise (timer()) if you want the tiles to be different for every run of the program, otherwise just leave it as is, cheers.

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 11th Jan 2004 19:41
doh i'm still having problems with this

heres the complete code i am using in this section:-

rem create board
sync on
sync rate 0

make matrix 1,150,150,20,20
position matrix 1,-75,-50,0

load image "grass1.jpg",1,1
load image "snow1.jpg",2,1
load image "sand1.jpg",3,1
load image "water1.jpg",4,1

prepare matrix texture 1,1,1,1

for zt=1 to 20
for xt=1 to 20

set matrix tile 1,xt,zt,rnd(3)+1

next xt
next zt


position camera 0,100,-50
point camera 0,0,0

do
sync
loop


but this returns the following error:- runtime error 7016 - Matrix tile illegal at line 34

line 34 being :- set matrix tile 1,xt,zt,rnd(3)+1

i guess its going to b something simple i have overlooked, but i'm gonna b bald soon if i dont figure it out.

More coffee plz !!!
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 11th Jan 2004 20:34 Edited at: 11th Jan 2004 20:42
try

prepare matrix texture 1,1,2,2

but before you do that, load up a paint app and rescale your images to 128x128, then cut an paste em into one big image as tiles, 2 across and 2 down, then just load the one big image as image 1 and it will work.

Prepare matrix texture will take the one big image and chop it up into 2x2 tiles, giving you back your ariginal four pictures, it has to be done like this since the matrix can only use one image as a texture, so you make all the images into one and then re-set them back to seperate images with the prepare matrix texture command, that chops them back up in a special way that allows the matrix to use more than one image at a time, it`s to do with the way the texture is mapped onto the matrix, so.

load each image and rescale it to 128x128 then save it

load all four images and position them in a 256x256 image like this

12
34

save the big image as a bmp

load the image and then prepeare the texture for the matrix as a 2x2 grid with

prepare matrix texture 1,1,2,2

whats happening is that the command has cut the texture (image 1) up into 1x1 chunks, so there is no texture tile 2,3 or 4 to set the tile to, texture tiles for a matrix are not the same as images, hence the conversion with prepare matrix texture, cheers.

Mentor.



this will work with the correct image in the project folder, test it with a simpler image made in paint 1st, just arrange the image with some text that reads

12
34

then save it and you see what is happening.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 12th Jan 2004 03:16
many thx again here for help and advice. i understand better what is happening and how dbp treats the image and matrices. i did have to make a little alteration though to the tile co-ordinates as i had an error message saying they where illegal. i now presume that "0" (zero) must b the first number in the loop, ie 0-19 not 1-20. also to c what changes had been made i needed an update matrix command as well, i think thats correct.anyways this is what i have now, and it seems to work.

rem create board
sync on
sync rate 0

make matrix 1,150,150,20,20
position matrix 1,-75,-50,0

load image "terrain1.jpg",1,1

prepare matrix texture 1,1,2,2

for zt=0 to 19
for xt=0 to 19

set matrix tile 1,xt,zt,rnd(3)+1

next xt
next zt
update matrix 1


position camera 0,100,-50
point camera 0,0,0

do
sync
loop


so up to here all well and good. next problem i am having is with the randomize command and seed value. i dont understand exactly how this works. i've tried aliitle through trial and error but am unable to get a totaly different map each time i run the code. what i did was put this;-

randomize 4

after the prepare matrix texture and b4 the main loop.but i am still getting an identical map each time i run the code.also dont understand what the seed value is or what it should b. am i correct that the randomize command should b outside the main loop?

More coffee plz !!!
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Jan 2004 20:22 Edited at: 12th Jan 2004 20:32
Use

randomise(timer())

At the start of your code (outside your loop) and the seed will be the time in milliseconds since the computer was turned on, since you can`t start the program to exactly the same number of milliseconds every time you run it (even the windows startup sequence varies a little from startup to startup), the seed will be different every time and the random numbers will be different too.

Computers don`t use real random numbers but a formulae that allows them to create lists of numbers that "look" random, they are actualy a calculated sequence of numbers that normaly repeats after 32767 values (or something like that) have been returned, the seed sets the starting point in the random number sequence, if you use a number larger than the maximum number of values in the sequence as the seed then it just wraps round (so a seed of 32768 might be the same as 1), by using different seeds you can get different sequences of random numbers that will be the same each time the game is run, useful if you want things to act random but be learnable by the player, the sequence would be random, but the same sequence each time the level is attempted (say for a "Simon says" type game), you could also read a variable off the disk, add one to it, use it as the seed, and then save it back to the disk, so every time the game was run you got a guaranteed different level, since the seed would keep going up by one every time the code was run and the random numbers that created the level would be different (at least until the sequence repeated), hope that helps, cheers.

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 12th Jan 2004 21:34 Edited at: 12th Jan 2004 21:34
yup, thats got it

More coffee plz !!!
Maximus_UK
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location: England
Posted: 15th Jan 2004 18:25
i hav a problem here with trying to make a backdrop for the game. when i use the backdrop on and texture backrop i get told the command is obsolete. the manual says to use sky spheres instead but i cant find any reference to sky spheres or what they r.
i simply wish to paste an image as a backdrop and then hav the board placed on top of the background image without clearing the background(or covering it up) first.

` create backdrop
create_backdrop:
load image "images/sky1.jpg",2,1
backdrop on
texture backdrop 2
return

any ideas to where i'm going wrong or if some1 can point me in the direction of these sky sphere things plz

More coffee plz !!!
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 16th Jan 2004 20:54
in this case since the camera never moves you can just make a plain object

make object plain 2000,300,200

then texture it with your background image

texture object 2000,background_image

and you will need to rotate it so that it is not edge on to the camera and then move it behind the matrix (if it is edge on then you wouldn`t see it since DB considers plains to have a thickness of zero, hence invisible, turn culling off too since that may make it invisble to you as well)

pitch object down 2000,90
set object cull 2000,0

and then position the object wherever looks best, if it`s too small when you position it behind the matrix then just scale it until it is big enough.

scale object 2000,150 or whatever (size is in percent, with 100 as no change and less as smaller, more as bigger)

cheers.

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.

Login to post a reply

Server time is: 2024-11-26 01:57:27
Your offset time is: 2024-11-26 01:57:27