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 / Collision on my not so normal map

Author
Message
Viva la mac
16
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 6th Apr 2008 18:47
Hi All,

I searched around the forum and aint found nothing for my 3rd person skate park. Becuase the map is a skate park and it has ramps and stuff i was just wondering what i need put into the code to make my character (which i havn't actually added yet because i don't know how to yet haha) at the mo i just walk straight through the ramps and very slowly aswell.
This is my code so far.

Rem Project: 3rd Person Shooter
Rem Created: 5/29/2007 7:29PM

Rem ***** Main Source File *****
make camera 1
sync on
sync rate 24
sync

load object "philly\philly skate park.x",1
load image "philly\photoshop_texture_colors.jpg",1
texture object 1,1

DO
set camera to follow object position x(1),object position y(1),object position z(1),object angle y(1),4,15,50,0
rotate camera object angle x(1),object angle y(1),object angle z(1)
move camera 1*-0.7
`set object to camera orientation 1
position object 1, Px+500, Py, Pz-25

control camera using arrowkeys 1, .5, .7
`Set Camera To Follow 1, Px+100,Py,Pz,Py,10,Py,20,0



IF UPKEY()=1
`MOVE OBJECT 1,.5
loop object 1, 300, 318
endif

IF DOWNKEY()=1
`MOVE OBJECT 1,-.5
loop object 1, 300, 318
endif

IF LEFTKEY()=1
`TURN OBJECT LEFT 1,.7
loop object 1, 280, 289
endif

IF RIGHTKEY()=1
`TURN OBJECT RIGHT 1,.7
loop object 1, 260, 279
endif

SYNC
LOOP

The map file is attached and i just used a wood texture on the map.

Thanks all,

Mac

Attachments

Login to view attachments
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 6th Apr 2008 19:23
The slowness may be because of the size of the model you are using. You might try breaking up the skate park into it's separate ramps and load them individually. This will allow DBPro to cull the ones that are not in camera view and will help speed up performance.

For collision, I'll suggest what everyone else suggests. I haven't gone into setting up collision just yet so I can't help set it up fully yet, but do a search for Sparky's Collision DLL. In fact, a good place to look is the DLL Chat forum and look at the stickies at the top. There's a thread there that has a good list of all the add-on dlls available. Sparky's is listed.

In the download for Sparky's DLL there are demo programs that show you how to use the collision code.

Viva la mac
16
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 6th Apr 2008 19:29
how would i then load each individual ramp into the correct position? is it just acase of load object and setting the x y z in the correct place?

And thanks for the info on that will try it out now.

Marc
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 6th Apr 2008 20:53
The slowness comes from having set the sync rate too low, try 60, or even 0, which will give max possible screen frame rate achievable.

Then increase the move and rotate values if sync 0 is not enough.

Dividing the object will lead to a hassle with collision checks
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 6th Apr 2008 22:07
Yes, it's just a matter of setting the position of the object after it's loaded. I only mention breaking up the ramp object because I was playing with various terrain techniques and a few of them used one large object for the terrain. Frame rate dropped by 75% when using a single object, but went back up into the 300s when using a multi-object terrain. The reason being (I read this in another thread) DBPro uses per object culling, so if any portion of the object is visible on screen then it draws the entire object each frame. When the terrain is broken up the objects not visible in front of the camera are not drawn. Whether the entire park as a single object is slowing you down a lot or not, your framerate will still go up if you make them separate objects. Some of that depends on your scale as well. If in your game these ramps aren't that big in proportion to your player, then it may not help as much as if the park is huge in relative scale to the player.

The sync rate is also a factor, and may solve all of the slowness problem you're currently having. Down the road as you get closer to completion with more details and models and effects, the above may have more of an impact.

Nice park model by the way..

@Scorpyo

Is it that difficult to handle collision across multiple objects? If so then the multi-object terrain path may be more difficult for me than I originally anticipated.

Viva la mac
16
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 6th Apr 2008 22:48
Cheers for all the help guys, and the compliments on the park. The park looks about the right size at the mo but when i do find out how to add a player in 3rd person view is when i'll be able to tell how big or small it is.

And on this sparkys dll is there a certain code i need to apply to the character? I tried a few codes i got within darkbasic pro itself but none of it worked

One more thing, since i've been tryin this i have been learning a bit along my way


Thanks,

Marc
Krisper
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 6th Apr 2008 23:02
Quote: "Is it that difficult to handle collision across multiple objects? If so then the multi-object terrain path may be more difficult for me than I originally anticipated."

No it is not difficult with Sparkys dll. You can set up collision groups using Sparkys. Then you can check for collision with a group. This way you can also have different groups of objects and make them behave differently with the collision. eg, you could slide on some objects, you could bounce off others. Without looking at the skate park, I think this would benefit by using separate objects for the ramps etc, then you can have different behavior depending on the type of ramp. If you set up the whole park, ramps and all as one object you can only program in one collision behavior for the whole place.

Login to post a reply

Server time is: 2024-09-27 12:18:38
Your offset time is: 2024-09-27 12:18:38