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.

Code Snippets / Matrix example with slope physics

Author
Message
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 01:10
Been playing with matrices and come up with following to demonstrate texturing, slope physics, e.t.c.

By playing with the variables at top of code, you can tailor program for different types of games.

I think it copes with nearly everything.

During programming though I found some combinations of matrix size produced weird ground height effects but haven't tracked problem down yet. I'll repost any mods.



I love it when a plan comes together
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 01:14
Some lines did not post correctly!



I love it when a plan comes together
Fallen
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Portugal
Posted: 14th Feb 2003 04:19
Thanks m8!! Thats a great code and it really helped me It only have to collide with 3D objects to
Wonderfull code sonic

Kohai of UWDesign
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: France
Posted: 14th Feb 2003 09:23
nice code ...


Make it jump off-hills, now ! ^^

[Kohai]
[url]www.underwaredesign.com[/url] [url]www.kohaistyle.com[/url]
pIII 733/256 Ram/Geforce 256
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 14th Feb 2003 13:39
Things I'm going to do next:

1. Have option of not sliding down shallow slopes as this is not natural

2. Stick in some 3d objects, like cubes, or 'x' files and allow collision on those aswell

3. Trace DBPro bug where certain combinations of matrix sizes produce negative ground heights in certain locations.

4. Maybe do a jump routine as Kohai suggests, but this means writing some sort of gravity code. Shouldn't be too had though (fingers crossed)

I love it when a plan comes together
Fallen
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Portugal
Posted: 14th Feb 2003 22:05
yeeeeee!!!!! When you do it pleaseee tell us!!

Stevo
21
Years of Service
User Offline
Joined: 4th Oct 2002
Location:
Posted: 15th Feb 2003 00:58
Yeah got to jump off hills, I've got a bit of a project done with a car, I've got it done also with the wheels as separate objects to work on suspension for each wheel, also the wheels turn, I just need some way to make it jumpppp!!

spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 16th Feb 2003 00:48
Updated version. You now don't slide down shallow hills.
Sliding collision also on objects. They can even push you around!

Also stuck in a very basic rotating sky sphere.





Gronda, Gronda
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 16th Feb 2003 17:05
is it just me or is that code really low in the fps
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 16th Feb 2003 17:11
ouch ouch ouch sonic, bad move

for r=0 to 35
(code)
if object collision(r+100,0)>0 then eh#=objcol#
(code)
next r

you do THIRTY FIVE COLLISIONS IN ONE LOOP! HOLY SHAZ! Thats not common sense man, taht eats through the fps like grandma eats through her strait jacket. Must....be...better...
Daz
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: United Kingdom
Posted: 16th Feb 2003 17:43
I don't care, that's way better than anything I could ever do. Nice code, mate.

DarkBASIC Professional is the best programming utility.
8/10 Housewives agree!
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 16th Feb 2003 19:03
I did not notice any slowdown on my 2 pc's, still get well over 100fps

Admittedly one is an athlon xp2000 with geforce ti4600 and other is a laptop with p4 2.5ghz and radeon 9000 graphics

When I get time I will rewrite whole thing properly anyway

I will also try on some slower pc's as I obviously don't realise just how slow it possibly runs on slower pc's

Or maybe everyone else should buy a faster pc!

Gronda, Gronda
Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 16th Feb 2003 20:11
Awesome work man

Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 17th Feb 2003 07:24
Looks Awesome... but fps could be better,but I've seen worse...

John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 20th Feb 2003 05:06
Was this done in pro? it wont work in classic for me

RPGamer

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 20th Feb 2003 12:45
Done in Pro with latest patch.

Didn't bother loading up classic on my new pc as I didn't want to waste time getting programs to work on both.

p.s.

It will speed up a bit if you take off sky sphere and the wavy water effect.

I have also rejigged the collision stuff to be a bit faster but I am saving this code for a game I am writing.

Once game is finished, I may post code.

The idea of the post was to help people having problems with matrix code and for them to improve the code themselves.

You will never learn if all you do is cut and paste!

Gronda, Gronda
Fallen
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Portugal
Posted: 20th Feb 2003 16:00
your code is awesome..it if you could make a update to colllisions with 3d objects (.x and .3ds) it would be outstanding!!!!!

spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 20th Feb 2003 17:10
I think if you stick an 'x' file somewhere on matrix, collision should be automatic because of the way I've done things.

When I get home tonight, I'll have a play.

I've never actually done anything with 'proper' 3d objects yet but I suppose now is the time!

Gronda, Gronda
LLX
21
Years of Service
User Offline
Joined: 17th Feb 2003
Location:
Posted: 20th Feb 2003 19:30
only have clasic still its looks Super...Sonic...now all you need to do is add in a round guy with a mustach who collects rings er... $$$

spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 21st Feb 2003 13:38
Plonked a few 'x' files on matrix and appears that any loaded objects are autoset to box collision. So long as that box touches the ground, then sliding collision is already working. Alternatively you can set sphere collision on any loaded objects. Polygon collision just crashes on my computer when you approach the object (probably getting fixed in patch 4)

You should also note that sliding collision is only done on native and loaded objects if they touch the ground. If you had a hovering cube for instance, you would walk straight through it!

Another problem is that if objects are not 'thick' enough, you will probably slide right through them.

The tile textures are just random rubbish that program creates so I don't have to provide image files. You can just cut and paste code. Once there are some proper textures in there and I've written a matrix editor, it will probably be quite good.

To allow jumping means doing really complicated collision stuff and allowing you to walk on top of objects. I'm just not interested in doing this at the moment!

I did have an idea of doing multiple matrixes so you could have caves and tunnels but still allowing you to climb over the mountain over the cave (if you see what I mean). I might have a go at this at weekend as it opens up some possibilites of good games.

The other obvious ommision is doing a third person view behind the player and this will entail some clever camera following code.

Gronda, Gronda
Iceman00
21
Years of Service
User Offline
Joined: 15th Feb 2003
Location:
Posted: 27th Feb 2003 05:55
Could you post just the slope physics, because i'm trying to pick throught you code but i'm not sure i understand it(The Slope Part)

Login to post a reply

Server time is: 2024-04-24 21:14:28
Your offset time is: 2024-04-24 21:14:28