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 / matrix : player position - weird thing??? maybe with vectors

Author
Message
Cretinous
19
Years of Service
User Offline
Joined: 10th Mar 2005
Location:
Posted: 18th Apr 2006 22:28
I'm am trying to make a game where a 9 matrices are placed around a player whereevar he might move. eg.
1 = first matrix, 2 = second matrix, etc...

start - player is on matrix 5
123
456
789
player moves to matrix 6
231
564
897
player moves to matrix 1
978
312
645

If you understand what I mean you are a genius, if you can anwser me then you a ??? (something better then a genius that stupid people like me cannot even contemplate)

[url=http://www.cretinous.co.nr/]
[/url]
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 19th Apr 2006 05:49
i know what you mean.
the numbers are the locations of the matrices around you!!!
Relativity
19
Years of Service
User Offline
Joined: 29th Mar 2005
Location: Position is relative.
Posted: 19th Apr 2006 05:57
I think I understand!
You want to make nine matrices and, depending on which matrix the player is standing, you want to make that matrix the center with the other nine around it. Am I right?

Anyway, why not make it just one matrix? Then you could do something similar to what you want with the SHIFT MATRIX commands (the commands may be different in DBP).
Relativity
19
Years of Service
User Offline
Joined: 29th Mar 2005
Location: Position is relative.
Posted: 19th Apr 2006 05:58
Confound it, Digital Dude! You beat me again!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Apr 2006 07:01 Edited at: 19th Apr 2006 07:03
I hope I understand you correctly, since you didn't really even ask a question.

Let's assume all 9 matrices are 1000x1000 and arranged into a square like the image shows. The overall world coordinates range from (0,0) to (3000,3000).

matrix = int(playerZ / 1000)*3 + int(playerX / 1000)+1

We multiply the first part by 3 because thats how many matrices are in each row. We add 1 to the second part because we're starting at matrix number 1 instead of 0. (as most languages would normally have us do)




Attachments

Login to view attachments
Cretinous
19
Years of Service
User Offline
Joined: 10th Mar 2005
Location:
Posted: 19th Apr 2006 19:45
oops sorry no question. I need a code that moves the matrices like in my previous post dependent on which matrix i am stood in
eg.


My question is that is there a better way of programing this so I can change the matrices etc. and not use up all my memory?

I think it is done with vectors but have not used them yet in Dark Basic (pro) and have found no documentation on them. I need a strand of code that will determine were each matrix lies without a million ifs

Sorry for the unclear question and thanks for your effort

[url=http://www.cretinous.co.nr/]
[/url]
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Apr 2006 20:07
Ah ok, I see what you mean now. (dang, drew a picture for nothing)

So basically, you want to shift the matrices positions so that the matrix the player is standing in, is at the center.

You'd probably have better luck doing the shift matrix as Relativity suggested.


Cretinous
19
Years of Service
User Offline
Joined: 10th Mar 2005
Location:
Posted: 19th Apr 2006 22:37
I tried it but with limited results. It worked but as i wanted to change the matrix heights and stuff it guzzled up the memory.

Is there anywhere that I can learn about implementing vectors?

[url=http://www.cretinous.co.nr/]
[/url]
Relativity
19
Years of Service
User Offline
Joined: 29th Mar 2005
Location: Position is relative.
Posted: 20th Apr 2006 00:28
Well, you could learn about vectors here: http://www.geocities.com/SiliconValley/2151/math3d.html

If I understand you correctly, though, I don't think vectors is what you're looking for. What you could do is just use an array to store the numbers of the matrices in sequential order. For example, assuming your player was at matrix 6, you would get:


Of course, that would be a rather dull and monotonous way to do it. You could probably do it with a couple of FOR NEXT loops, though.
Cretinous
19
Years of Service
User Offline
Joined: 10th Mar 2005
Location:
Posted: 20th Apr 2006 20:13
Thx for the link. I have played around with vectors and managed to do it...
My code is still needs work but i will tell you my principle (if you even care)

each matrix has a number (1-9) and i modify those numbers to vector in comparisin to the players matrix. so if the player is in matrix 5 then the vector change is 0,0 and if the players matrix is 6 then the vector is 1,0 etc

Sorry for the bad spelling and explination

[url=http://www.cretinous.co.nr/]
[/url]

Login to post a reply

Server time is: 2024-09-24 21:32:09
Your offset time is: 2024-09-24 21:32:09