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.

DarkBASIC Professional Discussion / Weirdness with SHIFT MATRIX

Author
Message
DJ_Irritant
23
Years of Service
User Offline
Joined: 19th Jul 2003
Location:
Posted: 29th Jul 2003 06:15
Hello,

I've been hacking up the old code for CAVERUN that came with DBC, trying to get it to scroll the matrix correctly (SHIFT MATRIX UP). When run, it produces this strange lurching forward and then back every time the z# variable (for fwd motion) rolls into the next tile of the matrix.

The critical lines of code are 79 to 99, and they are essentially unchanged from the original. To try this out, you'll need to patch in a texture file of your own on line 12.

In this example, I've stripped out all the non-essentials from the original, like sounds, generating new cave floor, etc. which don't affect the issue at hand here. I changed everything that's supposed to be floating point to FP, and I added some print statements, too.

The wrapping, matrix positioning, matrix shifting, and camera positioning code all seem to be exactly right. I've tried a bunch of variations on them with no success.

So for the life of my I don't know why I get the lurching behavior. The cave roof looks pretty weird, too, as if the back face culling went out of control.

No doubt, it'll seem pretty obvious once it's pointed out!

Thanks!
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 29th Jul 2003 07:07
I'm thinking it might have something to with the way you've used "wrapvalue" but I'm not sure...checkin it out right now...

btw it is a wierd error

SW Games - www.freewebs.com/swgames

Yeah, I know, I only have one game. Yeah, I know it sucks. But I made it! Me!
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 29th Jul 2003 07:13 Edited at: 29th Jul 2003 07:15
Figured it out!



Take out this part entirely and it works just fine....I really don't see a purpose for this being here unless you needed it?

By the way, it's not SHIFT matrix, it's the fact that every time z# gets past 200 it resets to 0.

SW Games - www.freewebs.com/swgames

Yeah, I know, I only have one game. Yeah, I know it sucks. But I made it! Me!
DJ_Irritant
23
Years of Service
User Offline
Joined: 19th Jul 2003
Location:
Posted: 29th Jul 2003 16:15
Yes, that fix works, but doesn't accomplish what the original CAVERUN was trying to accomplish, which is to create an "infinite" cave by using SHIFT MATRIX UP as the player moved forward.

I had deleted some other code for this example, but the original code generated some more random cave floor on the back edge of the matrix just before it did the SHIFT MATRIX UP. I think this was the original author's reason for doing the
followed by the correction to POSITION MATRIX later on. Otherwise z# and the numbers used in POSITION MATRIX could potentially grow unbounded if that -200 correction weren't continually applied to z# (200 being the same size as the z-axis dimension of a single matrix tile).

What is weird is that the sample code works perfectly in DB Classic, and looks awful (both the lurching and the weird cave roof) in DBPro.
In DB Classic, one gets a nice roof and an infinite corridor of constantly changing cave when moving forward along the +Z axis. Yet it's only a handful of instructions that do *not* work at all right in DBPro. I'm a bit stumped!
Darkflame
23
Years of Service
User Offline
Joined: 4th Jul 2003
Location:
Posted: 29th Jul 2003 17:08
looks like the same problem I am having, the Z value of heights seem to flip when using shift matrix...making infinte tarains not work correctly.

spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 29th Jul 2003 17:43
Shift matrix has never worked in dbpro. It reverses the sign of heigths on every shift. So a hill becomes a hole, then a hill, then a hole, e.t.c. Also the first time you do a shift it blanks out a whole row of heights and copies the wrong texture.

Update 5 has supposedly fixed all these bugs.

I will test it later on

The programmer formerly known as sonic
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 29th Jul 2003 18:49
In case anyone is interested (probably not), the code below shows how shift matrix now works perfectly in Update 5 (at last!)

The programmer formerly known as sonic
DJ_Irritant
23
Years of Service
User Offline
Joined: 19th Jul 2003
Location:
Posted: 29th Jul 2003 22:50
I think this completely explains it....

Quote: "Shift matrix has never worked in dbpro. It reverses the sign of heigths on every shift. So a hill becomes a hole, then a hill, then a hole, e.t.c. Also the first time you do a shift it blanks out a whole row of heights and copies the wrong texture.

Update 5 has supposedly fixed all these bugs.
"


I'm working with the 30-day demo version of DBPro, weighing whether to plunk down the money for the real one. So I would not have the update installed (supposedly only works on official copies). Actually, I'd like that mega-pack with all that other stuff.

Thanks, spooky, for your help! BTW, despite the nonsense of dealing with this bug, is DBPro worth getting after all?
Darkflame
23
Years of Service
User Offline
Joined: 4th Jul 2003
Location:
Posted: 30th Jul 2003 13:52
So wait....version 5 will solve this?
Great

But, in the meantime, will inserting an additional shift matrix help? (before the update matrix comand)

Login to post a reply

Server time is: 2026-07-21 21:13:13
Your offset time is: 2026-07-21 21:13:13